Class: Cognition::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/cognition/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#commandObject (readonly)

Returns the value of attribute command.



3
4
5
# File 'lib/cognition/message.rb', line 3

def command
  @command
end

#metadataObject (readonly)

Returns the value of attribute metadata.



3
4
5
# File 'lib/cognition/message.rb', line 3

def 
  
end

#responderObject (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