Class: Hutzbot::Conversation
- Inherits:
-
Object
- Object
- Hutzbot::Conversation
- Defined in:
- lib/hutzbot/hutzbot.rb
Instance Attribute Summary collapse
-
#application ⇒ Object
Returns the value of attribute application.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#current_state ⇒ Object
Returns the value of attribute current_state.
-
#daily_counter ⇒ Object
Returns the value of attribute daily_counter.
-
#id ⇒ Object
Returns the value of attribute id.
-
#responses ⇒ Object
Returns the value of attribute responses.
-
#tagged_document ⇒ Object
Returns the value of attribute tagged_document.
-
#taxonomy ⇒ Object
Returns the value of attribute taxonomy.
-
#user ⇒ Object
Returns the value of attribute user.
-
#valid_responses ⇒ Object
Returns the value of attribute valid_responses.
Instance Method Summary collapse
- #closed? ⇒ Boolean
-
#initialize(attrs) ⇒ Conversation
constructor
A new instance of Conversation.
Constructor Details
#initialize(attrs) ⇒ Conversation
Returns a new instance of Conversation.
44 45 46 47 48 49 |
# File 'lib/hutzbot/hutzbot.rb', line 44 def initialize attrs @id, @current_state, @taxonomy, @tagged_document, @user, @application, @daily_counter = *attrs.values_at('id', 'current_state', 'taxonomy', 'tagged_document', 'user', 'application', 'daily_counter') @created_at = Date.parse(attrs['created_at']) @responses = attrs['responses'].map{ |r| Response.new(r) } if attrs['responses'] @valid_responses = attrs['valid_responses'].map{ |vr| ValidResponse.new(vr) } if attrs['valid_responses'] end |
Instance Attribute Details
#application ⇒ Object
Returns the value of attribute application.
40 41 42 |
# File 'lib/hutzbot/hutzbot.rb', line 40 def application @application end |
#created_at ⇒ Object
Returns the value of attribute created_at.
34 35 36 |
# File 'lib/hutzbot/hutzbot.rb', line 34 def created_at @created_at end |
#current_state ⇒ Object
Returns the value of attribute current_state.
35 36 37 |
# File 'lib/hutzbot/hutzbot.rb', line 35 def current_state @current_state end |
#daily_counter ⇒ Object
Returns the value of attribute daily_counter.
37 38 39 |
# File 'lib/hutzbot/hutzbot.rb', line 37 def daily_counter @daily_counter end |
#id ⇒ Object
Returns the value of attribute id.
33 34 35 |
# File 'lib/hutzbot/hutzbot.rb', line 33 def id @id end |
#responses ⇒ Object
Returns the value of attribute responses.
41 42 43 |
# File 'lib/hutzbot/hutzbot.rb', line 41 def responses @responses end |
#tagged_document ⇒ Object
Returns the value of attribute tagged_document.
38 39 40 |
# File 'lib/hutzbot/hutzbot.rb', line 38 def tagged_document @tagged_document end |
#taxonomy ⇒ Object
Returns the value of attribute taxonomy.
36 37 38 |
# File 'lib/hutzbot/hutzbot.rb', line 36 def taxonomy @taxonomy end |
#user ⇒ Object
Returns the value of attribute user.
39 40 41 |
# File 'lib/hutzbot/hutzbot.rb', line 39 def user @user end |
#valid_responses ⇒ Object
Returns the value of attribute valid_responses.
42 43 44 |
# File 'lib/hutzbot/hutzbot.rb', line 42 def valid_responses @valid_responses end |
Instance Method Details
#closed? ⇒ Boolean
51 52 53 |
# File 'lib/hutzbot/hutzbot.rb', line 51 def closed? current_state=='closed' end |