Class: BambooApi::Build
- Inherits:
-
Object
- Object
- BambooApi::Build
- Defined in:
- lib/bamboo_api/build.rb
Instance Attribute Summary collapse
-
#build_completed_time ⇒ Object
readonly
/result/PHO-UAT.
-
#build_duration_in_seconds ⇒ Object
readonly
/result/PHO-UAT.
-
#build_reason ⇒ Object
readonly
/result/PHO-UAT.
-
#build_started_time ⇒ Object
readonly
/result/PHO-UAT.
-
#build_test_summary ⇒ Object
readonly
/result/PHO-UAT.
-
#continuable ⇒ Object
readonly
/result/PHO-UAT.
-
#failed_test_count ⇒ Object
readonly
/result/PHO-UAT.
-
#id ⇒ Object
readonly
/result/PHO-UAT.
-
#key ⇒ Object
readonly
/result/PHO-UAT.
-
#life_cycle_state ⇒ Object
readonly
/result/PHO-UAT.
-
#link ⇒ Object
readonly
/result/PHO-UAT.
-
#number ⇒ Object
readonly
/result/PHO-UAT.
-
#once_off ⇒ Object
readonly
/result/PHO-UAT.
-
#plan_name ⇒ Object
readonly
/result/PHO-UAT.
-
#project_name ⇒ Object
readonly
/result/PHO-UAT.
-
#quarantined_test_count ⇒ Object
readonly
/result/PHO-UAT.
-
#restartable ⇒ Object
readonly
/result/PHO-UAT.
-
#revision ⇒ Object
readonly
/result/PHO-UAT.
-
#stages ⇒ Object
readonly
/result/PHO-UAT.
-
#state ⇒ Object
readonly
/result/PHO-UAT.
-
#successful_test_count ⇒ Object
readonly
/result/PHO-UAT.
-
#user_url ⇒ Object
readonly
/result/PHO-UAT.
-
#username ⇒ Object
readonly
/result/PHO-UAT.
-
#vcs_revision_key ⇒ Object
readonly
/result/PHO-UAT.
Class Method Summary collapse
- .all ⇒ Object
- .find(key) ⇒ Object
- .find_by_plan(plan_key) ⇒ Object
- .parse(builds) ⇒ Object
- .parse_single(build) ⇒ Object
Instance Method Summary collapse
- #failed? ⇒ Boolean
- #failing_stage ⇒ Object
-
#initialize(restartable, once_off, continuable, id, number, life_cycle_state, state, key, link, plan_name, project_name, build_started_time, build_completed_time, build_duration_in_seconds, vcs_revision_key, build_test_summary, successful_test_count, failed_test_count, quarantined_test_count, build_reason, stages) ⇒ Build
constructor
A new instance of Build.
- #parse_user_url ⇒ Object
- #parse_username ⇒ Object
- #successful? ⇒ Boolean
Constructor Details
#initialize(restartable, once_off, continuable, id, number, life_cycle_state, state, key, link, plan_name, project_name, build_started_time, build_completed_time, build_duration_in_seconds, vcs_revision_key, build_test_summary, successful_test_count, failed_test_count, quarantined_test_count, build_reason, stages) ⇒ Build
Returns a new instance of Build.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/bamboo_api/build.rb', line 9 def initialize restartable, once_off, continuable, id, number, life_cycle_state, state, key, link, plan_name, project_name, build_started_time, build_completed_time, build_duration_in_seconds, vcs_revision_key, build_test_summary, successful_test_count, failed_test_count, quarantined_test_count, build_reason, stages @restartable = restartable @once_off = once_off @continuable = continuable @id = id @number = number @life_cycle_state = life_cycle_state @state = state @key = key @link = link @plan_name = plan_name @build_started_time = build_started_time @build_completed_time = build_completed_time @build_duration_in_seconds = build_duration_in_seconds @revision = @vcs_revision_key = vcs_revision_key @build_test_summary = build_test_summary @successful_test_count = successful_test_count @failed_test_count = failed_test_count @quarantined_test_count = quarantined_test_count @build_reason = build_reason @user_url = user_url @username = username @stages = stages @user_url = parse_user_url @username = parse_username end |
Instance Attribute Details
#build_completed_time ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def build_completed_time @build_completed_time end |
#build_duration_in_seconds ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def build_duration_in_seconds @build_duration_in_seconds end |
#build_reason ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def build_reason @build_reason end |
#build_started_time ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def build_started_time @build_started_time end |
#build_test_summary ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def build_test_summary @build_test_summary end |
#continuable ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def continuable @continuable end |
#failed_test_count ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def failed_test_count @failed_test_count end |
#id ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def id @id end |
#key ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def key @key end |
#life_cycle_state ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def life_cycle_state @life_cycle_state end |
#link ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def link @link end |
#number ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def number @number end |
#once_off ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def once_off @once_off end |
#plan_name ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def plan_name @plan_name end |
#project_name ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def project_name @project_name end |
#quarantined_test_count ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def quarantined_test_count @quarantined_test_count end |
#restartable ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def restartable @restartable end |
#revision ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def revision @revision end |
#stages ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def stages @stages end |
#state ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def state @state end |
#successful_test_count ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def successful_test_count @successful_test_count end |
#user_url ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def user_url @user_url end |
#username ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def username @username end |
#vcs_revision_key ⇒ Object (readonly)
/result/PHO-UAT
4 5 6 |
# File 'lib/bamboo_api/build.rb', line 4 def vcs_revision_key @vcs_revision_key end |
Class Method Details
.all ⇒ Object
87 88 89 |
# File 'lib/bamboo_api/build.rb', line 87 def self.all raise "You must use the method find_by_plan. Sorry." end |
.find(key) ⇒ Object
91 92 93 |
# File 'lib/bamboo_api/build.rb', line 91 def self.find key BambooApi::Build.parse_single( BambooApi.request "result/#{key}", "stages" ) end |
.find_by_plan(plan_key) ⇒ Object
95 96 97 |
# File 'lib/bamboo_api/build.rb', line 95 def self.find_by_plan plan_key BambooApi::Build.parse( BambooApi.request "result/#{plan_key}", "results.result.stages" ) end |
.parse(builds) ⇒ Object
69 70 71 72 73 74 75 76 77 |
# File 'lib/bamboo_api/build.rb', line 69 def self.parse builds parsed_builds = [] builds[ "results" ][ "result" ].each do | build | parsed_builds.push( BambooApi::Build.parse_single( build ) ) end parsed_builds end |
.parse_single(build) ⇒ Object
79 80 81 82 83 84 85 |
# File 'lib/bamboo_api/build.rb', line 79 def self.parse_single build stages = BambooApi::Stage.parse( build ) BambooApi::Build.new build[ "restartable" ], build[ "onceOff" ], build[ "continuable" ], build[ "id" ], build[ "number" ], build[ "lifeCycleState" ], build[ "state" ], build[ "key" ], build[ "link" ], build[ "planName" ], build[ "projectName" ], build[ "buildStartedTime" ], build[ "buildCompletedTime" ], build[ "buildDurationInSeconds" ], build[ "vcsRevisionKey" ], build[ "buildTestSummary" ], build[ "successfulTestCount" ], build[ "failedTestCount" ], build[ "quarantinedTestCount" ], build[ "buildReason" ], stages end |
Instance Method Details
#failed? ⇒ Boolean
53 54 55 |
# File 'lib/bamboo_api/build.rb', line 53 def failed? self.state == "Failed" end |
#failing_stage ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/bamboo_api/build.rb', line 57 def failing_stage failing = nil self.stages.each do | stage | if stage.failed? failing = stage break end end failing end |
#parse_user_url ⇒ Object
45 46 47 |
# File 'lib/bamboo_api/build.rb', line 45 def parse_user_url self.build_reason.scan(/href="(.*)"/).flatten.first if !build_reason.nil? && !build_reason.empty? end |
#parse_username ⇒ Object
41 42 43 |
# File 'lib/bamboo_api/build.rb', line 41 def parse_username self.build_reason.scan(/>(.*)</).flatten.first if !build_reason.nil? && !build_reason.empty? end |
#successful? ⇒ Boolean
49 50 51 |
# File 'lib/bamboo_api/build.rb', line 49 def successful? self.state == "Successful" end |