Class: Deadwood::Katello::Environment

Inherits:
Base
  • Object
show all
Defined in:
lib/deadwood/model/environment.rb

Instance Method Summary collapse

Methods inherited from Base

collection_path, config, config=, element_path, get, instantiate_collection, #load_attributes_from_response, #query_string, use_oauth?

Instance Method Details

#collection_path(prefix_options = {}, query_options = nil) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/deadwood/model/environment.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)
  org_id = self.organization_id
  attributes.delete(:organization_id)
  "#{self.class.prefix(prefix_options)}organizations/#{org_id}/#{self.class.collection_name}#{query_string(query_options)}"
end

#element_path(id = self.id, prefix_options = {}, query_options = nil) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/deadwood/model/environment.rb', line 32

def element_path(id = self.id, prefix_options = {}, query_options = nil)
  black_list = Array[:organization_id, :organization, :library, :updated_at, :created_at, :prior_id, :prior, :name]
  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
  org_id = self.organization
  # Remove the attributes that aren't allowed to be updated
  black_list.each {|x| attributes.delete(x)}
  "#{self.class.prefix(prefix_options)}organizations/#{org_id}/#{self.class.collection_name}/#{self.id}#{query_string(query_options)}"
end