Class: Sem::API::Org

Inherits:
SimpleDelegator
  • Object
show all
Extended by:
Base
Defined in:
lib/sem/api/org.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

api_logger, client, create_new_api_client

Class Method Details

.allObject



4
5
6
# File 'lib/sem/api/org.rb', line 4

def self.all
  client.orgs.list.map { |org| new(org) }
end

.find!(org_name) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/sem/api/org.rb', line 8

def self.find!(org_name)
  org = client.orgs.get(org_name)

  raise Sem::Errors::ResourceNotFound.new("Organization", [org_name]) if org.nil?

  new(org)
end

Instance Method Details

#projectsObject



24
25
26
# File 'lib/sem/api/org.rb', line 24

def projects
  Sem::API::Base.client.projects.list_for_org(name).map { |project| Sem::API::Project.new(project) }
end

#teamsObject



20
21
22
# File 'lib/sem/api/org.rb', line 20

def teams
  Sem::API::Base.client.teams.list_for_org(name).map { |team| Sem::API::Team.new(team) }
end

#usersObject



16
17
18
# File 'lib/sem/api/org.rb', line 16

def users
  Sem::API::Base.client.users.list_for_org(name).map { |user| Sem::API::User.new(user) }
end