Class: Inttegro::Search::Request
- Inherits:
-
T::Struct
- Object
- T::Struct
- Inttegro::Search::Request
- Extended by:
- T::Sig
- Defined in:
- lib/inttegro/search/request.rb
Overview
A resource-local search request. Send text, at least one filter, or both. Field names are
unqualified and depend on the endpoint. The application and resource type are derived by
Inttegro and cannot be supplied by the caller. To continue a search, repeat the same request
and add the returned next_cursor.
This generated model is immutable. Construct it with .new, or decode a string-keyed API
payload with .from_hash. #serialize produces a string-keyed hash using the original wire
field names and serialized enum values.
Instance Attribute Summary collapse
-
#cursor ⇒ String?
readonly
Opaque continuation value returned as
next_cursorby the preceding page. -
#facets ⇒ Array<Inttegro::Search::Facet>?
readonly
Value of the
facetsfield in the Inttegro API payload. -
#filters ⇒ Array<Inttegro::Search::EqualsFilter, Inttegro::Search::InFilter>?
readonly
Value of the
filtersfield in the Inttegro API payload. -
#page_size ⇒ Integer?
readonly
Value of the
page_sizefield in the Inttegro API payload. -
#sort ⇒ Inttegro::Search::Sort?
readonly
Value of the
sortfield in the Inttegro API payload. -
#text ⇒ String?
readonly
Words, identifiers, or names to search for.
Class Method Summary collapse
Instance Attribute Details
#cursor ⇒ String? (readonly)
Opaque continuation value returned as next_cursor by the preceding page.
Optional in the API payload; omitted values default to nil. Wire name: cursor.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/inttegro/search/request.rb', line 60 class Request < T::Struct const :text, T.nilable(String), default: nil const :filters, T.nilable(T::Array[T.any(Inttegro::Search::EqualsFilter, Inttegro::Search::InFilter)]), default: nil const :facets, T.nilable(T::Array[Inttegro::Search::Facet]), default: nil const :sort, T.nilable(Inttegro::Search::Sort), default: nil const :page_size, T.nilable(Integer), default: nil const :cursor, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (filters_value = data["filters"]).is_a?(Array) data["filters"] = filters_value.map do |item| next item unless item.is_a?(Hash) case item["operator"] when "eq" Inttegro::Search::EqualsFilter.from_hash(item) when "in" Inttegro::Search::InFilter.from_hash(item) else item end end end super(data, strict) end end |
#facets ⇒ Array<Inttegro::Search::Facet>? (readonly)
Value of the facets field in the Inttegro API payload.
Optional in the API payload; omitted values default to nil. Wire name: facets.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/inttegro/search/request.rb', line 60 class Request < T::Struct const :text, T.nilable(String), default: nil const :filters, T.nilable(T::Array[T.any(Inttegro::Search::EqualsFilter, Inttegro::Search::InFilter)]), default: nil const :facets, T.nilable(T::Array[Inttegro::Search::Facet]), default: nil const :sort, T.nilable(Inttegro::Search::Sort), default: nil const :page_size, T.nilable(Integer), default: nil const :cursor, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (filters_value = data["filters"]).is_a?(Array) data["filters"] = filters_value.map do |item| next item unless item.is_a?(Hash) case item["operator"] when "eq" Inttegro::Search::EqualsFilter.from_hash(item) when "in" Inttegro::Search::InFilter.from_hash(item) else item end end end super(data, strict) end end |
#filters ⇒ Array<Inttegro::Search::EqualsFilter, Inttegro::Search::InFilter>? (readonly)
Value of the filters field in the Inttegro API payload.
Optional in the API payload; omitted values default to nil. Wire name: filters.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/inttegro/search/request.rb', line 60 class Request < T::Struct const :text, T.nilable(String), default: nil const :filters, T.nilable(T::Array[T.any(Inttegro::Search::EqualsFilter, Inttegro::Search::InFilter)]), default: nil const :facets, T.nilable(T::Array[Inttegro::Search::Facet]), default: nil const :sort, T.nilable(Inttegro::Search::Sort), default: nil const :page_size, T.nilable(Integer), default: nil const :cursor, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (filters_value = data["filters"]).is_a?(Array) data["filters"] = filters_value.map do |item| next item unless item.is_a?(Hash) case item["operator"] when "eq" Inttegro::Search::EqualsFilter.from_hash(item) when "in" Inttegro::Search::InFilter.from_hash(item) else item end end end super(data, strict) end end |
#page_size ⇒ Integer? (readonly)
Value of the page_size field in the Inttegro API payload.
Optional in the API payload; omitted values default to nil. Wire name: page_size.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/inttegro/search/request.rb', line 60 class Request < T::Struct const :text, T.nilable(String), default: nil const :filters, T.nilable(T::Array[T.any(Inttegro::Search::EqualsFilter, Inttegro::Search::InFilter)]), default: nil const :facets, T.nilable(T::Array[Inttegro::Search::Facet]), default: nil const :sort, T.nilable(Inttegro::Search::Sort), default: nil const :page_size, T.nilable(Integer), default: nil const :cursor, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (filters_value = data["filters"]).is_a?(Array) data["filters"] = filters_value.map do |item| next item unless item.is_a?(Hash) case item["operator"] when "eq" Inttegro::Search::EqualsFilter.from_hash(item) when "in" Inttegro::Search::InFilter.from_hash(item) else item end end end super(data, strict) end end |
#sort ⇒ Inttegro::Search::Sort? (readonly)
Value of the sort field in the Inttegro API payload.
Optional in the API payload; omitted values default to nil. Wire name: sort.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/inttegro/search/request.rb', line 60 class Request < T::Struct const :text, T.nilable(String), default: nil const :filters, T.nilable(T::Array[T.any(Inttegro::Search::EqualsFilter, Inttegro::Search::InFilter)]), default: nil const :facets, T.nilable(T::Array[Inttegro::Search::Facet]), default: nil const :sort, T.nilable(Inttegro::Search::Sort), default: nil const :page_size, T.nilable(Integer), default: nil const :cursor, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (filters_value = data["filters"]).is_a?(Array) data["filters"] = filters_value.map do |item| next item unless item.is_a?(Hash) case item["operator"] when "eq" Inttegro::Search::EqualsFilter.from_hash(item) when "in" Inttegro::Search::InFilter.from_hash(item) else item end end end super(data, strict) end end |
#text ⇒ String? (readonly)
Words, identifiers, or names to search for.
Optional in the API payload; omitted values default to nil. Wire name: text.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/inttegro/search/request.rb', line 60 class Request < T::Struct const :text, T.nilable(String), default: nil const :filters, T.nilable(T::Array[T.any(Inttegro::Search::EqualsFilter, Inttegro::Search::InFilter)]), default: nil const :facets, T.nilable(T::Array[Inttegro::Search::Facet]), default: nil const :sort, T.nilable(Inttegro::Search::Sort), default: nil const :page_size, T.nilable(Integer), default: nil const :cursor, T.nilable(String), default: nil extend T::Sig sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) } def self.from_hash(hash, strict = false) data = hash.dup if (filters_value = data["filters"]).is_a?(Array) data["filters"] = filters_value.map do |item| next item unless item.is_a?(Hash) case item["operator"] when "eq" Inttegro::Search::EqualsFilter.from_hash(item) when "in" Inttegro::Search::InFilter.from_hash(item) else item end end end super(data, strict) end end |
Class Method Details
.from_hash(hash, strict = false) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/inttegro/search/request.rb', line 71 def self.from_hash(hash, strict = false) data = hash.dup if (filters_value = data["filters"]).is_a?(Array) data["filters"] = filters_value.map do |item| next item unless item.is_a?(Hash) case item["operator"] when "eq" Inttegro::Search::EqualsFilter.from_hash(item) when "in" Inttegro::Search::InFilter.from_hash(item) else item end end end super(data, strict) end |