module CurrencyCloud::Actions::Find

Public Instance Methods

find(params = {}) click to toggle source
# File lib/currency_cloud/actions/find.rb, line 4
def find(params = {})
  response = client.get('find', params)
  mixin_class.new(resource, self, response)
end
first(params = {}) click to toggle source
# File lib/currency_cloud/actions/find.rb, line 9
def first(params = {})
  entities = find(params.merge(per_page: 1)) || []
  entities.first
end

Private Instance Methods

mixin_class() click to toggle source
# File lib/currency_cloud/actions/find.rb, line 16
def mixin_class
  unless CurrencyCloud.const_defined?(resource.capitalize, false)
    CurrencyCloud.const_set(resource.capitalize, Class.new(CurrencyCloud::ResourcefulCollection))
  end
  CurrencyCloud.const_get(resource.capitalize, false)
end