Class: Sem::API::Project
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Sem::API::Project
show all
- Extended by:
- Base
- Defined in:
- lib/sem/api/project.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Base
api_logger, client, create_new_api_client
Constructor Details
#initialize(org_name, project) ⇒ Project
Returns a new instance of Project.
24
25
26
27
28
|
# File 'lib/sem/api/project.rb', line 24
def initialize(org_name, project)
@org_name = org_name
super(project)
end
|
Instance Attribute Details
#org_name ⇒ Object
Returns the value of attribute org_name.
22
23
24
|
# File 'lib/sem/api/project.rb', line 22
def org_name
@org_name
end
|
Class Method Details
.all ⇒ Object
4
5
6
7
8
|
# File 'lib/sem/api/project.rb', line 4
def self.all
Sem::API::Org.all.map do |org|
client.projects.list_for_org(org.username).map { |project| new(org.username, project) }
end.flatten
end
|
.find!(project_srn) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/sem/api/project.rb', line 10
def self.find!(project_srn)
org_name, project_name = Sem::SRN.parse_project(project_srn)
project = client.projects.list_for_org(org_name, :name => project_name).to_a.first
raise Sem::Errors::ResourceNotFound.new("Project", [org_name, project_name]) if project.nil?
new(org_name, project)
end
|
Instance Method Details
#add_config_file(config_file) ⇒ Object
62
63
64
|
# File 'lib/sem/api/project.rb', line 62
def add_config_file(config_file)
Sem::API::Base.client.config_files.attach_to_project(config_file.id, id)
end
|
#add_env_var(env_var) ⇒ Object
58
59
60
|
# File 'lib/sem/api/project.rb', line 58
def add_env_var(env_var)
Sem::API::Base.client.env_vars.attach_to_project(env_var.id, id)
end
|
#add_shared_config(shared_config) ⇒ Object
42
43
44
|
# File 'lib/sem/api/project.rb', line 42
def add_shared_config(shared_config)
Sem::API::Base.client.shared_configs.attach_to_project(shared_config.id, id)
end
|
#config_files ⇒ Object
50
51
52
|
# File 'lib/sem/api/project.rb', line 50
def config_files
Sem::API::Base.client.config_files.list_for_project(id).map { |file| Sem::API::File.new(file) }
end
|
#env_vars ⇒ Object
54
55
56
|
# File 'lib/sem/api/project.rb', line 54
def env_vars
Sem::API::Base.client.env_vars.list_for_project(id).map { |var| Sem::API::EnvVar.new(var) }
end
|
#full_name ⇒ Object
30
31
32
|
# File 'lib/sem/api/project.rb', line 30
def full_name
"#{@org_name}/#{name}"
end
|
#remove_shared_config(shared_config) ⇒ Object
46
47
48
|
# File 'lib/sem/api/project.rb', line 46
def remove_shared_config(shared_config)
Sem::API::Base.client.shared_configs.detach_from_project(shared_config.id, id)
end
|
#shared_configs ⇒ Object
38
39
40
|
# File 'lib/sem/api/project.rb', line 38
def shared_configs
Sem::API::Base.client.shared_configs.list_for_project(id).map { |config| Sem::API::SharedConfig.new(org_name, config) }
end
|
#teams ⇒ Object
34
35
36
|
# File 'lib/sem/api/project.rb', line 34
def teams
client.teams.list_for_project(id).map { |team| Sem::API::Team.new(org_name, team) }
end
|