Class: Sem::API::Projects

Inherits:
Base
  • Object
show all
Extended by:
Traits::AssociatedWithOrg, Traits::AssociatedWithTeam
Defined in:
lib/sem/api/projects.rb

Constant Summary

Constants inherited from Base

Base::CREDENTIALS_PATH

Class Method Summary collapse

Methods included from Traits::AssociatedWithOrg

list_for_org

Methods included from Traits::AssociatedWithTeam

add_to_team, list_for_team, remove_from_team

Methods inherited from Base

client

Class Method Details

.apiObject



19
20
21
# File 'lib/sem/api/projects.rb', line 19

def self.api
  client.projects
end

.info(path) ⇒ Object



13
14
15
16
17
# File 'lib/sem/api/projects.rb', line 13

def self.info(path)
  org_name, project_name = path.split("/")

  list_for_org(org_name).find { |project| project[:name] == project_name }
end

.listObject



7
8
9
10
11
# File 'lib/sem/api/projects.rb', line 7

def self.list
  org_names = Orgs.list.map { |org| org[:username] }

  org_names.map { |name| list_for_org(name) }.flatten
end

.to_hash(project) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/sem/api/projects.rb', line 23

def self.to_hash(project)
  {
    :id => project.id,
    :name => project.name,
    :created_at => project.created_at,
    :updated_at => project.updated_at
  }
end