class MessagebusApiClient
Public Class Methods
new(api_key, api_endpoint = DEFAULT_API_ENDPOINT)
click to toggle source
Calls superclass method
MessagebusSDK::MessagebusBase::new
# File lib/messagebus-sdk/api_client.rb, line 19 def initialize(api_key, api_endpoint = DEFAULT_API_ENDPOINT) super(api_key, api_endpoint) @rest_endpoints = define_rest_endpoints end
Public Instance Methods
channel_config(channel_key)
click to toggle source
# File lib/messagebus-sdk/api_client.rb, line 35 def channel_config(channel_key) path = replace_channel_key("#{@rest_endpoints[:channel_config]}", channel_key) make_api_request(path, HTTP_GET) end
channel_create_session(channel_key, session_name)
click to toggle source
# File lib/messagebus-sdk/api_client.rb, line 45 def channel_create_session(channel_key, session_name) path = replace_channel_key("#{@rest_endpoints[:channel_sessions]}", channel_key) json = {:sessionName => session_name}.to_json make_api_request(path, HTTP_POST, json) end
channel_rename_session(channel_key, session_key, session_name)
click to toggle source
# File lib/messagebus-sdk/api_client.rb, line 51 def channel_rename_session(channel_key, session_key, session_name) path = replace_channel_and_session_key("#{@rest_endpoints[:channel_session_rename]}", channel_key, session_key) json = {:sessionName => session_name}.to_json make_api_request(path, HTTP_PUT, json) end
channel_sessions(channel_key)
click to toggle source
# File lib/messagebus-sdk/api_client.rb, line 40 def channel_sessions(channel_key) path = replace_channel_key("#{@rest_endpoints[:channel_sessions]}", channel_key) make_api_request(path, HTTP_GET) end
channels()
click to toggle source
# File lib/messagebus-sdk/api_client.rb, line 30 def channels path = "#{@rest_endpoints[:channels]}" make_api_request(path, HTTP_GET) end
send_messages(params)
click to toggle source
# File lib/messagebus-sdk/api_client.rb, line 24 def send_messages(params) path = @rest_endpoints[:message_emails_send] json = {:messages => params}.to_json make_api_request(path, HTTP_POST, json) end
Private Instance Methods
define_rest_endpoints()
click to toggle source
# File lib/messagebus-sdk/api_client.rb, line 59 def define_rest_endpoints { :message_emails_send => "/v5/messages/send", :channels => "/v5/channels", :channel_config => "/v5/channel/%CHANNEL_KEY%/config", :channel_sessions => "/v5/channel/%CHANNEL_KEY%/sessions", :channel_session_rename => "/v5/channel/%CHANNEL_KEY%/session/%SESSION_KEY%/rename" } end