Sha256: 4100619bcc001100f125f524730c32b6d36fa5bdb942c5f1ec83b30f204cce16

Contents?: true

Size: 628 Bytes

Versions: 3

Compression:

Stored size: 628 Bytes

Contents

module AnsibleTowerClient
  class JobTemplate < BaseModel
    def launch(options = {})
      launch_url = "#{url}launch/"
      response   = api.post(launch_url, options).body
      job        = JSON.parse(response)
      api.jobs.find(job['job'])
    end

    def survey_spec
      spec_url = related['survey_spec']
      return nil unless spec_url
      api.get(spec_url).body
    end

    def survey_spec_hash
      survey_spec.nil? ? {} : hashify(:survey_spec)
    end

    def extra_vars_hash
      extra_vars.empty? ? {} : hashify(:extra_vars)
    end

    def self.endpoint
      "job_templates".freeze
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ansible_tower_client-0.5.0 lib/ansible_tower_client/base_models/job_template.rb
ansible_tower_client-0.4.1 lib/ansible_tower_client/base_models/job_template.rb
ansible_tower_client-0.4.0 lib/ansible_tower_client/base_models/job_template.rb