class GroceryList::IGASearcher

Attributes

search_options[R]

Public Class Methods

new(search_option = :priceAsc) click to toggle source
# File lib/grocery_list/item_searchers/iga_item_searcher.rb, line 17
def initialize(search_option = :priceAsc)
  @search_options = search_option
end

Public Instance Methods

search_options=(option = :priceAsc) click to toggle source
# File lib/grocery_list/item_searchers/iga_item_searcher.rb, line 29
def search_options=(option = :priceAsc)
  raise ArgumentError, "#{option} is an invalid option" unless @@valid_options.include? option
  @search_options = option
end

Private Instance Methods

encoded_options() click to toggle source
# File lib/grocery_list/item_searchers/iga_item_searcher.rb, line 39
def encoded_options
  search_options ? "&sort=#{search_options.to_s}" : ""
end
url(item_name) click to toggle source
# File lib/grocery_list/item_searchers/iga_item_searcher.rb, line 35
def url(item_name)
  "#{@@search_url}#{url_encode(item_name)}#{encoded_options}"
end