Class: GetFx

Inherits:
Object
  • Object
show all
Defined in:
lib/getFx.rb

Defined Under Namespace

Classes: Currencies, Parser, Validator

Class Method Summary collapse

Class Method Details

.currenciesObject



43
44
45
# File 'lib/getFx.rb', line 43

def self.currencies
  Currencies.new()
end

.run(*params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/getFx.rb', line 6

def self.run(*params)
  if params
    args = params[0]
  else
    args = []
  end

  valid = Validator.new()

  curr = "USD"
  if args[0]
    curr_f = args[0].upcase
    test = valid.currency(curr_f)
    unless test.nil?
      curr = curr_f
    end
  end

  date = "2017-02-28"
  if args[1]
    date_f = args[1]
    test = valid.date(date_f)
    unless test.nil?
      curr = curr_f
    end
  end

  amt = 1
  if args[2]
    amt = args[2]
  end

  parser = Parser.new(curr, date, amt)
  return parser.runCompute

end