Class: Exa::Services::Websets::GetSearch

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

Instance Method Summary collapse

Constructor Details

#initialize(connection, webset_id:, id:) ⇒ GetSearch



7
8
9
10
11
# File 'lib/exa/services/websets/get_search.rb', line 7

def initialize(connection, webset_id:, id:)
  @connection = connection
  @webset_id = webset_id
  @id = id
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/exa/services/websets/get_search.rb', line 13

def call
  response = @connection.get(
    "/websets/v0/websets/#{@webset_id}/searches/#{@id}"
  )
  body = response.body

  Resources::WebsetSearch.new(
    id: body["id"],
    object: body["object"],
    status: body["status"],
    webset_id: body["websetId"],
    query: body["query"],
    entity: body["entity"],
    criteria: body["criteria"],
    count: body["count"],
    behavior: body["behavior"],
    exclude: body["exclude"],
    scope: body["scope"],
    progress: body["progress"],
    recall: body["recall"],
    metadata: body["metadata"],
    canceled_at: body["canceledAt"],
    canceled_reason: body["canceledReason"],
    created_at: body["createdAt"],
    updated_at: body["updatedAt"]
  )
end