Class: Hutzbot::Conversation

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#applicationObject

Returns the value of attribute application.



40
41
42
# File 'lib/hutzbot/hutzbot.rb', line 40

def application
  @application
end

#created_atObject

Returns the value of attribute created_at.



34
35
36
# File 'lib/hutzbot/hutzbot.rb', line 34

def created_at
  @created_at
end

#current_stateObject

Returns the value of attribute current_state.



35
36
37
# File 'lib/hutzbot/hutzbot.rb', line 35

def current_state
  @current_state
end

#daily_counterObject

Returns the value of attribute daily_counter.



37
38
39
# File 'lib/hutzbot/hutzbot.rb', line 37

def daily_counter
  @daily_counter
end

#idObject

Returns the value of attribute id.



33
34
35
# File 'lib/hutzbot/hutzbot.rb', line 33

def id
  @id
end

#responsesObject

Returns the value of attribute responses.



41
42
43
# File 'lib/hutzbot/hutzbot.rb', line 41

def responses
  @responses
end

#tagged_documentObject

Returns the value of attribute tagged_document.



38
39
40
# File 'lib/hutzbot/hutzbot.rb', line 38

def tagged_document
  @tagged_document
end

#taxonomyObject

Returns the value of attribute taxonomy.



36
37
38
# File 'lib/hutzbot/hutzbot.rb', line 36

def taxonomy
  @taxonomy
end

#userObject

Returns the value of attribute user.



39
40
41
# File 'lib/hutzbot/hutzbot.rb', line 39

def user
  @user
end

#valid_responsesObject

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

Returns:

  • (Boolean)


51
52
53
# File 'lib/hutzbot/hutzbot.rb', line 51

def closed?
  current_state=='closed'
end