Class: WitBot::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/wit_bot/models/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#entitiesObject



10
11
12
# File 'lib/wit_bot/models/context.rb', line 10

def entities
  @entities ||= ContextEntities.new
end

#hash=(value) ⇒ Object (writeonly)

Sets the attribute hash



4
5
6
# File 'lib/wit_bot/models/context.rb', line 4

def hash=(value)
  @hash = value
end

#locationObject

Returns the value of attribute location.



3
4
5
# File 'lib/wit_bot/models/context.rb', line 3

def location
  @location
end

#reference_timeObject

Returns the value of attribute reference_time.



3
4
5
# File 'lib/wit_bot/models/context.rb', line 3

def reference_time
  @reference_time
end

#stateObject

Returns the value of attribute state.



3
4
5
# File 'lib/wit_bot/models/context.rb', line 3

def state
  @state
end

Instance Method Details

#as_jsonObject



14
15
16
17
18
19
20
21
# File 'lib/wit_bot/models/context.rb', line 14

def as_json
  h = {}
  h[:state] = state if state
  h[:reference_time] = reference_time.iso8601 if reference_time
  h[:entities] = entities if @entities
  h[:location] = location if location
  h
end

#empty?Boolean



6
7
8
# File 'lib/wit_bot/models/context.rb', line 6

def empty?
  as_json.empty?
end