Class: WitBot::Expression
- Inherits:
-
Object
- Object
- WitBot::Expression
- Defined in:
- lib/wit_bot/models/wit/expression.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#intent ⇒ Object
Returns the value of attribute intent.
Instance Method Summary collapse
- #create ⇒ Object
- #delete ⇒ Object
-
#initialize(intent, body, request: false) ⇒ Expression
constructor
A new instance of Expression.
- #to_h ⇒ Object (also: #as_json)
Constructor Details
#initialize(intent, body, request: false) ⇒ Expression
Returns a new instance of Expression.
5 6 7 8 9 |
# File 'lib/wit_bot/models/wit/expression.rb', line 5 def initialize(intent, body, request: false) @intent = intent @body = body.is_a?(Hash) ? body.with_indifferent_access[:body] : body create if request end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/wit_bot/models/wit/expression.rb', line 3 def body @body end |
#intent ⇒ Object
Returns the value of attribute intent.
3 4 5 |
# File 'lib/wit_bot/models/wit/expression.rb', line 3 def intent @intent end |
Instance Method Details
#create ⇒ Object
11 12 13 14 |
# File 'lib/wit_bot/models/wit/expression.rb', line 11 def create request.create intent.get end |
#delete ⇒ Object
16 17 18 19 |
# File 'lib/wit_bot/models/wit/expression.rb', line 16 def delete request.delete intent.get end |
#to_h ⇒ Object Also known as: as_json
21 22 23 |
# File 'lib/wit_bot/models/wit/expression.rb', line 21 def to_h {body: body} end |