Sha256: 4e3eff61691e003d7d41d119d7c82294ee6222d34083017c42227166dbc2a019

Contents?: true

Size: 587 Bytes

Versions: 1

Compression:

Stored size: 587 Bytes

Contents

# frozen_string_literal: true

require 'cgi'

module Concourse
  #
  # A pipeline belongs to a target
  # A pipeline has many jobs
  #
  class Pipeline
    attr_reader :name

    def initialize(target, info)
      @target = target
      @info = info
    end

    def name
      @info['name']
    end

    def jobs
      JSON.parse(get).map do |job|
        Job.new(self, job)
      end
    end

    def get(path = '')
      @target.get("/#{CGI.escape(name)}/jobs#{path}")
    end

    def to_s
      "#{self.class.name.split('::').last.downcase} #{name} of #{@target}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitbar-concourse-1.1 lib/concourse/pipeline.rb