Class: FixerIo::Response::HistoricalRates
- Inherits:
-
Object
- Object
- FixerIo::Response::HistoricalRates
- Defined in:
- lib/fixer_io/response/historical_rates.rb
Overview
Historical Rates response.
Instance Attribute Summary collapse
-
#base ⇒ Symbol
readonly
The three-letter currency code of the base currency used for this request.
-
#date ⇒ Date
readonly
The date for which historical rates were requested.
-
#historical ⇒ Boolean
readonly
Returns
true
if a request for historical exchange rates was made. -
#rates ⇒ Hash<Symbol, Numeric>
readonly
Exchange rate data for the currencies you have requested.
-
#timestamp ⇒ Time
readonly
The exact date and time the given rates were collected.
Instance Method Summary collapse
-
#initialize(args) ⇒ HistoricalRates
constructor
Create a new instance.
Constructor Details
#initialize(args) ⇒ HistoricalRates
Create a new instance.
41 42 43 44 45 46 47 |
# File 'lib/fixer_io/response/historical_rates.rb', line 41 def initialize(args) @timestamp = Time.at args[:timestamp].to_i @base = args[:base].downcase.to_sym @rates = Response.symbolize_hash_keys args[:rates] @date = Date.parse args[:date] @historical = args[:historical] end |
Instance Attribute Details
#base ⇒ Symbol (readonly)
The three-letter currency code of the base currency used for this request.
15 16 17 |
# File 'lib/fixer_io/response/historical_rates.rb', line 15 def base @base end |
#date ⇒ Date (readonly)
The date for which historical rates were requested.
27 28 29 |
# File 'lib/fixer_io/response/historical_rates.rb', line 27 def date @date end |
#historical ⇒ Boolean (readonly)
Returns true
if a request for historical exchange rates was made.
23 24 25 |
# File 'lib/fixer_io/response/historical_rates.rb', line 23 def historical @historical end |
#rates ⇒ Hash<Symbol, Numeric> (readonly)
Exchange rate data for the currencies you have requested.
19 20 21 |
# File 'lib/fixer_io/response/historical_rates.rb', line 19 def rates @rates end |
#timestamp ⇒ Time (readonly)
The exact date and time the given rates were collected.
10 11 12 |
# File 'lib/fixer_io/response/historical_rates.rb', line 10 def @timestamp end |