Sha256: 0fb4b7bc6183f283b62f5a5b8d1ec4452bbd85bb93a7427fb204f7f5a0974b9c

Contents?: true

Size: 627 Bytes

Versions: 2

Compression:

Stored size: 627 Bytes

Contents

module CurrencyCloud
  module ActionsPost
    module Find
      def find(params = {})
        response = client.post('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, false)
          CurrencyCloud.const_set(resource.capitalize, Class.new(CurrencyCloud::ResourcefulCollection))
        end
        CurrencyCloud.const_get(resource.capitalize, false)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
currency_cloud-1.5.0 lib/currency_cloud/actions_post/find_post.rb
currency_cloud-1.4.0 lib/currency_cloud/actions_post/find_post.rb