Class: Exa::Services::ResearchGet

Inherits:
Object
  • Object
show all
Defined in:
lib/exa/services/research_get.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection, research_id:, **params) ⇒ ResearchGet

Returns a new instance of ResearchGet.



4
5
6
7
8
# File 'lib/exa/services/research_get.rb', line 4

def initialize(connection, research_id:, **params)
  @connection = connection
  @research_id = research_id
  @params = params
end

Instance Method Details

#callObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/exa/services/research_get.rb', line 10

def call
  response = @connection.get("/research/v1/#{@research_id}", @params)
  body = response.body

  Resources::ResearchTask.new(
    research_id: body["researchId"],
    created_at: body["createdAt"],
    status: body["status"],
    instructions: body["instructions"],
    model: body["model"],
    output_schema: body["outputSchema"],
    events: body["events"],
    output: body["output"],
    cost_dollars: body["costDollars"],
    finished_at: body["finishedAt"],
    error: body["error"]
  )
end