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.
132 133 134 135 136 137 |
# File 'lib/bamboo-client/rest.rb', line 132 def initialize(data, http) @data = data @http = http @changes = nil end |
Instance Method Details
#changes ⇒ Object
200 201 202 203 204 205 |
# File 'lib/bamboo-client/rest.rb', line 200 def changes @changes ||= ( doc = fetch_details("changes.change.files").doc_for('changes') doc. Change, @http ) end |
#completed_time ⇒ Object
172 173 174 |
# File 'lib/bamboo-client/rest.rb', line 172 def completed_time Time.parse details.fetch('buildCompletedTime') end |
#failed_test_count ⇒ Object
160 161 162 |
# File 'lib/bamboo-client/rest.rb', line 160 def failed_test_count details.fetch('failedTestCount') end |
#id ⇒ Object
188 189 190 |
# File 'lib/bamboo-client/rest.rb', line 188 def id @data['id'] end |
#key ⇒ Object
180 181 182 |
# File 'lib/bamboo-client/rest.rb', line 180 def key @data['key'] end |
#life_cycle_state ⇒ Object
143 144 145 |
# File 'lib/bamboo-client/rest.rb', line 143 def life_cycle_state @data.fetch("lifeCycleState").downcase.to_sym end |
#number ⇒ Object
176 177 178 |
# File 'lib/bamboo-client/rest.rb', line 176 def number @data['number'] end |
#plan_key ⇒ Object
184 185 186 |
# File 'lib/bamboo-client/rest.rb', line 184 def plan_key key[/^(.+)-\d+$/, 1] end |
#reason ⇒ Object
151 152 153 |
# File 'lib/bamboo-client/rest.rb', line 151 def reason details.fetch('buildReason') end |
#relative_time ⇒ Object Also known as: relative_date
155 156 157 |
# File 'lib/bamboo-client/rest.rb', line 155 def relative_time details.fetch('buildRelativeTime') end |
#start_time ⇒ Object
168 169 170 |
# File 'lib/bamboo-client/rest.rb', line 168 def start_time Time.parse details.fetch('buildStartedTime') end |
#state ⇒ Object
139 140 141 |
# File 'lib/bamboo-client/rest.rb', line 139 def state @data.fetch('state').downcase.to_sym end |
#successful? ⇒ Boolean
147 148 149 |
# File 'lib/bamboo-client/rest.rb', line 147 def successful? state == :successful end |
#successful_test_count ⇒ Object
164 165 166 |
# File 'lib/bamboo-client/rest.rb', line 164 def successful_test_count details.fetch('successfulTestCount') end |
#uri ⇒ Object
196 197 198 |
# File 'lib/bamboo-client/rest.rb', line 196 def uri @uri ||= URI.parse(url) end |
#url ⇒ Object
192 193 194 |
# File 'lib/bamboo-client/rest.rb', line 192 def url @data.fetch("link")['href'] end |