Class: ECBExchangeRatesApi::Options

Inherits:
Object
  • Object
show all
Includes:
SharedMethods
Defined in:
lib/ecb_exchange_rates_api/options.rb

Overview

Presents API params

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SharedMethods

included

Constructor Details

#initializeOptions

Returns a new instance of Options.



15
16
17
18
19
20
21
# File 'lib/ecb_exchange_rates_api/options.rb', line 15

def initialize
  @start_at      = nil
  @end_at        = nil
  @specific_date = nil
  @base          = nil
  @symbols       = []
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



10
11
12
# File 'lib/ecb_exchange_rates_api/options.rb', line 10

def base
  @base
end

#end_atObject (readonly)

Returns the value of attribute end_at.



10
11
12
# File 'lib/ecb_exchange_rates_api/options.rb', line 10

def end_at
  @end_at
end

#specific_dateObject (readonly)

Returns the value of attribute specific_date.



10
11
12
# File 'lib/ecb_exchange_rates_api/options.rb', line 10

def specific_date
  @specific_date
end

#start_atObject (readonly)

Returns the value of attribute start_at.



10
11
12
# File 'lib/ecb_exchange_rates_api/options.rb', line 10

def start_at
  @start_at
end

#symbolsObject (readonly)

Returns the value of attribute symbols.



10
11
12
# File 'lib/ecb_exchange_rates_api/options.rb', line 10

def symbols
  @symbols
end

Instance Method Details

#append_symbol(code) ⇒ Object



23
24
25
# File 'lib/ecb_exchange_rates_api/options.rb', line 23

def append_symbol(code)
  @symbols << validated_currency_code(code)
end

#to_paramsObject



27
28
29
# File 'lib/ecb_exchange_rates_api/options.rb', line 27

def to_params
  options_params.reject { |_, val| val.nil? || val.empty? }
end