Class: Exa::Resources::SearchResult
- Inherits:
-
Struct
- Object
- Struct
- Exa::Resources::SearchResult
- Defined in:
- lib/exa/resources/search_result.rb
Overview
Represents a search response from the Exa API
This class wraps the JSON response from the /search endpoint and provides a Ruby-friendly interface for accessing search results and metadata.
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#cost_dollars ⇒ Object
Returns the value of attribute cost_dollars.
-
#request_id ⇒ Object
Returns the value of attribute request_id.
-
#resolved_search_type ⇒ Object
Returns the value of attribute resolved_search_type.
-
#results ⇒ Object
Returns the value of attribute results.
-
#search_type ⇒ Object
Returns the value of attribute search_type.
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #first ⇒ Object
-
#initialize(results:, request_id: nil, resolved_search_type: nil, search_type: nil, context: nil, cost_dollars: nil) ⇒ SearchResult
constructor
A new instance of SearchResult.
Constructor Details
#initialize(results:, request_id: nil, resolved_search_type: nil, search_type: nil, context: nil, cost_dollars: nil) ⇒ SearchResult
Returns a new instance of SearchResult.
16 17 18 19 |
# File 'lib/exa/resources/search_result.rb', line 16 def initialize(results:, request_id: nil, resolved_search_type: nil, search_type: nil, context: nil, cost_dollars: nil) super freeze end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context
7 8 9 |
# File 'lib/exa/resources/search_result.rb', line 7 def context @context end |
#cost_dollars ⇒ Object
Returns the value of attribute cost_dollars
7 8 9 |
# File 'lib/exa/resources/search_result.rb', line 7 def cost_dollars @cost_dollars end |
#request_id ⇒ Object
Returns the value of attribute request_id
7 8 9 |
# File 'lib/exa/resources/search_result.rb', line 7 def request_id @request_id end |
#resolved_search_type ⇒ Object
Returns the value of attribute resolved_search_type
7 8 9 |
# File 'lib/exa/resources/search_result.rb', line 7 def resolved_search_type @resolved_search_type end |
#results ⇒ Object
Returns the value of attribute results
7 8 9 |
# File 'lib/exa/resources/search_result.rb', line 7 def results @results end |
#search_type ⇒ Object
Returns the value of attribute search_type
7 8 9 |
# File 'lib/exa/resources/search_result.rb', line 7 def search_type @search_type end |
Instance Method Details
#empty? ⇒ Boolean
21 22 23 |
# File 'lib/exa/resources/search_result.rb', line 21 def empty? results.empty? end |
#first ⇒ Object
25 26 27 |
# File 'lib/exa/resources/search_result.rb', line 25 def first results.first end |