Class: Katello::Resources::Candlepin::Environment
Instance Attribute Summary
Attributes inherited from HttpResource
#json
Class Method Summary
collapse
default_headers, logger, name_to_key
#[], #[]=, create_thing, delete, get, hash_to_query, #initialize, join_path, logger, post, print_debug_info, process_response, put, raise_rest_client_exception, rest_client, url_encode
Class Method Details
.add_content(env_id, content_ids) ⇒ Object
474
475
476
477
478
|
# File 'app/lib/katello/resources/candlepin.rb', line 474
def add_content(env_id, content_ids)
path = self.path(env_id) + "/content"
params = content_ids.map { |content_id| {:contentId => content_id} }
JSON.parse(self.post(path, params.to_json, self.).body).with_indifferent_access
end
|
.all ⇒ Object
455
456
457
|
# File 'app/lib/katello/resources/candlepin.rb', line 455
def all
JSON.parse(self.get(path, self.).body).collect { |a| a.with_indifferent_access }
end
|
.create(owner_id, id, name, description) ⇒ Object
459
460
461
462
463
464
|
# File 'app/lib/katello/resources/candlepin.rb', line 459
def create(owner_id, id, name, description)
attrs = {:id => id, :name => name, :description => description}
path = "/candlepin/owners/#{owner_id}/environments"
environment_json = self.post(path, attrs.to_json, self.).body
JSON.parse(environment_json).with_indifferent_access
end
|
.delete_content(env_id, content_ids) ⇒ Object
480
481
482
483
484
|
# File 'app/lib/katello/resources/candlepin.rb', line 480
def delete_content(env_id, content_ids)
path = self.path(env_id) + "/content"
params = content_ids.map { |content_id| {:content => content_id}.to_param }.join("&")
self.delete("#{path}?#{params}", self.).code.to_i
end
|
.destroy(id) ⇒ Object
466
467
468
|
# File 'app/lib/katello/resources/candlepin.rb', line 466
def destroy(id)
self.delete(path(id), User.).code.to_i
end
|
.find(id) ⇒ Object
451
452
453
|
# File 'app/lib/katello/resources/candlepin.rb', line 451
def find(id)
JSON.parse(self.get(path(id), self.).body).with_indifferent_access
end
|
.path(id = '') ⇒ Object
470
471
472
|
# File 'app/lib/katello/resources/candlepin.rb', line 470
def path(id = '')
"/candlepin/environments/#{id}"
end
|