Class: Cognition::Message
- Inherits:
-
Object
- Object
- Cognition::Message
- Defined in:
- lib/cognition/message.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#responder ⇒ Object
readonly
Returns the value of attribute responder.
Instance Method Summary collapse
-
#initialize(command, metadata = {}) ⇒ Message
constructor
A new instance of Message.
- #reply(text) ⇒ Object
Constructor Details
#initialize(command, metadata = {}) ⇒ Message
Returns a new instance of Message.
5 6 7 8 9 |
# File 'lib/cognition/message.rb', line 5 def initialize(command, = {}) @command = command = @responder = Cognition::Responder.new(["callback_url"]) if ["callback_url"] end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
3 4 5 |
# File 'lib/cognition/message.rb', line 3 def command @command end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
3 4 5 |
# File 'lib/cognition/message.rb', line 3 def end |
#responder ⇒ Object (readonly)
Returns the value of attribute responder.
3 4 5 |
# File 'lib/cognition/message.rb', line 3 def responder @responder end |
Instance Method Details
#reply(text) ⇒ Object
11 12 13 14 |
# File 'lib/cognition/message.rb', line 11 def reply(text) return "No Callback URL provided" unless @responder @responder.reply(text) end |