module PlentyClient::Concerns::RestRoutes

Public Instance Methods

create(headers = {}, &block) click to toggle source
# File lib/plenty_client/concerns/rest_routes.rb, line 53
def create(headers = {}, &block)
  post(base_path, headers, &block)
end
destroy(id, headers = {}, &block) click to toggle source
# File lib/plenty_client/concerns/rest_routes.rb, line 69
def destroy(id, headers = {}, &block)
  delete(single_path(id), headers, &block)
end
find(id, headers = {}, &block) click to toggle source
# File lib/plenty_client/concerns/rest_routes.rb, line 61
def find(id, headers = {}, &block)
  get(single_path(id), headers, &block)
end
list(headers = {}, &block) click to toggle source
# File lib/plenty_client/concerns/rest_routes.rb, line 57
def list(headers = {}, &block)
  get(base_path, headers, &block)
end
skip_rest_routes(*paths) click to toggle source

Undefines class methods in modules/classes extending this module. You don't have to do it if you overload the method explicitly.

# File lib/plenty_client/concerns/rest_routes.rb, line 47
def skip_rest_routes(*paths)
  instance_exec(paths) do |p|
    p.each { |mn| undef :"#{mn}" }
  end
end
update(id, headers = {}, &block) click to toggle source
# File lib/plenty_client/concerns/rest_routes.rb, line 65
def update(id, headers = {}, &block)
  put(single_path(id), headers, &block)
end

Private Instance Methods

single_path(id) click to toggle source
# File lib/plenty_client/concerns/rest_routes.rb, line 75
def single_path(id)
  base_path + "/#{id}"
end