Module: YaCan::YahooAPI

Included in:
YaCan
Defined in:
lib/yacan/yahoo_api.rb

Defined Under Namespace

Classes: AppIDUnconfiguredError

Constant Summary collapse

@@host =
'jlp.yahooapis.jp'
@@appid =
nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.appidObject



6
7
8
# File 'lib/yacan/yahoo_api.rb', line 6

def appid
  return @@appid || (raise AppIDUnconfiguredError)
end

.appid=(appid) ⇒ Object



10
11
12
# File 'lib/yacan/yahoo_api.rb', line 10

def appid=(appid)
  @@appid = appid
end

.request(path, params = {}) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/yacan/yahoo_api.rb', line 14

def request(path, params={})
  params['appid'] = appid
  Net::HTTP::Proxy(YaCan.proxy_host, YaCan.proxy_port).start(@@host){ |http|
    res = http.post(path, params.map{ |k,v| "#{URI.encode(k)}=#{URI.encode(v)}"}.join('&'))
    res.body
  }
end

Instance Method Details

#analyze(*args) ⇒ Object

Raises:

  • (NotImplementedError)


22
23
24
# File 'lib/yacan/yahoo_api.rb', line 22

def analyze(*args)
  raise NotImplementedError
end