Class: WitBot::MessageThread
- Inherits:
-
Object
- Object
- WitBot::MessageThread
- Defined in:
- lib/wit_bot/models/message_thread.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
Instance Method Summary collapse
- #context ⇒ Object
- #create_message(text, id = SecureRandom.uuid) ⇒ Object
-
#initialize(id = SecureRandom.uuid) ⇒ MessageThread
constructor
A new instance of MessageThread.
- #message(id) ⇒ Object
- #messages_list ⇒ Object
- #reset_context ⇒ Object
Constructor Details
#initialize(id = SecureRandom.uuid) ⇒ MessageThread
Returns a new instance of MessageThread.
5 6 7 8 |
# File 'lib/wit_bot/models/message_thread.rb', line 5 def initialize(id=SecureRandom.uuid) @id = id = {} end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/wit_bot/models/message_thread.rb', line 3 def id @id end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
3 4 5 |
# File 'lib/wit_bot/models/message_thread.rb', line 3 def end |
Instance Method Details
#context ⇒ Object
22 23 24 |
# File 'lib/wit_bot/models/message_thread.rb', line 22 def context @context ||= Context.new end |
#create_message(text, id = SecureRandom.uuid) ⇒ Object
18 19 20 |
# File 'lib/wit_bot/models/message_thread.rb', line 18 def (text, id=SecureRandom.uuid) WitBot::Message.new self, text, id: id end |
#message(id) ⇒ Object
10 11 12 |
# File 'lib/wit_bot/models/message_thread.rb', line 10 def (id) [id] end |
#messages_list ⇒ Object
14 15 16 |
# File 'lib/wit_bot/models/message_thread.rb', line 14 def .values end |
#reset_context ⇒ Object
26 27 28 |
# File 'lib/wit_bot/models/message_thread.rb', line 26 def reset_context @context = Context.new end |