Class: Rafflesia::CombinedSearchData
- Inherits:
-
Types::BaseModel
- Object
- Types::BaseModel
- Rafflesia::CombinedSearchData
- Defined in:
- lib/rafflesia/search/combined_search_data.rb
Constant Summary collapse
- HASH_ATTRS =
{ backend: :backend, domain: :domain, failed_source_count: :failed_source_count, hit_count: :hit_count, hits: :hits, max_hits: :max_hits, partial: :partial, promotion_candidates: :promotion_candidates, raw_hit_count: :raw_hit_count, requested_source_count: :requested_source_count, sources: :sources, succeeded_source_count: :succeeded_source_count }.freeze
Instance Attribute Summary collapse
-
#backend ⇒ Object
Returns the value of attribute backend.
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#failed_source_count ⇒ Object
Returns the value of attribute failed_source_count.
-
#hit_count ⇒ Object
Returns the value of attribute hit_count.
-
#hits ⇒ Object
Returns the value of attribute hits.
-
#max_hits ⇒ Object
Returns the value of attribute max_hits.
-
#partial ⇒ Object
Returns the value of attribute partial.
-
#promotion_candidates ⇒ Object
Returns the value of attribute promotion_candidates.
-
#raw_hit_count ⇒ Object
Returns the value of attribute raw_hit_count.
-
#requested_source_count ⇒ Object
Returns the value of attribute requested_source_count.
-
#sources ⇒ Object
Returns the value of attribute sources.
-
#succeeded_source_count ⇒ Object
Returns the value of attribute succeeded_source_count.
Instance Method Summary collapse
-
#initialize(json) ⇒ CombinedSearchData
constructor
A new instance of CombinedSearchData.
Constructor Details
#initialize(json) ⇒ CombinedSearchData
Returns a new instance of CombinedSearchData.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/rafflesia/search/combined_search_data.rb', line 37 def initialize(json) super() hash = self.class.normalize(json) @backend = hash[:backend] @domain = hash[:domain] @failed_source_count = hash[:failed_source_count] @hit_count = hash[:hit_count] @hits = (hash[:hits] || []).map { |item| item ? Rafflesia::CombinedSearchHit.new(item) : nil } @max_hits = hash[:max_hits] @partial = hash[:partial] @promotion_candidates = (hash[:promotion_candidates] || []).map { |item| item ? Rafflesia::CombinedSearchPromotionCandidate.new(item) : nil } @raw_hit_count = hash[:raw_hit_count] @requested_source_count = hash[:requested_source_count] @sources = (hash[:sources] || []).map { |item| item ? Rafflesia::CombinedSearchSourceStatus.new(item) : nil } @succeeded_source_count = hash[:succeeded_source_count] end |
Instance Attribute Details
#backend ⇒ Object
Returns the value of attribute backend.
23 24 25 |
# File 'lib/rafflesia/search/combined_search_data.rb', line 23 def backend @backend end |
#domain ⇒ Object
Returns the value of attribute domain.
23 24 25 |
# File 'lib/rafflesia/search/combined_search_data.rb', line 23 def domain @domain end |
#failed_source_count ⇒ Object
Returns the value of attribute failed_source_count.
23 24 25 |
# File 'lib/rafflesia/search/combined_search_data.rb', line 23 def failed_source_count @failed_source_count end |
#hit_count ⇒ Object
Returns the value of attribute hit_count.
23 24 25 |
# File 'lib/rafflesia/search/combined_search_data.rb', line 23 def hit_count @hit_count end |
#hits ⇒ Object
Returns the value of attribute hits.
23 24 25 |
# File 'lib/rafflesia/search/combined_search_data.rb', line 23 def hits @hits end |
#max_hits ⇒ Object
Returns the value of attribute max_hits.
23 24 25 |
# File 'lib/rafflesia/search/combined_search_data.rb', line 23 def max_hits @max_hits end |
#partial ⇒ Object
Returns the value of attribute partial.
23 24 25 |
# File 'lib/rafflesia/search/combined_search_data.rb', line 23 def partial @partial end |
#promotion_candidates ⇒ Object
Returns the value of attribute promotion_candidates.
23 24 25 |
# File 'lib/rafflesia/search/combined_search_data.rb', line 23 def promotion_candidates @promotion_candidates end |
#raw_hit_count ⇒ Object
Returns the value of attribute raw_hit_count.
23 24 25 |
# File 'lib/rafflesia/search/combined_search_data.rb', line 23 def raw_hit_count @raw_hit_count end |
#requested_source_count ⇒ Object
Returns the value of attribute requested_source_count.
23 24 25 |
# File 'lib/rafflesia/search/combined_search_data.rb', line 23 def requested_source_count @requested_source_count end |
#sources ⇒ Object
Returns the value of attribute sources.
23 24 25 |
# File 'lib/rafflesia/search/combined_search_data.rb', line 23 def sources @sources end |
#succeeded_source_count ⇒ Object
Returns the value of attribute succeeded_source_count.
23 24 25 |
# File 'lib/rafflesia/search/combined_search_data.rb', line 23 def succeeded_source_count @succeeded_source_count end |