Class: Katello::Resources::Candlepin::Subscription
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
.create_for_owner(owner_key, attrs) ⇒ Object
570
571
572
573
|
# File 'app/lib/katello/resources/candlepin.rb', line 570
def create_for_owner(owner_key, attrs)
subscription = self.post("/candlepin/owners/#{owner_key}/subscriptions", attrs.to_json, self.).body
subscription
end
|
.destroy(subscription_id) ⇒ Object
560
561
562
563
|
# File 'app/lib/katello/resources/candlepin.rb', line 560
def destroy(subscription_id)
fail ArgumentError, "subscription id has to be specified" unless subscription_id
self.delete(path(subscription_id), self.).code.to_i
end
|
.get(id = nil) ⇒ Object
565
566
567
568
|
# File 'app/lib/katello/resources/candlepin.rb', line 565
def get(id = nil)
content_json = super(path(id), self.).body
JSON.parse(content_json)
end
|
.get_for_owner(owner_key) ⇒ Object
575
576
577
578
|
# File 'app/lib/katello/resources/candlepin.rb', line 575
def get_for_owner(owner_key)
content_json = Candlepin::CandlepinResource.get("/candlepin/owners/#{owner_key}/subscriptions", self.).body
JSON.parse(content_json)
end
|
.path(id = nil) ⇒ Object
585
586
587
|
# File 'app/lib/katello/resources/candlepin.rb', line 585
def path(id = nil)
"/candlepin/subscriptions/#{id}"
end
|
.refresh_for_owner(owner_key) ⇒ Object
580
581
582
583
|
# File 'app/lib/katello/resources/candlepin.rb', line 580
def refresh_for_owner(owner_key)
ret = self.put("/candlepin/owners/#{owner_key}/subscriptions", {}.to_json, self.).body
JSON.parse(ret).with_indifferent_access
end
|