Class: CircleCI::Build
- Inherits:
-
Object
- Object
- CircleCI::Build
- Defined in:
- lib/mina-circle/circle-ci/build.rb
Instance Attribute Summary collapse
-
#build_number ⇒ Object
readonly
Returns the value of attribute build_number.
-
#job_name ⇒ Object
readonly
Returns the value of attribute job_name.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #artifacts ⇒ Object
-
#initialize(hash, project) ⇒ Build
constructor
A new instance of Build.
Constructor Details
#initialize(hash, project) ⇒ Build
Returns a new instance of Build.
3 4 5 6 7 8 |
# File 'lib/mina-circle/circle-ci/build.rb', line 3 def initialize(hash, project) @job_name = hash.dig 'workflows', 'job_name' @build_number = hash['build_num'] @status = hash['status'] @project = project end |
Instance Attribute Details
#build_number ⇒ Object (readonly)
Returns the value of attribute build_number.
2 3 4 |
# File 'lib/mina-circle/circle-ci/build.rb', line 2 def build_number @build_number end |
#job_name ⇒ Object (readonly)
Returns the value of attribute job_name.
2 3 4 |
# File 'lib/mina-circle/circle-ci/build.rb', line 2 def job_name @job_name end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
2 3 4 |
# File 'lib/mina-circle/circle-ci/build.rb', line 2 def project @project end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
2 3 4 |
# File 'lib/mina-circle/circle-ci/build.rb', line 2 def status @status end |
Instance Method Details
#artifacts ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/mina-circle/circle-ci/build.rb', line 10 def artifacts api_path = [ 'project', project.vcs_type, project.organization, project.name, build_number, 'artifacts' ].join '/' client = CircleCI::Client.instance response = client.get(api_path) response.collect { |artifact| CircleCI::Artifact.new artifact } end |