Class: Ciflows::Project
- Inherits:
-
Object
- Object
- Ciflows::Project
- Defined in:
- lib/ciflows/project.rb
Constant Summary collapse
- BASE_URL =
'https://circleci.com/api/v1/projects'
Instance Attribute Summary collapse
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#branch_name ⇒ Object
readonly
Returns the value of attribute branch_name.
-
#build ⇒ Object
Returns the value of attribute build.
-
#build_name ⇒ Object
readonly
Returns the value of attribute build_name.
-
#job_name ⇒ Object
readonly
Returns the value of attribute job_name.
-
#latest_workflows ⇒ Object
Returns the value of attribute latest_workflows.
-
#projects ⇒ Object
Returns the value of attribute projects.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#repo_name ⇒ Object
readonly
Returns the value of attribute repo_name.
Instance Method Summary collapse
- #approve_workflow ⇒ Object
- #failed_jobs ⇒ Object
- #get_workflow ⇒ Object
-
#initialize(repo_name, branch_name, build_name, job_name) ⇒ Project
constructor
A new instance of Project.
- #process ⇒ Object
- #rerun_workflow_from(from) ⇒ Object
Constructor Details
#initialize(repo_name, branch_name, build_name, job_name) ⇒ Project
Returns a new instance of Project.
17 18 19 20 21 22 |
# File 'lib/ciflows/project.rb', line 17 def initialize(repo_name, branch_name, build_name, job_name) @branch_name = CGI.escape(branch_name) @repo_name = repo_name @build_name = build_name @job_name = job_name end |
Instance Attribute Details
#branch ⇒ Object
Returns the value of attribute branch.
15 16 17 |
# File 'lib/ciflows/project.rb', line 15 def branch @branch end |
#branch_name ⇒ Object (readonly)
Returns the value of attribute branch_name.
14 15 16 |
# File 'lib/ciflows/project.rb', line 14 def branch_name @branch_name end |
#build ⇒ Object
Returns the value of attribute build.
15 16 17 |
# File 'lib/ciflows/project.rb', line 15 def build @build end |
#build_name ⇒ Object (readonly)
Returns the value of attribute build_name.
14 15 16 |
# File 'lib/ciflows/project.rb', line 14 def build_name @build_name end |
#job_name ⇒ Object (readonly)
Returns the value of attribute job_name.
14 15 16 |
# File 'lib/ciflows/project.rb', line 14 def job_name @job_name end |
#latest_workflows ⇒ Object
Returns the value of attribute latest_workflows.
15 16 17 |
# File 'lib/ciflows/project.rb', line 15 def latest_workflows @latest_workflows end |
#projects ⇒ Object
Returns the value of attribute projects.
15 16 17 |
# File 'lib/ciflows/project.rb', line 15 def projects @projects end |
#repo ⇒ Object
Returns the value of attribute repo.
15 16 17 |
# File 'lib/ciflows/project.rb', line 15 def repo @repo end |
#repo_name ⇒ Object (readonly)
Returns the value of attribute repo_name.
14 15 16 |
# File 'lib/ciflows/project.rb', line 14 def repo_name @repo_name end |
Instance Method Details
#approve_workflow ⇒ Object
36 37 38 39 |
# File 'lib/ciflows/project.rb', line 36 def approve_workflow graphql_client.get_workflow graphql_client.approve_job end |
#failed_jobs ⇒ Object
46 47 48 49 |
# File 'lib/ciflows/project.rb', line 46 def failed_jobs graphql_client.get_workflow graphql_client.get_jobs('FAILED') end |
#get_workflow ⇒ Object
32 33 34 |
# File 'lib/ciflows/project.rb', line 32 def get_workflow graphql_client.get_workflow end |
#process ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/ciflows/project.rb', line 24 def process find_projects find_repo find_branch find_latest_workflows find_build end |
#rerun_workflow_from(from) ⇒ Object
41 42 43 44 |
# File 'lib/ciflows/project.rb', line 41 def rerun_workflow_from(from) graphql_client.get_workflow graphql_client.rerun_workflow_from(from) end |