Class: Concourse::Target

Inherits:
Object
  • Object
show all
Defined in:
lib/concourse/target.rb

Overview

A target has many pipelines

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, name = nil) ⇒ Target

Returns a new instance of Target.



15
16
17
18
# File 'lib/concourse/target.rb', line 15

def initialize(client, name = nil)
  @client = client
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



13
14
15
# File 'lib/concourse/target.rb', line 13

def name
  @name
end

Instance Method Details

#get(path = '') ⇒ Object



26
27
28
# File 'lib/concourse/target.rb', line 26

def get(path = '')
  @client.get('pipelines' + path)
end

#pipelinesObject



20
21
22
23
24
# File 'lib/concourse/target.rb', line 20

def pipelines
  JSON.parse(get).map do |json|
    Pipeline.new(self, json)
  end
end

#to_sObject



30
31
32
# File 'lib/concourse/target.rb', line 30

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