Class: Katello::Resources::Candlepin::Content
Instance Attribute Summary
Attributes inherited from HttpResource
#json
Class Method Summary
collapse
default_headers, logger, name_to_key
#[], #[]=, create_thing, delete, 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
.all ⇒ Object
538
539
540
541
|
# File 'app/lib/katello/resources/candlepin.rb', line 538
def all
content_json = Candlepin::CandlepinResource.get(path, self.).body
JSON.parse(content_json)
end
|
.create(attrs) ⇒ Object
529
530
531
|
# File 'app/lib/katello/resources/candlepin.rb', line 529
def create(attrs)
JSON.parse(self.post(path, JSON.generate(attrs), self.).body).with_indifferent_access
end
|
.destroy(id) ⇒ Object
543
544
545
546
|
# File 'app/lib/katello/resources/candlepin.rb', line 543
def destroy(id)
fail ArgumentError, "content id has to be specified" unless id
self.delete(path(id), self.).code.to_i
end
|
.get(id) ⇒ Object
533
534
535
536
|
# File 'app/lib/katello/resources/candlepin.rb', line 533
def get(id)
content_json = super(path(id), self.).body
JSON.parse(content_json).with_indifferent_access
end
|
.path(id = nil) ⇒ Object
552
553
554
|
# File 'app/lib/katello/resources/candlepin.rb', line 552
def path(id = nil)
"/candlepin/content/#{id}"
end
|
.update(attrs) ⇒ Object
548
549
550
|
# File 'app/lib/katello/resources/candlepin.rb', line 548
def update(attrs)
JSON.parse(self.put(path(attrs[:id] || attrs['id']), JSON.generate(attrs), self.).body).with_indifferent_access
end
|