Class: Honeybadger::Api::Team

Inherits:
Object
  • Object
show all
Defined in:
lib/honeybadger-api/team.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Team

Public: Build a new instance of Team

opts - A Hash of attributes to initialize a Team

Returns a new Team



12
13
14
15
16
17
18
19
# File 'lib/honeybadger-api/team.rb', line 12

def initialize(opts)
  @id = opts[:id]
  @name = opts[:name]
  @owner = User.new(opts[:owner][:name], opts[:owner][:email])
  @team_members = opts[:members].collect { |m| TeamMember.new(m) }
  @projects = opts[:projects].collect { |p| Project.new(p) }
  @created_at = opts[:created_at].nil? ? nil : DateTime.parse(opts[:created_at])
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



5
6
7
# File 'lib/honeybadger-api/team.rb', line 5

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/honeybadger-api/team.rb', line 5

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/honeybadger-api/team.rb', line 5

def name
  @name
end

#ownerObject (readonly)

Returns the value of attribute owner.



5
6
7
# File 'lib/honeybadger-api/team.rb', line 5

def owner
  @owner
end

#projectsObject (readonly)

Returns the value of attribute projects.



5
6
7
# File 'lib/honeybadger-api/team.rb', line 5

def projects
  @projects
end

#team_membersObject (readonly)

Returns the value of attribute team_members.



5
6
7
# File 'lib/honeybadger-api/team.rb', line 5

def team_members
  @team_members
end

Class Method Details

.allObject

Public: Find all of the teams.



22
23
24
# File 'lib/honeybadger-api/team.rb', line 22

def self.all
  Honeybadger::Api::Request.all("teams", handler)
end

.find(team_id) ⇒ Object

Public: Find a team.



32
33
34
# File 'lib/honeybadger-api/team.rb', line 32

def self.find(team_id)
  Honeybadger::Api::Request.find("teams/#{team_id}", handler)
end

.handlerObject

Internal: The handler used to build objects from API responses.



37
38
39
# File 'lib/honeybadger-api/team.rb', line 37

def self.handler
  Proc.new { |response| Team.new(response) }
end

.paginate(filters = {}) ⇒ Object

Public: Paginate all of the teams.



27
28
29
# File 'lib/honeybadger-api/team.rb', line 27

def self.paginate(filters = {})
  Honeybadger::Api::Request.paginate("teams", handler, filters)
end