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.3.4 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.3.3 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.3.2 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.3.1 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.2.3 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.2.2 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.2.1 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.2.0 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.1.2 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.1.1 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.1.0 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.0.5 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.0.4 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.0.3 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.0.2 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.0.1 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.0.0 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.0.0.rc7 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.0.0.rc6 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-1.0.0.rc5 lib/remote_resource/querying/finder_methods.rb