Class: Yahoo::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/yahoo/api.rb,
lib/yahoo/api/news.rb,
lib/yahoo/api/auction.rb,
lib/yahoo/api/version.rb,
lib/yahoo/api/shopping.rb

Defined Under Namespace

Classes: Auction, News, Shopping

Constant Summary collapse

VERSION =
"0.1.6"
@@options =
{}

Class Method Summary collapse

Class Method Details

.configure {|@@options| ... } ⇒ Object

Yields:

Raises:

  • (ArgumentError)


25
26
27
28
# File 'lib/yahoo/api.rb', line 25

def configure(&proc)
  raise ArgumentError, "Block is required." unless block_given?
  yield @@options
end

.get(method, opts = {}) ⇒ Object



37
38
39
# File 'lib/yahoo/api.rb', line 37

def get(method,opts={})
  eval "#{method}(#{opts})"
end

.merge(opts = {}) ⇒ Object



30
31
32
33
34
35
# File 'lib/yahoo/api.rb', line 30

def merge(opts={})
  opts.merge!(@@options)
  ids = opts[:appid].split(",")
  opts[:appid] = ids[rand(ids.size)]
  opts
end

.optionsObject



21
22
23
# File 'lib/yahoo/api.rb', line 21

def options
  @@options
end