Class: Chatbase::Message
- Inherits:
-
Object
- Object
- Chatbase::Message
- Defined in:
- lib/chatbase/message.rb
Instance Attribute Summary collapse
-
#agent_key ⇒ Object
Returns the value of attribute agent_key.
Instance Method Summary collapse
- #http_service ⇒ Object
-
#initialize(agent_key: nil) ⇒ Message
constructor
A new instance of Message.
- #send_fbmessage(request_parameters) ⇒ Object
- #send_message(request_parameters) ⇒ Object
Constructor Details
#initialize(agent_key: nil) ⇒ Message
Returns a new instance of Message.
5 6 7 8 |
# File 'lib/chatbase/message.rb', line 5 def initialize(agent_key: nil) @agent_key = agent_key || Chatbase.agent_key @http_service = HttpService.new end |
Instance Attribute Details
#agent_key ⇒ Object
Returns the value of attribute agent_key.
3 4 5 |
# File 'lib/chatbase/message.rb', line 3 def agent_key @agent_key end |
Instance Method Details
#http_service ⇒ Object
10 11 12 |
# File 'lib/chatbase/message.rb', line 10 def http_service @http_service end |
#send_fbmessage(request_parameters) ⇒ Object
18 19 20 |
# File 'lib/chatbase/message.rb', line 18 def (request_parameters) http_service.request_post("/api/facebook/message_received?api_key=#{@agent_key}", request_parameters) end |
#send_message(request_parameters) ⇒ Object
14 15 16 |
# File 'lib/chatbase/message.rb', line 14 def (request_parameters) http_service.request_post("/api/message", {'api_key': @agent_key}.merge(request_parameters)) end |