Class: Bamboo::Client::Rest::Result
- Inherits:
-
Object
- Object
- Bamboo::Client::Rest::Result
- Defined in:
- lib/bamboo-client/rest.rb
Overview
Project
Instance Method Summary collapse
- #changes ⇒ Object
- #completed_time ⇒ Object
- #failed_test_count ⇒ Object
- #id ⇒ Object
-
#initialize(data, http) ⇒ Result
constructor
A new instance of Result.
- #key ⇒ Object
- #life_cycle_state ⇒ Object
- #number ⇒ Object
- #plan_key ⇒ Object
- #reason ⇒ Object
- #relative_time ⇒ Object (also: #relative_date)
- #start_time ⇒ Object
- #state ⇒ Object
- #successful? ⇒ Boolean
- #successful_test_count ⇒ Object
- #uri ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(data, http) ⇒ Result
Returns a new instance of Result.
143 144 145 146 147 148 |
# File 'lib/bamboo-client/rest.rb', line 143 def initialize(data, http) @data = data @http = http @changes = nil end |
Instance Method Details
#changes ⇒ Object
211 212 213 214 215 216 |
# File 'lib/bamboo-client/rest.rb', line 211 def changes @changes ||= ( doc = fetch_details("changes.change.files").doc_for('changes') doc. Change, @http ) end |
#completed_time ⇒ Object
183 184 185 |
# File 'lib/bamboo-client/rest.rb', line 183 def completed_time Time.parse details.fetch('buildCompletedTime') end |
#failed_test_count ⇒ Object
171 172 173 |
# File 'lib/bamboo-client/rest.rb', line 171 def failed_test_count details.fetch('failedTestCount') end |
#id ⇒ Object
199 200 201 |
# File 'lib/bamboo-client/rest.rb', line 199 def id @data['id'] end |
#key ⇒ Object
191 192 193 |
# File 'lib/bamboo-client/rest.rb', line 191 def key @data['key'] end |
#life_cycle_state ⇒ Object
154 155 156 |
# File 'lib/bamboo-client/rest.rb', line 154 def life_cycle_state @data.fetch("lifeCycleState").downcase.to_sym end |
#number ⇒ Object
187 188 189 |
# File 'lib/bamboo-client/rest.rb', line 187 def number @data['number'] end |
#plan_key ⇒ Object
195 196 197 |
# File 'lib/bamboo-client/rest.rb', line 195 def plan_key key[/^(.+)-\d+$/, 1] end |
#reason ⇒ Object
162 163 164 |
# File 'lib/bamboo-client/rest.rb', line 162 def reason details.fetch('buildReason') end |
#relative_time ⇒ Object Also known as: relative_date
166 167 168 |
# File 'lib/bamboo-client/rest.rb', line 166 def relative_time details.fetch('buildRelativeTime') end |
#start_time ⇒ Object
179 180 181 |
# File 'lib/bamboo-client/rest.rb', line 179 def start_time Time.parse details.fetch('buildStartedTime') end |
#state ⇒ Object
150 151 152 |
# File 'lib/bamboo-client/rest.rb', line 150 def state @data.fetch('state').downcase.to_sym end |
#successful? ⇒ Boolean
158 159 160 |
# File 'lib/bamboo-client/rest.rb', line 158 def successful? state == :successful end |
#successful_test_count ⇒ Object
175 176 177 |
# File 'lib/bamboo-client/rest.rb', line 175 def successful_test_count details.fetch('successfulTestCount') end |
#uri ⇒ Object
207 208 209 |
# File 'lib/bamboo-client/rest.rb', line 207 def uri @uri ||= URI.parse(url) end |
#url ⇒ Object
203 204 205 |
# File 'lib/bamboo-client/rest.rb', line 203 def url @data.fetch("link")['href'] end |