Class: WalmartOpen::SearchResults

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ SearchResults

Returns a new instance of SearchResults.



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/walmart_open/search_results.rb', line 11

def initialize(response)
  @query = response["query"]
  @total = response["totalResults"]
  @start = response["start"]
  # TODO: set the page!
  # @page = ...

  @items = []

  response["items"].each do |item|
    @items << Item.new(item)
  end
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



5
6
7
# File 'lib/walmart_open/search_results.rb', line 5

def items
  @items
end

#pageObject (readonly)

Returns the value of attribute page.



5
6
7
# File 'lib/walmart_open/search_results.rb', line 5

def page
  @page
end

#queryObject (readonly)

Returns the value of attribute query.



5
6
7
# File 'lib/walmart_open/search_results.rb', line 5

def query
  @query
end

#startObject (readonly)

Returns the value of attribute start.



5
6
7
# File 'lib/walmart_open/search_results.rb', line 5

def start
  @start
end

#totalObject (readonly)

Returns the value of attribute total.



5
6
7
# File 'lib/walmart_open/search_results.rb', line 5

def total
  @total
end