Class: A2WS::ItemSearch

Inherits:
Base
  • Object
show all
Defined in:
lib/a2ws/item_search.rb

Class Method Summary collapse

Methods inherited from Base

api_key=, configure

Class Method Details

.find(keywords, search_index = :All, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/a2ws/item_search.rb', line 5

def self.find(keywords, search_index = :All, options = {})
  options.merge!({:Keywords => keywords, :SearchIndex => search_index})
  result = get('/onca/xml', :query => options)

  items = result["ItemSearchResponse"]["Items"]
  if items['Request']['IsValid'] == 'True'
    items['Item'].collect do |i|
      Item.new downcase_keys(i)
    end
  else
    raise items['Request']['Errors']['Error']['Message']
  end
end