Class: Unleashed::CurrencyResource
- Inherits:
-
BaseResource
- Object
- BaseResource
- Unleashed::CurrencyResource
- Defined in:
- lib/unleashed/resources/currency_resource.rb
Overview
Resource for the Currencies API The Currencies resource allows Currencies to be listed, viewed.
Instance Method Summary collapse
-
#all ⇒ Array<Unleashed::Currency>
List all currencies /Currencies - also returns the first 200 currencies because page number 1 is the default.
-
#first ⇒ Unleashed::Currency
Get a first currency in all.
-
#last ⇒ Unleashed::Currency
Get a last currency in all.
- #model ⇒ Object
Methods inherited from BaseResource
#initialize, #method_missing, #respond_to?
Constructor Details
This class inherits a constructor from Unleashed::BaseResource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Unleashed::BaseResource
Instance Method Details
#all ⇒ Array<Unleashed::Currency>
List all currencies /Currencies - also returns the first 200 currencies because page number 1 is the default.
14 15 16 17 18 19 |
# File 'lib/unleashed/resources/currency_resource.rb', line 14 def all endpoint = 'Currencies' response = JSON.parse(@client.get(endpoint).body) currencies = response.key?('Items') ? response['Items'] : [] currencies.map { |attributes| Unleashed::Currency.new(@client, attributes) } end |
#first ⇒ Unleashed::Currency
Get a first currency in all
24 25 26 |
# File 'lib/unleashed/resources/currency_resource.rb', line 24 def first all.first end |
#last ⇒ Unleashed::Currency
Get a last currency in all
31 32 33 |
# File 'lib/unleashed/resources/currency_resource.rb', line 31 def last all.last end |