module WCC::Data::Mapper::RESTQuery

Public Instance Methods

create(attributes={}) click to toggle source
# File lib/wcc/data/mapper/rest_query.rb, line 15
def create(attributes={})
  ensure_endpoint_defined
  new_from_response(endpoint.create(attributes))
end
find(id) click to toggle source
# File lib/wcc/data/mapper/rest_query.rb, line 5
def find(id)
  ensure_endpoint_defined
  new_from_response(endpoint.show(id))
end
list(params={}) click to toggle source
# File lib/wcc/data/mapper/rest_query.rb, line 10
def list(params={})
  ensure_endpoint_defined
  new_from_response(endpoint.index(params: params))
end

Private Instance Methods

ensure_endpoint_defined() click to toggle source
# File lib/wcc/data/mapper/rest_query.rb, line 22
def ensure_endpoint_defined
  raise EndpointUndefined unless defined?(endpoint) && endpoint
end