Sha256: 9849f69a1f5137e69e3403826a9a938a1e7326c762b644bd21a8e17194856be6

Contents?: true

Size: 1.33 KB

Versions: 29

Compression:

Stored size: 1.33 KB

Contents

module Katello
  module Resources
    module Candlepin
      class Content < CandlepinResource
        class << self
          def create(owner_label, attrs)
            JSON.parse(self.post(path(owner_label), JSON.generate(attrs), self.default_headers).body).with_indifferent_access
          end

          def get(owner_label, id)
            content_json = super(path(owner_label, id), self.default_headers).body
            JSON.parse(content_json).with_indifferent_access
          end

          def all(owner_label, include_only: nil)
            includes = include_only ? "?#{included_list(include_only)}" : ""
            content_json = Candlepin::CandlepinResource.get(path(owner_label) + includes, self.default_headers).body
            JSON.parse(content_json)
          end

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

          def update(owner_label, attrs)
            JSON.parse(self.put(path(owner_label, attrs[:id] || attrs['id']), JSON.generate(attrs), self.default_headers).body).with_indifferent_access
          end

          def path(owner_label, id = nil)
            "/candlepin/owners/#{owner_label}/content/#{id}"
          end
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
katello-3.15.3.1 app/lib/katello/resources/candlepin/content.rb
katello-3.15.3 app/lib/katello/resources/candlepin/content.rb
katello-3.15.2 app/lib/katello/resources/candlepin/content.rb
katello-3.15.1.1 app/lib/katello/resources/candlepin/content.rb
katello-3.15.1 app/lib/katello/resources/candlepin/content.rb
katello-3.15.0.1 app/lib/katello/resources/candlepin/content.rb
katello-3.15.0 app/lib/katello/resources/candlepin/content.rb
katello-3.15.0.rc2 app/lib/katello/resources/candlepin/content.rb
katello-3.15.0.rc1.3 app/lib/katello/resources/candlepin/content.rb
katello-3.15.0.rc1.2 app/lib/katello/resources/candlepin/content.rb
katello-3.15.0.rc1.1 app/lib/katello/resources/candlepin/content.rb
katello-3.15.0.rc1 app/lib/katello/resources/candlepin/content.rb
katello-3.14.1 app/lib/katello/resources/candlepin/content.rb
katello-3.13.4 app/lib/katello/resources/candlepin/content.rb
katello-3.14.0 app/lib/katello/resources/candlepin/content.rb
katello-3.13.3 app/lib/katello/resources/candlepin/content.rb
katello-3.14.0.rc2 app/lib/katello/resources/candlepin/content.rb
katello-3.13.2 app/lib/katello/resources/candlepin/content.rb
katello-3.14.0.rc1 app/lib/katello/resources/candlepin/content.rb
katello-3.13.1 app/lib/katello/resources/candlepin/content.rb