Module: ForexRateAPI::Endpoints

Included in:
Client
Defined in:
lib/forexrateapi/endpoints/index.rb

Instance Method Summary collapse

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)
  options = removeEmpty({
      'start_date': start_date,
      'end_date': end_date,
      'base': base,
      'currencies': (currencies || []).join(','),
      'date_type': date_type
  })
  get('change', options)
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)
  options = removeEmpty({
      'from': from_currency,
      'to': to_currency,
      'amount': amount,
      'date': date
  })
  get('convert', options)
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)
  options = removeEmpty({
    base: base,
    currencies: (currencies || []).join(',')
  })
  get(date, options)
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)
  options = removeEmpty({
    base: base,
    currencies: (currencies || []).join(','),
    math: math
  })
  get('latest', options)
end

#fetchSymbolsObject



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)
  options = removeEmpty({
    base: base,
    currency: currency,
    start_date: start_date,
    end_date: end_date,
    math: math,
    date_type: date_type
  })
  get('hourly', options)
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)
  options = removeEmpty({
    base: base,
    currency: currency,
    date: date,
    date_type: date_type
  })
  get('ohlc', options)
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)
  options = removeEmpty({
      'start_date': start_date,
      'end_date': end_date,
      'base': base,
      'currencies': (currencies || []).join(',')
  })
  get('timeframe', options)
end

#usageObject



79
80
81
# File 'lib/forexrateapi/endpoints/index.rb', line 79

def usage
  get('usage')
end