Class: CodeBuildTail::Build
- Inherits:
-
Object
- Object
- CodeBuildTail::Build
- Defined in:
- lib/code_build_tail/build.rb
Instance Attribute Summary collapse
-
#build ⇒ Object
readonly
Returns the value of attribute build.
-
#build_id ⇒ Object
readonly
Returns the value of attribute build_id.
-
#refresh_count ⇒ Object
readonly
Returns the value of attribute refresh_count.
Instance Method Summary collapse
-
#initialize(client, build_id) ⇒ Build
constructor
A new instance of Build.
- #logs ⇒ Object
- #missing? ⇒ Boolean
- #refresh ⇒ Object
- #running? ⇒ Boolean
- #successful? ⇒ Boolean
Constructor Details
#initialize(client, build_id) ⇒ Build
Returns a new instance of Build.
5 6 7 8 9 |
# File 'lib/code_build_tail/build.rb', line 5 def initialize(client, build_id) @refresh_count = 0 @client = client @build_id = build_id end |
Instance Attribute Details
#build ⇒ Object (readonly)
Returns the value of attribute build.
4 5 6 |
# File 'lib/code_build_tail/build.rb', line 4 def build @build end |
#build_id ⇒ Object (readonly)
Returns the value of attribute build_id.
4 5 6 |
# File 'lib/code_build_tail/build.rb', line 4 def build_id @build_id end |
#refresh_count ⇒ Object (readonly)
Returns the value of attribute refresh_count.
4 5 6 |
# File 'lib/code_build_tail/build.rb', line 4 def refresh_count @refresh_count end |
Instance Method Details
#logs ⇒ Object
11 12 13 |
# File 'lib/code_build_tail/build.rb', line 11 def logs @build.logs end |
#missing? ⇒ Boolean
15 16 17 |
# File 'lib/code_build_tail/build.rb', line 15 def missing? @build.nil? end |
#refresh ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/code_build_tail/build.rb', line 27 def refresh response = @client.batch_get_builds({ ids: [@build_id] }) @refresh_count += 1 @build = if response[:builds].empty? nil else response[:builds][0] end end |
#running? ⇒ Boolean
19 20 21 |
# File 'lib/code_build_tail/build.rb', line 19 def running? @build.build_status == "IN_PROGRESS" end |
#successful? ⇒ Boolean
23 24 25 |
# File 'lib/code_build_tail/build.rb', line 23 def successful? @build.build_status == "SUCCEEDED" end |