Sha256: bd0dab98e714550b2a3f3ff912fda89b6646b6f4966137743b9ea449e6ddbc72

Contents?: true

Size: 1.08 KB

Versions: 24

Compression:

Stored size: 1.08 KB

Contents

module RemoteResource
  module Querying
    module FinderMethods
      extend ActiveSupport::Concern

      module ClassMethods

        def find(id, connection_options = {})
          response = RemoteResource::Request.new(self, :get, {}, connection_options.merge(id: id)).perform
          build_resource_from_response(response)
        end

        def find_by(params, connection_options = {})
          response = RemoteResource::Request.new(self, :get, {}, connection_options.deep_merge(id: params[:id], params: params.except(:id))).perform
          build_resource_from_response(response)
        end

        def all(connection_options = {})
          response = RemoteResource::Request.new(self, :get, {}, connection_options.merge(collection: true)).perform
          build_collection_from_response(response)
        end

        def where(params, connection_options = {})
          response = RemoteResource::Request.new(self, :get, {}, connection_options.deep_merge(collection: true, params: params)).perform
          build_collection_from_response(response)
        end
      end

    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
ddy_remote_resource-1.0.0.rc4 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.0.0.rc3 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.0.0.rc2 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.0.0.rc1 lib/remote_resource/querying/finder_methods.rb