Class: Escobar::Heroku::Build
- Inherits:
-
Object
- Object
- Escobar::Heroku::Build
- Defined in:
- lib/escobar/heroku/build.rb
Overview
Class representing a heroku build
Instance Attribute Summary collapse
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#command_id ⇒ Object
Returns the value of attribute command_id.
-
#github_url ⇒ Object
Returns the value of attribute github_url.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#pipeline_name ⇒ Object
Returns the value of attribute pipeline_name.
-
#sha ⇒ Object
Returns the value of attribute sha.
Instance Method Summary collapse
- #app ⇒ Object
- #dashboard_build_output_url ⇒ Object
- #info ⇒ Object
-
#initialize(client, app_id, id) ⇒ Build
constructor
A new instance of Build.
- #release_id ⇒ Object
- #releasing? ⇒ Boolean
- #repository ⇒ Object
- #status ⇒ Object
- #to_job_json ⇒ Object
Constructor Details
#initialize(client, app_id, id) ⇒ Build
Returns a new instance of Build.
12 13 14 15 16 |
# File 'lib/escobar/heroku/build.rb', line 12 def initialize(client, app_id, id) @id = id @app_id = app_id @client = client end |
Instance Attribute Details
#app_id ⇒ Object (readonly)
Returns the value of attribute app_id.
5 6 7 |
# File 'lib/escobar/heroku/build.rb', line 5 def app_id @app_id end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/escobar/heroku/build.rb', line 5 def client @client end |
#command_id ⇒ Object
Returns the value of attribute command_id.
7 8 9 |
# File 'lib/escobar/heroku/build.rb', line 7 def command_id @command_id end |
#github_url ⇒ Object
Returns the value of attribute github_url.
8 9 10 |
# File 'lib/escobar/heroku/build.rb', line 8 def github_url @github_url end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/escobar/heroku/build.rb', line 5 def id @id end |
#pipeline_name ⇒ Object
Returns the value of attribute pipeline_name.
9 10 11 |
# File 'lib/escobar/heroku/build.rb', line 9 def pipeline_name @pipeline_name end |
#sha ⇒ Object
Returns the value of attribute sha.
10 11 12 |
# File 'lib/escobar/heroku/build.rb', line 10 def sha @sha end |
Instance Method Details
#app ⇒ Object
34 35 36 |
# File 'lib/escobar/heroku/build.rb', line 34 def app @app ||= Escobar::Heroku::App.new(client, app_id) end |
#dashboard_build_output_url ⇒ Object
38 39 40 |
# File 'lib/escobar/heroku/build.rb', line 38 def dashboard_build_output_url "https://dashboard.heroku.com/apps/#{app.name}/activity/builds/#{id}" end |
#info ⇒ Object
18 19 20 |
# File 'lib/escobar/heroku/build.rb', line 18 def info @info ||= client.heroku.get("/apps/#{app_id}/builds/#{id}") end |
#release_id ⇒ Object
30 31 32 |
# File 'lib/escobar/heroku/build.rb', line 30 def release_id info["release"]["id"] end |
#releasing? ⇒ Boolean
26 27 28 |
# File 'lib/escobar/heroku/build.rb', line 26 def releasing? status == "succeeded" && !release_id.nil? end |
#repository ⇒ Object
42 43 44 |
# File 'lib/escobar/heroku/build.rb', line 42 def repository github_url && github_url.match(Escobar::GitHub::REPOSITORY_REGEX)[1] end |
#status ⇒ Object
22 23 24 |
# File 'lib/escobar/heroku/build.rb', line 22 def status info["status"] end |
#to_job_json ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/escobar/heroku/build.rb', line 46 def to_job_json { sha: sha, pipeline_name: pipeline_name, repo: repository, app_id: app_id, app_name: app.name, build_id: id, command_id: command_id, target_url: dashboard_build_output_url, deployment_url: github_url } end |