Class: BambooApi::Project

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(link, key, name) ⇒ Project

Returns a new instance of Project.



5
6
7
8
9
# File 'lib/bamboo_api/project.rb', line 5

def initialize link, key, name
  @link = link
  @key = key
  @name = name
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



3
4
5
# File 'lib/bamboo_api/project.rb', line 3

def key
  @key
end

Returns the value of attribute link.



3
4
5
# File 'lib/bamboo_api/project.rb', line 3

def link
  @link
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/bamboo_api/project.rb', line 3

def name
  @name
end

Class Method Details

.allObject



25
26
27
# File 'lib/bamboo_api/project.rb', line 25

def self.all
  BambooApi::Project.parse( BambooApi.request "project" )
end

.find(key) ⇒ Object



29
30
31
# File 'lib/bamboo_api/project.rb', line 29

def self.find key
  BambooApi::Project.parse_single( BambooApi.request "project/#{key}" )
end

.parse(projects) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/bamboo_api/project.rb', line 11

def self.parse projects
  parsed_projects = []

  projects[ "projects" ][ "project" ].each do | project |
    parsed_projects.push( BambooApi::Project.parse_single( project ) )
  end

  parsed_projects
end

.parse_single(project) ⇒ Object



21
22
23
# File 'lib/bamboo_api/project.rb', line 21

def self.parse_single project
  BambooApi::Project.new project[ "link" ], project[ "key" ], project[ "name" ]
end