Class: Exa::Services::Websets::CreateSearch
- Inherits:
-
Object
- Object
- Exa::Services::Websets::CreateSearch
- Defined in:
- lib/exa/services/websets/create_search.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(connection, webset_id:, **params) ⇒ CreateSearch
constructor
A new instance of CreateSearch.
Constructor Details
#initialize(connection, webset_id:, **params) ⇒ CreateSearch
Returns a new instance of CreateSearch.
9 10 11 12 13 |
# File 'lib/exa/services/websets/create_search.rb', line 9 def initialize(connection, webset_id:, **params) @connection = connection @webset_id = webset_id @params = params end |
Instance Method Details
#call ⇒ Object
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 40 41 42 43 44 |
# File 'lib/exa/services/websets/create_search.rb', line 15 def call CreateSearchValidator.validate!(@params) response = @connection.post( "/websets/v0/websets/#{@webset_id}/searches", @params ) 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 |