Class: Katello::Resources::Candlepin::Job

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

Constant Summary collapse

NOT_FINISHED_STATES =
%w(CREATED PENDING RUNNING)

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, 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

.get(id) ⇒ Object



599
600
601
602
603
# File 'app/lib/katello/resources/candlepin.rb', line 599

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

.not_finished?(job) ⇒ Boolean

Returns:

  • (Boolean)


595
596
597
# File 'app/lib/katello/resources/candlepin.rb', line 595

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

.path(id = nil) ⇒ Object



605
606
607
# File 'app/lib/katello/resources/candlepin.rb', line 605

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