Class: FixerIo::Response::LatestRates

Inherits:
Object
  • Object
show all
Defined in:
lib/fixer_io/response/latest_rates.rb

Overview

Latest Rates response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ LatestRates

Create a new instance.

Parameters:

  • args (Hash)

    arguments used to create the object.

Options Hash (args):

  • :timestamp (Integer)

    the exact date and time the given rates were collected.

  • :base (String)

    the three-letter currency code of the base currency used for this request.

  • :rates (Hash)

    exchange rate data for the currencies.



28
29
30
31
32
# File 'lib/fixer_io/response/latest_rates.rb', line 28

def initialize(args)
  @timestamp = Time.at args[:timestamp].to_i
  @base = args[:base].downcase.to_sym
  @rates = Response.symbolize_hash_keys args[:rates]
end

Instance Attribute Details

#baseSymbol (readonly)

The three-letter currency code of the base currency used for this request.

Returns:

  • (Symbol)


14
15
16
# File 'lib/fixer_io/response/latest_rates.rb', line 14

def base
  @base
end

#ratesHash<Symbol, Numeric> (readonly)

Exchange rate data for the currencies you have requested.

Returns:

  • (Hash<Symbol, Numeric>)


18
19
20
# File 'lib/fixer_io/response/latest_rates.rb', line 18

def rates
  @rates
end

#timestampTime (readonly)

The exact date and time the given rates were collected.

Returns:

  • (Time)


9
10
11
# File 'lib/fixer_io/response/latest_rates.rb', line 9

def timestamp
  @timestamp
end