Sha256: 7d40d54396dea8c66b8fe3063b72ddeeea11307566737e4e7970a32ed80166d3

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

module RemoteResource
  module Querying
    module FinderMethods
      extend ActiveSupport::Concern

      module ClassMethods

        def find(id, connection_options = {})
          response = RemoteResource::Request.new(self, :get, { id: id }, connection_options.merge(no_attributes: true)).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 = {})
          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, params, connection_options.merge(collection: true)).perform
          build_collection_from_response(response)
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ddy_remote_resource-0.4.11 lib/remote_resource/querying/finder_methods.rb