Class: Katello::Resources::Candlepin::Content
Constant Summary
Constants inherited
from HttpResource
HttpResource::REQUEST_MAP
Instance Attribute Summary
Attributes inherited from HttpResource
#json
Class Method Summary
collapse
default_headers, fetch_paged, included_list, logger, name_to_key, process_response, raise_rest_client_exception
#[], #[]=, hash_to_query, #initialize, issue_request, join_path, logger, process_response, raise_rest_client_exception, rest_client
#filter_sensitive_data
Class Method Details
.all(owner_label, include_only: nil) ⇒ Object
15
16
17
18
19
|
# File 'app/lib/katello/resources/candlepin/content.rb', line 15
def all(owner_label, include_only: nil)
includes = include_only ? "?#{included_list(include_only)}" : ""
content_json = Candlepin::CandlepinResource.get(path(owner_label) + includes, self.).body
JSON.parse(content_json)
end
|
.create(owner_label, attrs) ⇒ Object
6
7
8
|
# File 'app/lib/katello/resources/candlepin/content.rb', line 6
def create(owner_label, attrs)
JSON.parse(self.post(path(owner_label), JSON.generate(attrs), self.).body).with_indifferent_access
end
|
.destroy(owner_label, id) ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'app/lib/katello/resources/candlepin/content.rb', line 21
def destroy(owner_label, id)
fail ArgumentError, "content id has to be specified" unless id
begin
self.delete(path(owner_label, id), self.).code.to_i
rescue RestClient::NotFound
:content_gone
end
end
|
.get(owner_label, id) ⇒ Object
10
11
12
13
|
# File 'app/lib/katello/resources/candlepin/content.rb', line 10
def get(owner_label, id)
content_json = super(path(owner_label, id), self.).body
JSON.parse(content_json).with_indifferent_access
end
|
.path(owner_label, id = nil) ⇒ Object
36
37
38
|
# File 'app/lib/katello/resources/candlepin/content.rb', line 36
def path(owner_label, id = nil)
"/candlepin/owners/#{owner_label}/content/#{id}"
end
|
.update(owner_label, attrs) ⇒ Object
32
33
34
|
# File 'app/lib/katello/resources/candlepin/content.rb', line 32
def update(owner_label, attrs)
JSON.parse(self.put(path(owner_label, attrs[:id] || attrs['id']), JSON.generate(attrs), self.).body).with_indifferent_access
end
|