Sha256: 3642f7029e61ddb77a165411d12f7b1140fd49b7499a2670d79d4d3416f2a7ff

Contents?: true

Size: 862 Bytes

Versions: 3

Compression:

Stored size: 862 Bytes

Contents

module Katello
  module Resources
    module Candlepin
      class UpstreamJob < UpstreamCandlepinResource
        class << self
          NOT_FINISHED_STATES = %w(CREATED WAITING PENDING RUNNING).freeze unless defined? NOT_FINISHED_STATES
          API_URL = 'https://subscription.rhsm.redhat.com/subscription'.freeze

          def not_finished?(job)
            NOT_FINISHED_STATES.include?(job[:state])
          end

          def get(id, upstream)
            url = API_URL
            response = Resources::Candlepin::UpstreamConsumer.start_upstream_export("#{url}#{path(id)}", upstream['idCert']['cert'],
              upstream['idCert']['key'], nil)
            job = JSON.parse(response)
            job.with_indifferent_access
          end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
katello-4.13.1 app/lib/katello/resources/candlepin/upstream_job.rb
katello-4.13.0 app/lib/katello/resources/candlepin/upstream_job.rb
katello-4.13.0.rc1 app/lib/katello/resources/candlepin/upstream_job.rb