Class: Exa::Services::Answer
- Inherits:
-
Object
- Object
- Exa::Services::Answer
- Defined in:
- lib/exa/services/answer.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(connection, **params) ⇒ Answer
constructor
A new instance of Answer.
Constructor Details
#initialize(connection, **params) ⇒ Answer
Returns a new instance of Answer.
6 7 8 9 |
# File 'lib/exa/services/answer.rb', line 6 def initialize(connection, **params) @connection = connection @params = params end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/exa/services/answer.rb', line 11 def call response = @connection.post("/answer", @params) body = response.body Resources::Answer.new( answer: body["answer"], citations: body["citations"] || [], cost_dollars: body["costDollars"] ) end |