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.
137 138 139 140 141 142 |
# File 'lib/bamboo-client/rest.rb', line 137 def initialize(data, http) @data = data @http = http @changes = nil end |
Instance Method Details
#changes ⇒ Object
205 206 207 208 209 210 |
# File 'lib/bamboo-client/rest.rb', line 205 def changes @changes ||= ( doc = fetch_details("changes.change.files").doc_for('changes') doc. Change, @http ) end |
#completed_time ⇒ Object
177 178 179 |
# File 'lib/bamboo-client/rest.rb', line 177 def completed_time Time.parse details.fetch('buildCompletedTime') end |
#failed_test_count ⇒ Object
165 166 167 |
# File 'lib/bamboo-client/rest.rb', line 165 def failed_test_count details.fetch('failedTestCount') end |
#id ⇒ Object
193 194 195 |
# File 'lib/bamboo-client/rest.rb', line 193 def id @data['id'] end |
#key ⇒ Object
185 186 187 |
# File 'lib/bamboo-client/rest.rb', line 185 def key @data['key'] end |
#life_cycle_state ⇒ Object
148 149 150 |
# File 'lib/bamboo-client/rest.rb', line 148 def life_cycle_state @data.fetch("lifeCycleState").downcase.to_sym end |
#number ⇒ Object
181 182 183 |
# File 'lib/bamboo-client/rest.rb', line 181 def number @data['number'] end |
#plan_key ⇒ Object
189 190 191 |
# File 'lib/bamboo-client/rest.rb', line 189 def plan_key key[/^(.+)-\d+$/, 1] end |
#reason ⇒ Object
156 157 158 |
# File 'lib/bamboo-client/rest.rb', line 156 def reason details.fetch('buildReason') end |
#relative_time ⇒ Object Also known as: relative_date
160 161 162 |
# File 'lib/bamboo-client/rest.rb', line 160 def relative_time details.fetch('buildRelativeTime') end |
#start_time ⇒ Object
173 174 175 |
# File 'lib/bamboo-client/rest.rb', line 173 def start_time Time.parse details.fetch('buildStartedTime') end |
#state ⇒ Object
144 145 146 |
# File 'lib/bamboo-client/rest.rb', line 144 def state @data.fetch('state').downcase.to_sym end |
#successful? ⇒ Boolean
152 153 154 |
# File 'lib/bamboo-client/rest.rb', line 152 def successful? state == :successful end |
#successful_test_count ⇒ Object
169 170 171 |
# File 'lib/bamboo-client/rest.rb', line 169 def successful_test_count details.fetch('successfulTestCount') end |
#uri ⇒ Object
201 202 203 |
# File 'lib/bamboo-client/rest.rb', line 201 def uri @uri ||= URI.parse(url) end |
#url ⇒ Object
197 198 199 |
# File 'lib/bamboo-client/rest.rb', line 197 def url @data.fetch("link")['href'] end |