Class: Honeybadger::Api::TeamMember
- Inherits:
-
Object
- Object
- Honeybadger::Api::TeamMember
- Defined in:
- lib/honeybadger-api/team_member.rb
Instance Attribute Summary collapse
-
#admin ⇒ Object
readonly
Returns the value of attribute admin.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
-
.all(team_id) ⇒ Object
Public: Find all team members for a team.
-
.find(team_id, team_member_id) ⇒ Object
Public: Find a team member for a given team.
-
.handler ⇒ Object
Internal: The handler used to build objects from API responses.
-
.paginate(team_id, filters = {}) ⇒ Object
Public: Paginate all team members for a team.
Instance Method Summary collapse
-
#admin? ⇒ Boolean
Public: Whether the team member is an admin.
-
#email ⇒ Object
Public: The email address of the team member.
-
#initialize(opts) ⇒ TeamMember
constructor
Public: Build a new instance of TeamMember.
-
#name ⇒ Object
Public: The name of the team member.
Constructor Details
#initialize(opts) ⇒ TeamMember
Public: Build a new instance of TeamMember
opts - A Hash of attributes to initialize a TeamMember
Returns a new TeamMember
12 13 14 15 16 17 |
# File 'lib/honeybadger-api/team_member.rb', line 12 def initialize(opts) @id = opts[:id] @user = User.new(opts[:name], opts[:email]) @admin = opts[:admin] @created_at = opts[:created_at].nil? ? nil : DateTime.parse(opts[:created_at]) end |
Instance Attribute Details
#admin ⇒ Object (readonly)
Returns the value of attribute admin.
5 6 7 |
# File 'lib/honeybadger-api/team_member.rb', line 5 def admin @admin end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
5 6 7 |
# File 'lib/honeybadger-api/team_member.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_member.rb', line 5 def id @id end |
Class Method Details
.all(team_id) ⇒ Object
Public: Find all team members for a team.
35 36 37 38 |
# File 'lib/honeybadger-api/team_member.rb', line 35 def self.all(team_id) path = "teams/#{team_id}/team_members" Honeybadger::Api::Request.all(path, handler) end |
.find(team_id, team_member_id) ⇒ Object
Public: Find a team member for a given team.
47 48 49 50 |
# File 'lib/honeybadger-api/team_member.rb', line 47 def self.find(team_id, team_member_id) path = "teams/#{team_id}/team_members/#{team_member_id}" Honeybadger::Api::Request.find(path, handler) end |
.handler ⇒ Object
Internal: The handler used to build objects from API responses.
53 54 55 |
# File 'lib/honeybadger-api/team_member.rb', line 53 def self.handler Proc.new { |response| TeamMember.new(response) } end |
.paginate(team_id, filters = {}) ⇒ Object
Public: Paginate all team members for a team.
41 42 43 44 |
# File 'lib/honeybadger-api/team_member.rb', line 41 def self.paginate(team_id, filters = {}) path = "teams/#{team_id}/team_members" Honeybadger::Api::Request.paginate(path, handler, filters) end |
Instance Method Details
#admin? ⇒ Boolean
Public: Whether the team member is an admin
20 21 22 |
# File 'lib/honeybadger-api/team_member.rb', line 20 def admin? @admin end |
#email ⇒ Object
Public: The email address of the team member
30 31 32 |
# File 'lib/honeybadger-api/team_member.rb', line 30 def email @user.email end |
#name ⇒ Object
Public: The name of the team member
25 26 27 |
# File 'lib/honeybadger-api/team_member.rb', line 25 def name @user.name end |