Module: Juhe::Exchange

Extended by:
Exchange
Included in:
Exchange
Defined in:
lib/juhe/exchange.rb

Constant Summary collapse

URL =
'http://op.juhe.cn/onebox/exchange/'

Instance Method Summary collapse

Instance Method Details

#currency(key, from, to) ⇒ Object

实时汇率查询换算 www.juhe.cn/docs/api/id/80/aid/205



7
8
9
10
# File 'lib/juhe/exchange.rb', line 7

def currency(key, from, to)
  res = RestClient.get("#{URL}/currency", params: {key: key, from: from, to: to})
  JSON.parse res.body
end

#list(key) ⇒ Object



19
20
21
22
# File 'lib/juhe/exchange.rb', line 19

def list(key)
  res = RestClient.get("#{URL}/list", params: {key: key})
  JSON.parse res.body
end

#query(key) ⇒ Object

常用汇率查询 www.juhe.cn/docs/api/id/80



13
14
15
16
# File 'lib/juhe/exchange.rb', line 13

def query(key)
  res = RestClient.get("#{URL}/query", params: {key: key})
  JSON.parse res.body
end