class Deadwood::Katello::Role

Public Instance Methods

collection_path(prefix_options = {}, query_options = nil) click to toggle source
# File lib/deadwood/model/role.rb, line 24
def collection_path(prefix_options = {}, query_options = nil)
  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
  query_options.merge!(self.attributes)
  if self.attributes.include?(:user_id)
    user_id = self.user_id
    self.attributes.delete(:user_id)
    "#{self.class.prefix(prefix_options)}users/#{user_id}/#{self.class.collection_name}#{query_string(query_options)}"
  else
    "#{self.class.prefix(prefix_options)}#{self.class.collection_name}#{query_string(query_options)}"
  end
end
element_path(id = self.id, prefix_options = {}, query_options = nil) click to toggle source
# File lib/deadwood/model/role.rb, line 36
def element_path(id = self.id, prefix_options = {}, query_options = nil)
  black_list = Array[:updated_at, :created_at, :locked]
  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
  # Remove the attributes that aren't allowed to be updated
  black_list.each {|x| attributes.delete(x)}
  "#{self.class.prefix(prefix_options)}#{self.class.collection_name}/#{self.id}#{query_string(query_options)}"
end