Class: GoApiClient::Api::Job
- Inherits:
-
AbstractApi
- Object
- GoApiClient::AttributeHelper
- AbstractApi
- GoApiClient::Api::Job
- Defined in:
- lib/go_api_client/api/job.rb
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Job
constructor
A new instance of Job.
- #job(options = {}) ⇒ Object
- #scheduled_jobs ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Job
Returns a new instance of Job.
7 8 9 |
# File 'lib/go_api_client/api/job.rb', line 7 def initialize(attributes = {}) super(attributes) end |
Instance Method Details
#job(options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/go_api_client/api/job.rb', line 11 def job( = {}) if [:job_uri] uri = [:job_uri] else raise 'Insufficient arguments' unless [:job_id] uri = "#{@base_uri}/api/jobs/#{options[:job_id]}.xml" end GoApiClient::Parsers::Job.parse(Nokogiri::XML(@http_fetcher.get!(uri)).root) end |
#scheduled_jobs ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/go_api_client/api/job.rb', line 21 def scheduled_jobs uri = "#{@base_uri}/api/jobs/scheduled.xml" doc = Nokogiri::XML(@http_fetcher.post!(uri)) if doc.root doc.root.xpath('./job').collect do |element| GoApiClient::Parsers::ScheduledJob.parse(element) end else [] end end |