Class: Katello::Resources::Candlepin::CandlepinResource
- Inherits:
-
HttpResource
- Object
- HttpResource
- Katello::Resources::Candlepin::CandlepinResource
- Defined in:
- app/lib/katello/resources/candlepin.rb
Direct Known Subclasses
ActivationKey, CPUser, CandlepinPing, Consumer, Content, Entitlement, Environment, Job, Owner, OwnerInfo, Pool, Product, Subscription
Instance Attribute Summary
Attributes inherited from HttpResource
Class Method Summary collapse
Methods inherited from HttpResource
#[], #[]=, create_thing, delete, get, hash_to_query, #initialize, join_path, 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
.default_headers(uuid = nil) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/lib/katello/resources/candlepin.rb', line 57 def self.default_headers(uuid = nil) # There are cases where virt-who needs to act on behalf of hypervisors it is managing. # If the uuid is specified, then that consumer is used in the headers rather than the # virt-who consumer uuid. # Current example is creating a hypervisor that in turn needs to get compliance. if !uuid.nil? && User.consumer? cp_oauth_header = { 'cp-consumer' => uuid } else cp_oauth_header = User.cp_oauth_header end {'accept' => 'application/json', 'accept-language' => I18n.locale, 'content-type' => 'application/json'}.merge(cp_oauth_header) end |
.logger ⇒ Object
53 54 55 |
# File 'app/lib/katello/resources/candlepin.rb', line 53 def self.logger ::Foreman::Logging.logger('katello/cp_rest') end |
.name_to_key(a_name) ⇒ Object
73 74 75 |
# File 'app/lib/katello/resources/candlepin.rb', line 73 def self.name_to_key(a_name) a_name.tr(' ', '_') end |