Class: Ruboty::Handlers::Fx
- Inherits:
-
Base
- Object
- Base
- Ruboty::Handlers::Fx
- Defined in:
- lib/ruboty/handlers/fx.rb
Constant Summary collapse
- YFX_URL =
'http://info.finance.yahoo.co.jp/fx/async/getRate/'
Instance Method Summary collapse
Instance Method Details
#fx(message = {}) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/ruboty/handlers/fx.rb', line 11 def fx( = {}) pair = [:pair].gsub('/','').gsub(/\s/,'') .reply(rate_to_s(get_json[pair], pair)) rescue .reply('Unknow error.') end |
#list(m = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/ruboty/handlers/fx.rb', line 18 def list(m = {}) str = get_json.map do |pair, state| rate_to_s(state, pair) end.join("\n") m.reply("```\n#{str}\n```") rescue m.reply('Unknow error.') end |