Module: Rwsc::Searcher

Included in:
BooksTotalSearch, ItemSearch
Defined in:
lib/rwsc/searcher.rb

Instance Method Summary collapse

Instance Method Details

#find(opts) ⇒ Object

find item .



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rwsc/searcher.rb', line 8

def find(opts)
  if opts.nil?
    raise ArgError.new('no options')
  end

  self.must_items.each do |item|
    unless opts.include? item
      raise ArgError.new("#{item.to_s} needed")
    end
  end

  opts.each do |key, val|
    unless accept_items.include? key
      raise ArgError.new("#{key.to_s} is invalid option")
    end
  end

  self.rws_call(opts.merge(self.add_rwsc_opts))
end

#rws_call(opts) ⇒ Object

Rakuten web service call function



29
30
31
# File 'lib/rwsc/searcher.rb', line 29

def rws_call(opts)
  Rwsc::Web::WebClient.get_result(opts)
end