Class: ACTV::SearchResults

Inherits:
Base
  • Object
show all
Defined in:
lib/actv/search_results.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

#[], attr_reader, define_attribute_method, define_predicate_method, define_uri_method, #delete, from_response, #initialize, #memoize, #method_missing, object_attr_reader, #respond_to?, #to_hash, #update, uri_attr_reader

Constructor Details

This class inherits a constructor from ACTV::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ACTV::Base

Instance Attribute Details

#actual_queryObject (readonly)

Returns the value of attribute actual_query.



8
9
10
# File 'lib/actv/search_results.rb', line 8

def actual_query
  @actual_query
end

#items_per_pageObject (readonly)

Returns the value of attribute items_per_page.



8
9
10
# File 'lib/actv/search_results.rb', line 8

def items_per_page
  @items_per_page
end

#original_queryObject (readonly)

Returns the value of attribute original_query.



8
9
10
# File 'lib/actv/search_results.rb', line 8

def original_query
  @original_query
end

#start_indexObject (readonly)

Returns the value of attribute start_index.



8
9
10
# File 'lib/actv/search_results.rb', line 8

def start_index
  @start_index
end

#total_resultsObject (readonly)

Returns the value of attribute total_results.



8
9
10
# File 'lib/actv/search_results.rb', line 8

def total_results
  @total_results
end

Instance Method Details

#facet_valuesArray<ACTV::FacetValue>

Returns:



26
27
28
29
30
# File 'lib/actv/search_results.rb', line 26

def facet_values
  @facet_values ||= Array(@attrs[:facet_values]).map do |facet_value|
    ACTV::FacetValue.new(facet_value)
  end
end

#facetsArray<ACTV::Facet>

Returns:



19
20
21
22
23
# File 'lib/actv/search_results.rb', line 19

def facets
  @facets ||= Array(@attrs[:facets]).map do |facet|
    ACTV::Facet.new(facet)
  end
end

#resultsObject Also known as: to_a



10
11
12
13
14
15
# File 'lib/actv/search_results.rb', line 10

def results
  @results ||= Array(@attrs[:results]).map do |asset|
    response = { body: asset }
    ACTV::Asset.from_response response
  end
end

#suggestionsObject



32
33
34
35
36
# File 'lib/actv/search_results.rb', line 32

def suggestions
  @suggestions ||= Array(@attrs[:suggestions]).map do |suggestion|
    ACTV::Suggestion.new(suggestion)
  end
end