Class: FindAI::Resources::Searches

Inherits:
Object
  • Object
show all
Defined in:
lib/find-ai/resources/searches.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Searches

Returns a new instance of Searches.



6
7
8
# File 'lib/find-ai/resources/searches.rb', line 6

def initialize(client:)
  @client = client
end

Instance Method Details

#create(params = {}, opts = {}) ⇒ FindAI::Models::SearchCreateResponse

Starts a search.

Parameters:

  • params (Hash) (defaults to: {})

    Attributes to send in this request.

  • opts (Hash|RequestOptions) (defaults to: {})

    Options to specify HTTP behaviour for this request.

Options Hash (params):

  • :max_matches (Float)

    The maximum number of results to return. optional for result_mode exact

  • :query (String)

    Search query.

  • :result_mode (String)

    The mode of the search. Valid values are 'exact' or 'best'.

  • :scope (String)

    The scope of the search. Valid values are 'people' or 'companies'.

Returns:



21
22
23
24
25
26
27
28
# File 'lib/find-ai/resources/searches.rb', line 21

def create(params = {}, opts = {})
  req = {}
  req[:method] = :post
  req[:path] = "/v1/searches"
  req[:body] = params
  req[:model] = FindAI::Models::SearchCreateResponse
  @client.request(req, opts)
end

#retrieve(id, opts = {}) ⇒ Array<FindAI::Models::SearchRetrieveResponse::SearchRetrieveResponse>

The endpoint to poll to check the latest results of a search.

Parameters:

  • id (String)

    The id returned with your initial API call.

  • opts (Hash|RequestOptions) (defaults to: {})

    Options to specify HTTP behaviour for this request.

Returns:

  • (Array<FindAI::Models::SearchRetrieveResponse::SearchRetrieveResponse>)


36
37
38
39
40
41
42
# File 'lib/find-ai/resources/searches.rb', line 36

def retrieve(id, opts = {})
  req = {}
  req[:method] = :get
  req[:path] = "/v1/searches/#{id}"
  req[:model] = FindAI::ArrayOf.new(FindAI::Models::SearchRetrieveResponse::SearchRetrieveResponse)
  @client.request(req, opts)
end