Class: Honeybadger::Api::Team
- Inherits:
-
Object
- Object
- Honeybadger::Api::Team
- Defined in:
- lib/honeybadger-api/team.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#projects ⇒ Object
readonly
Returns the value of attribute projects.
-
#team_members ⇒ Object
readonly
Returns the value of attribute team_members.
Class Method Summary collapse
-
.all ⇒ Object
Public: Find all of the teams.
-
.find(team_id) ⇒ Object
Public: Find a team.
-
.handler ⇒ Object
Internal: The handler used to build objects from API responses.
-
.paginate(filters = {}) ⇒ Object
Public: Paginate all of the teams.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Team
constructor
Public: Build a new instance of Team.
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_at ⇒ Object (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 |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/honeybadger-api/team.rb', line 5 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/honeybadger-api/team.rb', line 5 def name @name end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
5 6 7 |
# File 'lib/honeybadger-api/team.rb', line 5 def owner @owner end |
#projects ⇒ Object (readonly)
Returns the value of attribute projects.
5 6 7 |
# File 'lib/honeybadger-api/team.rb', line 5 def projects @projects end |
#team_members ⇒ Object (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
.all ⇒ Object
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 |
.handler ⇒ Object
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 |