Class: Bearychat::RTM

Inherits:
Object
  • Object
show all
Defined in:
lib/bearychat/rtm.rb

Constant Summary collapse

MESSAGE_URL =
"https://rtm.bearychat.com/message"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ RTM

Returns a new instance of RTM.



10
11
12
13
# File 'lib/bearychat/rtm.rb', line 10

def initialize(token)
  self.http_client = HttpClient.new(MESSAGE_URL)
  self.token = token
end

Instance Attribute Details

#http_clientObject

Returns the value of attribute http_client.



8
9
10
# File 'lib/bearychat/rtm.rb', line 8

def http_client
  @http_client
end

#tokenObject

Returns the value of attribute token.



8
9
10
# File 'lib/bearychat/rtm.rb', line 8

def token
  @token
end

Instance Method Details

#send(message) ⇒ Object



15
16
17
# File 'lib/bearychat/rtm.rb', line 15

def send(message)
  http_client.post_json({ token: token }.merge(message).to_json)
end