Sha256: 17c847bebb447dead143b61d94e7bfcdb5b43930ae39d1a0aa80332088505c37

Contents?: true

Size: 608 Bytes

Versions: 14

Compression:

Stored size: 608 Bytes

Contents

module CurrencyCloud
  module Actions
    module Find
      def find(params = {})
        response = client.get('find', params)
        mixin_class.new(resource, self, response)
      end

      def first(params = {})
        entities = find(params.merge(per_page: 1)) || []
        entities.first
      end

      private

      def mixin_class
        unless CurrencyCloud.const_defined?(resource.capitalize)
          CurrencyCloud.const_set(resource.capitalize, Class.new(CurrencyCloud::ResourcefulCollection))
        end
        CurrencyCloud.const_get(resource.capitalize)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
currency_cloud-1.2.1 lib/currency_cloud/actions/find.rb
currency_cloud-1.1.4 lib/currency_cloud/actions/find.rb
currency_cloud-1.0.3 lib/currency_cloud/actions/find.rb
currency_cloud-0.17.7 lib/currency_cloud/actions/find.rb
currency_cloud-0.16.2 lib/currency_cloud/actions/find.rb
currency_cloud-0.15.8 lib/currency_cloud/actions/find.rb
currency_cloud-0.14.2 lib/currency_cloud/actions/find.rb
currency_cloud-0.12.5 lib/currency_cloud/actions/find.rb
currency_cloud-0.12.4 lib/currency_cloud/actions/find.rb
currency_cloud-0.11.2 lib/currency_cloud/actions/find.rb
currency_cloud-0.10.0 lib/currency_cloud/actions/find.rb
currency_cloud-0.9.0 lib/currency_cloud/actions/find.rb
currency_cloud-0.8.2 lib/currency_cloud/actions/find.rb
currency_cloud-0.8.0 lib/currency_cloud/actions/find.rb