Sha256: 1a15f9b1b41bd94befe93e8909301092170e280954dc8aca47bb60ceacd99410

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

module RemoteResource
  module Querying
    module FinderMethods
      extend ActiveSupport::Concern

      module ClassMethods

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

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

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

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

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ddy_remote_resource-0.4.8 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-0.4.7 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-0.4.6 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-0.4.5 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-0.4.4 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-0.4.3 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-0.4.2 lib/remote_resource/querying/finder_methods.rb