Module: ForexRateAPI::Endpoints
- Included in:
- Client
- Defined in:
- lib/forexrateapi/endpoints/index.rb
Instance Method Summary collapse
- #change(start_date, end_date, base = '', currencies = 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) ⇒ Object
- #fetchSymbols ⇒ Object
- #timeframe(start_date, end_date, base = nil, currencies = nil) ⇒ Object
Instance Method Details
#change(start_date, end_date, base = '', currencies = nil) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/forexrateapi/endpoints/index.rb', line 45 def change(start_date, end_date, base = '', currencies = nil) = removeEmpty({ 'start_date': start_date, 'end_date': end_date, 'base': base, 'currencies': (currencies || []).join(',') }) get('change', ) end |
#convert(from_currency = nil, to_currency = nil, amount = nil, date = nil) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/forexrateapi/endpoints/index.rb', line 25 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
17 18 19 20 21 22 23 |
# File 'lib/forexrateapi/endpoints/index.rb', line 17 def fetchHistorical(date, base = nil, currencies = nil) = removeEmpty({ base: base, currencies: (currencies || []).join(',') }) get(date, ) end |
#fetchLive(base = nil, currencies = nil) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/forexrateapi/endpoints/index.rb', line 9 def fetchLive(base = nil, currencies = nil) = removeEmpty({ base: base, currencies: (currencies || []).join(',') }) get('latest', ) end |
#fetchSymbols ⇒ Object
5 6 7 |
# File 'lib/forexrateapi/endpoints/index.rb', line 5 def fetchSymbols get('symbols') end |
#timeframe(start_date, end_date, base = nil, currencies = nil) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/forexrateapi/endpoints/index.rb', line 35 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 |