Class: CircleCI::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/mina-circle/circle-ci/project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(organization:, name:, vcs_type: 'github') ⇒ Project

Returns a new instance of Project.



4
5
6
7
8
# File 'lib/mina-circle/circle-ci/project.rb', line 4

def initialize(organization:, name:, vcs_type: 'github')
  @organization = organization
  @name = name
  @vcs_type = vcs_type
end

Instance Attribute Details

#artifacts=(value) ⇒ Object (writeonly)

Sets the attribute artifacts

Parameters:

  • value

    the value to set the attribute artifacts to.



2
3
4
# File 'lib/mina-circle/circle-ci/project.rb', line 2

def artifacts=(value)
  @artifacts = value
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/mina-circle/circle-ci/project.rb', line 3

def name
  @name
end

#organizationObject (readonly)

Returns the value of attribute organization.



3
4
5
# File 'lib/mina-circle/circle-ci/project.rb', line 3

def organization
  @organization
end

#vcs_typeObject (readonly)

Returns the value of attribute vcs_type.



3
4
5
# File 'lib/mina-circle/circle-ci/project.rb', line 3

def vcs_type
  @vcs_type
end

Instance Method Details

#build_pathObject



10
11
12
13
14
# File 'lib/mina-circle/circle-ci/project.rb', line 10

def build_path
  parts = api_path_parts + ['tree', real_branch]
    
  parts.compact.join('/')
end

#recent_builds(branch) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/mina-circle/circle-ci/project.rb', line 16

def recent_builds(branch)
  client = CircleCI::Client.instance
  path = api_path branch
  response = client.get path
  builds = response.collect { |build| CircleCI::Build.new(build, self) }
  builds.compact
end