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

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

Constant Summary collapse

NOT_FINISHED_STATES =
%w(CREATED WAITING PENDING RUNNING).freeze

Constants inherited from HttpResource

HttpResource::REQUEST_MAP

Instance Attribute Summary

Attributes inherited from HttpResource

#json

Class Method Summary collapse

Methods inherited from CandlepinResource

default_headers, fetch_paged, included_list, logger, name_to_key, process_response, raise_rest_client_exception

Methods inherited from HttpResource

#[], #[]=, hash_to_query, #initialize, issue_request, join_path, logger, process_response, raise_rest_client_exception, rest_client

Methods included from Concerns::FilterSensitiveData

#filter_sensitive_data

Constructor Details

This class inherits a constructor from Katello::HttpResource

Class Method Details

.get(id, params = {}) ⇒ Object



12
13
14
15
16
# File 'app/lib/katello/resources/candlepin/job.rb', line 12

def get(id, params = {})
  job_json = super(path(id) + hash_to_query(params), self.default_headers).body
  job = JSON.parse(job_json)
  job.with_indifferent_access
end

.not_finished?(job) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'app/lib/katello/resources/candlepin/job.rb', line 8

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

.path(id = nil) ⇒ Object



18
19
20
# File 'app/lib/katello/resources/candlepin/job.rb', line 18

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