Class: BambooApi::Stage

Inherits:
Object
  • Object
show all
Defined in:
lib/bamboo_api/stage.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(restartable, manual, collapsed_by_default, display_message, display_class, life_cycle_state, state, id, name, description) ⇒ Stage

Returns a new instance of Stage.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bamboo_api/stage.rb', line 6

def initialize restartable, manual, collapsed_by_default, display_message, display_class, life_cycle_state,
  state, id, name, description

  @restartable = restartable
  @manual = manual
  @collapsed_by_default = collapsed_by_default
  @display_message = display_message
  @display_class = display_class
  @life_cycle_state = life_cycle_state
  @state = state
  @id = id
  @name = name
  @description = description
end

Instance Attribute Details

#collapsed_by_defaultObject (readonly)

Returns the value of attribute collapsed_by_default.



3
4
5
# File 'lib/bamboo_api/stage.rb', line 3

def collapsed_by_default
  @collapsed_by_default
end

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/bamboo_api/stage.rb', line 3

def description
  @description
end

#display_classObject (readonly)

Returns the value of attribute display_class.



3
4
5
# File 'lib/bamboo_api/stage.rb', line 3

def display_class
  @display_class
end

#display_messageObject (readonly)

Returns the value of attribute display_message.



3
4
5
# File 'lib/bamboo_api/stage.rb', line 3

def display_message
  @display_message
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/bamboo_api/stage.rb', line 3

def id
  @id
end

#life_cycle_stateObject (readonly)

Returns the value of attribute life_cycle_state.



3
4
5
# File 'lib/bamboo_api/stage.rb', line 3

def life_cycle_state
  @life_cycle_state
end

#manualObject (readonly)

Returns the value of attribute manual.



3
4
5
# File 'lib/bamboo_api/stage.rb', line 3

def manual
  @manual
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/bamboo_api/stage.rb', line 3

def name
  @name
end

#restartableObject (readonly)

Returns the value of attribute restartable.



3
4
5
# File 'lib/bamboo_api/stage.rb', line 3

def restartable
  @restartable
end

#stateObject (readonly)

Returns the value of attribute state.



3
4
5
# File 'lib/bamboo_api/stage.rb', line 3

def state
  @state
end

Class Method Details

.parse(stages) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/bamboo_api/stage.rb', line 29

def self.parse stages
  parsed_stages = []
  stages[ "stages" ][ "stage" ].each do | stage |
    parsed_stages.push( BambooApi::Stage.parse_single( stage ) )
  end

  parsed_stages
end

.parse_single(stage) ⇒ Object



38
39
40
41
# File 'lib/bamboo_api/stage.rb', line 38

def self.parse_single stage
  BambooApi::Stage.new stage[ "restartable" ], stage[ "manual" ], stage[ "collapsedByDefault" ], stage[ "displayMessage" ],
    stage[ "displayClass" ], stage[ "lifeCycleState" ], stage[ "state" ], stage[ "id" ], stage[ "name" ], stage[ "description" ]
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/bamboo_api/stage.rb', line 25

def failed?
  self.state == "Failed"
end

#successful?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/bamboo_api/stage.rb', line 21

def successful?
  self.state == "Successful"
end