Class: Mindee::V2::Parsing::Search::BaseSearchResponse
- Inherits:
-
CommonResponse
- Object
- CommonResponse
- Mindee::V2::Parsing::Search::BaseSearchResponse
- Defined in:
- lib/mindee/v2/parsing/search/base_search_response.rb
Overview
Base class for search responses.
Direct Known Subclasses
Search::Models::ModelSearchResponse, Search::RAGDocuments::RAGDocumentSearchResponse
Instance Attribute Summary collapse
-
#pagination ⇒ Mindee::V2::Parsing::Search::PaginationMetadata
readonly
Pagination metadata.
Attributes inherited from CommonResponse
Instance Method Summary collapse
-
#body_lines ⇒ Array<String>
Lines composing the response-specific body (header + items).
-
#initialize(http_response) ⇒ BaseSearchResponse
constructor
A new instance of BaseSearchResponse.
-
#pagination_metadata ⇒ Mindee::V2::Parsing::Search::PaginationMetadata
deprecated
Deprecated.
Use #pagination instead.
-
#to_s ⇒ String
String representation of the search response.
Constructor Details
#initialize(http_response) ⇒ BaseSearchResponse
Returns a new instance of BaseSearchResponse.
14 15 16 17 18 |
# File 'lib/mindee/v2/parsing/search/base_search_response.rb', line 14 def initialize(http_response) super @pagination = PaginationMetadata.new(http_response['pagination']) end |
Instance Attribute Details
#pagination ⇒ Mindee::V2::Parsing::Search::PaginationMetadata (readonly)
Pagination metadata.
11 12 13 |
# File 'lib/mindee/v2/parsing/search/base_search_response.rb', line 11 def pagination @pagination end |
Instance Method Details
#body_lines ⇒ Array<String>
Lines composing the response-specific body (header + items).
22 23 24 |
# File 'lib/mindee/v2/parsing/search/base_search_response.rb', line 22 def body_lines raise NotImplementedError, 'body_lines must be implemented in subclasses' end |
#pagination_metadata ⇒ Mindee::V2::Parsing::Search::PaginationMetadata
Deprecated.
Use #pagination instead.
Pagination metadata (Obsolete).
29 30 31 |
# File 'lib/mindee/v2/parsing/search/base_search_response.rb', line 29 def pagination end |
#to_s ⇒ String
String representation of the search response.
35 36 37 38 39 40 41 42 |
# File 'lib/mindee/v2/parsing/search/base_search_response.rb', line 35 def to_s lines = body_lines lines.push('Pagination Metadata') lines.push('###################') lines.push(@pagination.to_s) lines.join("\n") end |