Class: GroceryList::IGASearcher

Inherits:
AbstractSearcher show all
Defined in:
lib/grocery_list/item_searchers/iga_item_searcher.rb

Constant Summary collapse

@@search_url =
"http://magasin.iga.net/Search/BasicSearch.aspx?Search="
@@valid_options =
[
  :priceDesc,
  :priceAsc,
  :DisplayNameDesc,
  :DisplayNameAsc,
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(search_option = :priceAsc) ⇒ IGASearcher

Returns a new instance of IGASearcher.



17
18
19
# File 'lib/grocery_list/item_searchers/iga_item_searcher.rb', line 17

def initialize(search_option = :priceAsc)
  @search_options = search_option
end

Instance Attribute Details

#search_optionsObject

Returns the value of attribute search_options.



6
7
8
# File 'lib/grocery_list/item_searchers/iga_item_searcher.rb', line 6

def search_options
  @search_options
end

Instance Method Details

#search(item) ⇒ Object

Raises:

  • (ArgumentError)


21
22
23
24
# File 'lib/grocery_list/item_searchers/iga_item_searcher.rb', line 21

def search(item)
  raise ArgumentError, "#{item} isn't an Item" unless item.is_a? Item
  Launchy.open url(item.item_name)
end