Module: ForexRateAPI::Endpoints
- Included in:
- Client
- Defined in:
- lib/forexrateapi/endpoints/index.rb
Instance Method Summary collapse
- #change(start_date, end_date, base = nil, currencies = nil, date_type = nil) ⇒ Object
- #convert(from_currency = nil, to_currency = nil, amount = nil, date = nil) ⇒ Object
- #fetchHistorical(date, base = nil, currencies = nil) ⇒ Object
- #fetchLive(base = nil, currencies = nil, math = nil) ⇒ Object
- #fetchSymbols ⇒ Object
- #hourly(base = nil, currency = nil, start_date = nil, end_date = nil, math = nil, date_type = nil) ⇒ Object
- #ohlc(base = nil, currency = nil, date = nil, date_type = nil) ⇒ Object
- #timeframe(start_date, end_date, base = nil, currencies = nil) ⇒ Object
- #usage ⇒ Object
Instance Method Details
#change(start_date, end_date, base = nil, currencies = nil, date_type = nil) ⇒ Object
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/forexrateapi/endpoints/index.rb', line 68 def change(start_date, end_date, base = nil, currencies = nil, date_type = nil) = removeEmpty({ 'start_date': start_date, 'end_date': end_date, 'base': base, 'currencies': (currencies || []).join(','), 'date_type': date_type }) get('change', ) end |
#convert(from_currency = nil, to_currency = nil, amount = nil, date = nil) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/forexrateapi/endpoints/index.rb', line 48 def convert(from_currency = nil, to_currency = nil, amount = nil, date = nil) = removeEmpty({ 'from': from_currency, 'to': to_currency, 'amount': amount, 'date': date }) get('convert', ) end |
#fetchHistorical(date, base = nil, currencies = nil) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/forexrateapi/endpoints/index.rb', line 18 def fetchHistorical(date, base = nil, currencies = nil) = removeEmpty({ base: base, currencies: (currencies || []).join(',') }) get(date, ) end |
#fetchLive(base = nil, currencies = nil, math = nil) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/forexrateapi/endpoints/index.rb', line 9 def fetchLive(base = nil, currencies = nil, math = nil) = removeEmpty({ base: base, currencies: (currencies || []).join(','), math: math }) get('latest', ) end |
#fetchSymbols ⇒ Object
5 6 7 |
# File 'lib/forexrateapi/endpoints/index.rb', line 5 def fetchSymbols get('symbols') end |
#hourly(base = nil, currency = nil, start_date = nil, end_date = nil, math = nil, date_type = nil) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/forexrateapi/endpoints/index.rb', line 26 def hourly(base = nil, currency = nil, start_date = nil, end_date = nil, math = nil, date_type = nil) = removeEmpty({ base: base, currency: currency, start_date: start_date, end_date: end_date, math: math, date_type: date_type }) get('hourly', ) end |
#ohlc(base = nil, currency = nil, date = nil, date_type = nil) ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/forexrateapi/endpoints/index.rb', line 38 def ohlc(base = nil, currency = nil, date = nil, date_type = nil) = removeEmpty({ base: base, currency: currency, date: date, date_type: date_type }) get('ohlc', ) end |
#timeframe(start_date, end_date, base = nil, currencies = nil) ⇒ Object
58 59 60 61 62 63 64 65 66 |
# File 'lib/forexrateapi/endpoints/index.rb', line 58 def timeframe(start_date, end_date, base = nil, currencies = nil) = removeEmpty({ 'start_date': start_date, 'end_date': end_date, 'base': base, 'currencies': (currencies || []).join(',') }) get('timeframe', ) end |
#usage ⇒ Object
79 80 81 |
# File 'lib/forexrateapi/endpoints/index.rb', line 79 def usage get('usage') end |