Class: Honeybadger::Api::TeamInvitation
- Inherits:
-
Object
- Object
- Honeybadger::Api::TeamInvitation
- Defined in:
- lib/honeybadger-api/team_invitation.rb
Instance Attribute Summary collapse
-
#accepted_at ⇒ Object
readonly
Returns the value of attribute accepted_at.
-
#accepted_by ⇒ Object
readonly
Returns the value of attribute accepted_by.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#created_by ⇒ Object
readonly
Returns the value of attribute created_by.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Class Method Summary collapse
-
.all(team_id) ⇒ Object
Public: Find all team invitations for a team.
-
.find(team_id, team_invitation_id) ⇒ Object
Public: Find a team invitation 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 invitations for a team.
Instance Method Summary collapse
-
#admin? ⇒ Boolean
Public: Whether the invitation was for an admin user.
-
#initialize(opts) ⇒ TeamInvitation
constructor
Public: Build a new instance of TeamInvitation.
Constructor Details
#initialize(opts) ⇒ TeamInvitation
Public: Build a new instance of TeamInvitation
opts - A Hash of attributes to initialize a TeamInvitation
Returns a new TeamInvitation
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/honeybadger-api/team_invitation.rb', line 12 def initialize(opts) @id = opts[:id] @token = opts[:token] @email = opts[:email] if opts[:created_by].nil? @created_by = nil else @created_by = User.new(opts[:created_by][:name], opts[:created_by][:email]) end if opts[:accepted_by].nil? @accepted_by = nil else @accepted_by = User.new(opts[:accepted_by][:name], opts[:accepted_by][:email]) end @admin = opts[:admin] @created_at = opts[:created_at].nil? ? nil : DateTime.parse(opts[:created_at]) @accepted_at = opts[:accepted_at].nil? ? nil : DateTime.parse(opts[:accepted_at]) @message = opts[:message] end |
Instance Attribute Details
#accepted_at ⇒ Object (readonly)
Returns the value of attribute accepted_at.
5 6 7 |
# File 'lib/honeybadger-api/team_invitation.rb', line 5 def accepted_at @accepted_at end |
#accepted_by ⇒ Object (readonly)
Returns the value of attribute accepted_by.
5 6 7 |
# File 'lib/honeybadger-api/team_invitation.rb', line 5 def accepted_by @accepted_by end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
5 6 7 |
# File 'lib/honeybadger-api/team_invitation.rb', line 5 def created_at @created_at end |
#created_by ⇒ Object (readonly)
Returns the value of attribute created_by.
5 6 7 |
# File 'lib/honeybadger-api/team_invitation.rb', line 5 def created_by @created_by end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
5 6 7 |
# File 'lib/honeybadger-api/team_invitation.rb', line 5 def email @email end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/honeybadger-api/team_invitation.rb', line 5 def id @id end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
5 6 7 |
# File 'lib/honeybadger-api/team_invitation.rb', line 5 def @message end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
5 6 7 |
# File 'lib/honeybadger-api/team_invitation.rb', line 5 def token @token end |
Class Method Details
.all(team_id) ⇒ Object
Public: Find all team invitations for a team.
38 39 40 41 |
# File 'lib/honeybadger-api/team_invitation.rb', line 38 def self.all(team_id) path = "teams/#{team_id}/team_invitations" Honeybadger::Api::Request.all(path, handler) end |
.find(team_id, team_invitation_id) ⇒ Object
Public: Find a team invitation for a given team.
50 51 52 53 |
# File 'lib/honeybadger-api/team_invitation.rb', line 50 def self.find(team_id, team_invitation_id) path = "teams/#{team_id}/team_invitations/#{team_invitation_id}" Honeybadger::Api::Request.find(path, handler) end |
.handler ⇒ Object
Internal: The handler used to build objects from API responses.
56 57 58 |
# File 'lib/honeybadger-api/team_invitation.rb', line 56 def self.handler Proc.new { |response| TeamInvitation.new(response) } end |
.paginate(team_id, filters = {}) ⇒ Object
Public: Paginate all team invitations for a team.
44 45 46 47 |
# File 'lib/honeybadger-api/team_invitation.rb', line 44 def self.paginate(team_id, filters = {}) path = "teams/#{team_id}/team_invitations" Honeybadger::Api::Request.paginate(path, handler, filters) end |
Instance Method Details
#admin? ⇒ Boolean
Public: Whether the invitation was for an admin user.
33 34 35 |
# File 'lib/honeybadger-api/team_invitation.rb', line 33 def admin? @admin end |