Class: Bamboo::Client::Remote::BuildResult

Inherits:
Object
  • Object
show all
Defined in:
lib/bamboo-client/remote.rb

Defined Under Namespace

Classes: Commit

Instance Method Summary collapse

Constructor Details

#initialize(doc) ⇒ BuildResult

Returns a new instance of BuildResult.



129
130
131
# File 'lib/bamboo-client/remote.rb', line 129

def initialize(doc)
  @doc = doc
end

Instance Method Details

#commitsObject



200
201
202
# File 'lib/bamboo-client/remote.rb', line 200

def commits
  @doc.css('commits commit').map { |e| Commit.new(e) }
end

#durationObject



180
181
182
# File 'lib/bamboo-client/remote.rb', line 180

def duration
  @doc.css("buildDurationInSeconds").text.to_i
end

#duration_descriptionObject



184
185
186
# File 'lib/bamboo-client/remote.rb', line 184

def duration_description
  @doc.css("buildDurationDescription").text
end

#end_timeObject



174
175
176
177
178
# File 'lib/bamboo-client/remote.rb', line 174

def end_time
  Time.parse @doc.css("buildCompletedDate").text
rescue ArgumentError
  nil
end

#failed_test_countObject



160
161
162
# File 'lib/bamboo-client/remote.rb', line 160

def failed_test_count
  @doc.css("failedTestCount").text.to_i
end

#keyObject



133
134
135
# File 'lib/bamboo-client/remote.rb', line 133

def key
  @doc.css("buildKey").text
end

#nameObject



152
153
154
# File 'lib/bamboo-client/remote.rb', line 152

def name
  @doc.css("buildName").text
end

#numberObject



156
157
158
# File 'lib/bamboo-client/remote.rb', line 156

def number
  @doc.css("buildNumber").text.to_i
end

#project_nameObject



148
149
150
# File 'lib/bamboo-client/remote.rb', line 148

def project_name
  @doc.css("projectName").text
end

#reasonObject



196
197
198
# File 'lib/bamboo-client/remote.rb', line 196

def reason
  @doc.css("buildReason").text
end

#relative_dateObject



188
189
190
# File 'lib/bamboo-client/remote.rb', line 188

def relative_date
  @doc.css("buildRelativeBuildDate").text
end

#start_timeObject



168
169
170
171
172
# File 'lib/bamboo-client/remote.rb', line 168

def start_time
  Time.parse @doc.css("buildTime").text
rescue ArgumentError
  nil
end

#stateObject



137
138
139
140
141
142
# File 'lib/bamboo-client/remote.rb', line 137

def state
  text = @doc.css("buildState").text

  return 'unknown' if text.strip.empty?
  text.downcase.gsub(/ /, '_').to_sym
end

#successful?Boolean

Returns:

  • (Boolean)


144
145
146
# File 'lib/bamboo-client/remote.rb', line 144

def successful?
  state == :successful
end

#successful_test_countObject



164
165
166
# File 'lib/bamboo-client/remote.rb', line 164

def successful_test_count
  @doc.css("successfulTestCount").text.to_i
end

#test_summaryObject



192
193
194
# File 'lib/bamboo-client/remote.rb', line 192

def test_summary
  @doc.css("buildTestSummary").text
end