Module: RemoteResource::Querying::FinderMethods::ClassMethods

Defined in:
lib/remote_resource/querying/finder_methods.rb

Instance Method Summary collapse

Instance Method Details

#all(connection_options = {}) ⇒ Object



18
19
20
21
# File 'lib/remote_resource/querying/finder_methods.rb', line 18

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

#find(id, connection_options = {}) ⇒ Object



8
9
10
11
# File 'lib/remote_resource/querying/finder_methods.rb', line 8

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

#find_by(params, connection_options = {}) ⇒ Object



13
14
15
16
# File 'lib/remote_resource/querying/finder_methods.rb', line 13

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

#where(params, connection_options = {}) ⇒ Object



23
24
25
26
# File 'lib/remote_resource/querying/finder_methods.rb', line 23

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