Class: Katello::Resources::Candlepin::Pool

Inherits:
CandlepinResource show all
Defined in:
app/lib/katello/resources/candlepin.rb

Instance Attribute Summary

Attributes inherited from HttpResource

#json

Class Method Summary collapse

Methods inherited from CandlepinResource

default_headers, logger, name_to_key

Methods inherited from HttpResource

#[], #[]=, 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

Constructor Details

This class inherits a constructor from Katello::HttpResource

Class Method Details

.destroy(id) ⇒ Object



516
517
518
519
# File 'app/lib/katello/resources/candlepin.rb', line 516

def destroy(id)
  fail ArgumentError, "pool id has to be specified" unless id
  self.delete(path(id), self.default_headers).code.to_i
end

.find(pool_id) ⇒ Object



502
503
504
505
506
# File 'app/lib/katello/resources/candlepin.rb', line 502

def find(pool_id)
  pool_json = self.get(path(pool_id), self.default_headers).body
  fail ArgumentError, "pool id cannot contain ?" if pool_id["?"]
  JSON.parse(pool_json).with_indifferent_access
end

.get_for_owner(owner_key, include_temporary_guests = false) ⇒ Object



508
509
510
511
512
513
514
# File 'app/lib/katello/resources/candlepin.rb', line 508

def get_for_owner(owner_key, include_temporary_guests = false)
  url_path = "/candlepin/owners/#{owner_key}/pools"
  url_params = "?attribute=unmapped_guests_only:!true"
  url = include_temporary_guests ? url_path : url_path + url_params
  pools_json = self.get(url, self.default_headers).body
  JSON.parse(pools_json)
end

.path(id = nil) ⇒ Object



521
522
523
# File 'app/lib/katello/resources/candlepin.rb', line 521

def path(id = nil)
  "/candlepin/pools/#{id}"
end