Class: Ciflows::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/ciflows/project.rb

Constant Summary collapse

BASE_URL =
'https://circleci.com/api/v1/projects'

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#branchObject

Returns the value of attribute branch.



15
16
17
# File 'lib/ciflows/project.rb', line 15

def branch
  @branch
end

#branch_nameObject (readonly)

Returns the value of attribute branch_name.



14
15
16
# File 'lib/ciflows/project.rb', line 14

def branch_name
  @branch_name
end

#buildObject

Returns the value of attribute build.



15
16
17
# File 'lib/ciflows/project.rb', line 15

def build
  @build
end

#build_nameObject (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_nameObject (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_workflowsObject

Returns the value of attribute latest_workflows.



15
16
17
# File 'lib/ciflows/project.rb', line 15

def latest_workflows
  @latest_workflows
end

#projectsObject

Returns the value of attribute projects.



15
16
17
# File 'lib/ciflows/project.rb', line 15

def projects
  @projects
end

#repoObject

Returns the value of attribute repo.



15
16
17
# File 'lib/ciflows/project.rb', line 15

def repo
  @repo
end

#repo_nameObject (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_workflowObject



36
37
38
39
# File 'lib/ciflows/project.rb', line 36

def approve_workflow
  graphql_client.get_workflow
  graphql_client.approve_job
end

#failed_jobsObject



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_workflowObject



32
33
34
# File 'lib/ciflows/project.rb', line 32

def get_workflow
  graphql_client.get_workflow
end

#processObject



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