class Unleashed::CurrencyResource

Resource for the Currencies API The Currencies resource allows Currencies to be listed, viewed. @see apidocs.unleashedsoftware.com/Sandbox

Public Instance Methods

all() click to toggle source

List all currencies /Currencies - also returns the first 200 currencies because page number 1 is the default.

@return [Array<Unleashed::Currency>] List all currencies.

# 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() click to toggle source

Get a first currency in all

@return [Unleashed::Currency]

# File lib/unleashed/resources/currency_resource.rb, line 24
def first
  all.first
end
last() click to toggle source

Get a last currency in all

@return [Unleashed::Currency]

# File lib/unleashed/resources/currency_resource.rb, line 31
def last
  all.last
end
model() click to toggle source
# File lib/unleashed/resources/currency_resource.rb, line 6
def model
  Unleashed::Currency
end