class Rapidomize::Message
Message
objects are at the core of SDK. Each message is an independent entity with following information
Attributes
app_id[R]
payload[R]
token[R]
uri[R]
Public Class Methods
new(uri, payload = nil, token = nil, app_id = nil)
click to toggle source
Initialize a message object @param uri [URI, String] Destination of the message. @param payload [Hash, String, Rapidomize::Payload] Payload
to transmit. @param token [String] Authorization token @param app_id
[String] Receiving app id
# File lib/rapidomize/message.rb, line 19 def initialize(uri, payload = nil, token = nil, app_id = nil) raise ArgumentError, 'uri is nil' if uri.nil? @payload = Payload.create(payload) @uri = sanitize_uri(uri) @app_id = app_id @token = token end
Private Instance Methods
sanitize_uri(uri)
click to toggle source
sanitize URIs. TODO: make sure the given URI is a valid rapidomize URL
# File lib/rapidomize/message.rb, line 32 def sanitize_uri(uri) if uri.is_a? String URI(uri) else uri end end