Sha256: 3fd7d665fd58c2e4d8499959320984cd9e56eb37e6959d66d88e360a53f1c3c2

Contents?: true

Size: 1.12 KB

Versions: 2

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_attributes: 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

2 entries across 2 versions & 1 rubygems

Version Path
ddy_remote_resource-0.4.10 lib/remote_resource/querying/finder_methods.rb
ddy_remote_resource-0.4.9 lib/remote_resource/querying/finder_methods.rb