Class: CurrencyCloud::Rate

Inherits:
Object
  • Object
show all
Includes:
Resource
Defined in:
lib/currency_cloud/rate.rb

Instance Attribute Summary

Attributes included from Resource

#changed_attributes

Class Method Summary collapse

Methods included from Resource

included, #initialize, #inspect

Class Method Details

.detailed(params) ⇒ Object



17
18
19
# File 'lib/currency_cloud/rate.rb', line 17

def self.detailed(params)
  new(client.get('detailed', params))
end

.find(params) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/currency_cloud/rate.rb', line 7

def self.find(params)
  response = client.get('find', params)

  rates = response['rates'].map do |currency_pair, (bid, offer)|
    new(currency_pair: currency_pair, bid: bid, offer: offer)
  end

  Rates.new(currencies: rates, unavailable: response['unavailable'])
end