module JSONAPI::Record::Queryable::ClassMethods

Public Instance Methods

all(query = {}) click to toggle source

@param query [Hash] @return [Array<JSONAPI::Record::Base>]

# File lib/jsonapi/record/queryable.rb, line 30
def all(query = {})
  fetch_collection(collection_uri, query)
end
find(id, query = {}) click to toggle source

@param id [String] @param query [Hash] @return [nil] if resource doesn't exits. @return [JSONAPI::Record::Base]

# File lib/jsonapi/record/queryable.rb, line 22
def find(id, query = {})
  find!(id, query)
rescue JSONAPI::SimpleClient::NotFound
  nil
end
find!(id, query = {}) click to toggle source

@param id [String] @param query [Hash] @raise [JSONAPI::SimpleClient::NotFound] if resource doesn't exist.

# File lib/jsonapi/record/queryable.rb, line 14
def find!(id, query = {})
  fetch_resource(individual_uri(id), query)
end