class G5::Jobbing::JobStarter

Attributes

location_setting_urn[RW]

Public Class Methods

new(params={}) click to toggle source
# File lib/g5/jobbing/job_starter.rb, line 5
def initialize(params={})
  self.location_setting_urn = params[:location_setting_urn]
end

Public Instance Methods

perform() click to toggle source
# File lib/g5/jobbing/job_starter.rb, line 9
def perform
  response = HTTParty.post(start_job_url,
                           {query:   {access_token: get_access_token},
                            headers: {'Content-Type' => 'application/json', 'Accept' => 'application/json'}}
  )
  201 == response.code
end
start_job_url() click to toggle source
# File lib/g5/jobbing/job_starter.rb, line 17
def start_job_url
  "#{ENV['JOBS_URL']}/api/v1/job_runners?location_setting_urn=#{self.location_setting_urn}"
end