Class: Escobar::Heroku::Release
- Inherits:
-
Object
- Object
- Escobar::Heroku::Release
- Defined in:
- lib/escobar/heroku/release.rb
Overview
Class representing a heroku release
Instance Attribute Summary collapse
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#app_name ⇒ Object
readonly
Returns the value of attribute app_name.
-
#build_id ⇒ Object
readonly
Returns the value of attribute build_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
- #build ⇒ Object
- #dashboard_release_output_url ⇒ Object
- #info ⇒ Object
-
#initialize(client, app_id, build_id, id) ⇒ Release
constructor
A new instance of Release.
- #ref ⇒ Object
- #repository ⇒ Object
- #slug ⇒ Object
- #status ⇒ Object
- #to_job_json ⇒ Object
Constructor Details
#initialize(client, app_id, build_id, id) ⇒ Release
Returns a new instance of Release.
12 13 14 15 16 17 |
# File 'lib/escobar/heroku/release.rb', line 12 def initialize(client, app_id, build_id, id) @id = id @app_id = app_id @build_id = build_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/release.rb', line 5 def app_id @app_id end |
#app_name ⇒ Object (readonly)
Returns the value of attribute app_name.
5 6 7 |
# File 'lib/escobar/heroku/release.rb', line 5 def app_name @app_name end |
#build_id ⇒ Object (readonly)
Returns the value of attribute build_id.
5 6 7 |
# File 'lib/escobar/heroku/release.rb', line 5 def build_id @build_id end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/escobar/heroku/release.rb', line 5 def client @client end |
#command_id ⇒ Object
Returns the value of attribute command_id.
7 8 9 |
# File 'lib/escobar/heroku/release.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/release.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/release.rb', line 5 def id @id end |
#pipeline_name ⇒ Object
Returns the value of attribute pipeline_name.
9 10 11 |
# File 'lib/escobar/heroku/release.rb', line 9 def pipeline_name @pipeline_name end |
#sha ⇒ Object
Returns the value of attribute sha.
10 11 12 |
# File 'lib/escobar/heroku/release.rb', line 10 def sha @sha end |
Instance Method Details
#app ⇒ Object
23 24 25 |
# File 'lib/escobar/heroku/release.rb', line 23 def app @app ||= Escobar::Heroku::App.new(client, app_id) end |
#build ⇒ Object
27 28 29 |
# File 'lib/escobar/heroku/release.rb', line 27 def build @build ||= Escobar::Heroku::Build.new(client, app.id, build_id) end |
#dashboard_release_output_url ⇒ Object
39 40 41 |
# File 'lib/escobar/heroku/release.rb', line 39 def dashboard_release_output_url "https://dashboard.heroku.com/apps/#{app.name}/activity/releases/#{id}" end |
#info ⇒ Object
19 20 21 |
# File 'lib/escobar/heroku/release.rb', line 19 def info @info ||= client.heroku.get("/apps/#{app_id}/releases/#{id}") end |
#ref ⇒ Object
35 36 37 |
# File 'lib/escobar/heroku/release.rb', line 35 def ref slug && slug.ref end |
#repository ⇒ Object
43 44 45 |
# File 'lib/escobar/heroku/release.rb', line 43 def repository github_url && github_url.match(Escobar::GitHub::REPOSITORY_REGEX)[1] end |
#slug ⇒ Object
31 32 33 |
# File 'lib/escobar/heroku/release.rb', line 31 def slug @slug ||= Escobar::Heroku::Slug.new(client, app.id, info["slug"]["id"]) end |
#status ⇒ Object
47 48 49 |
# File 'lib/escobar/heroku/release.rb', line 47 def status info["status"] end |
#to_job_json ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/escobar/heroku/release.rb', line 51 def to_job_json { sha: sha, name: pipeline_name, repo: repository, app_id: app_id, app_name: app.name, build_id: build_id, release_id: id, command_id: command_id, target_url: dashboard_release_output_url, deployment_url: github_url } end |