Class: Discorb::Application::Team::Member
- Inherits:
 - 
      DiscordModel
      
        
- Object
 - DiscordModel
 - Discorb::Application::Team::Member
 
 
- Defined in:
 - lib/discorb/application.rb
 
Overview
Represents a member of team.
Instance Attribute Summary collapse
- 
  
    
      #membership_state -> :invited, :accepted 
    
    
      (also: #state)
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The member's membership state.
 - 
  
    
      #permissions -> Array<Permissions> 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The permissions of the member.
 - 
  
    
      #team_id -> Snowflake 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The ID of member's team.
 - 
  
    
      #user -> Discorb::User 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The user.
 
Instance Method Summary collapse
- #==(other) -> Object
 - #accepted? -> Boolean
 - 
  
    
      #initialize(client, team, data) -> Member 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Member.
 - #inspect -> Object
 - #owner? -> Boolean
 - #pending? -> Boolean
 
Methods inherited from DiscordModel
Constructor Details
#initialize(client, team, data) -> Member
Returns a new instance of Member.
      120 121 122 123 124 125 126 127 128  | 
    
      # File 'lib/discorb/application.rb', line 120 def initialize(client, team, data) @client = client @data = data @team = team @user = client.users[data[:user][:id]] || User.new(client, data[:user]) @team_id = Snowflake.new(data[:team_id]) @membership_state = self.class.membership_state[data[:membership_state]] @permissions = data[:permissions].map(&:to_sym) end  | 
  
Instance Attribute Details
#membership_state -> :invited, :accepted (readonly) Also known as: state
Returns The member's membership state.
      102 103 104  | 
    
      # File 'lib/discorb/application.rb', line 102 def membership_state @membership_state end  | 
  
#permissions -> Array<Permissions> (readonly)
    Note:
    
  
This always return :*.
Returns The permissions of the member.
      106 107 108  | 
    
      # File 'lib/discorb/application.rb', line 106 def @permissions end  | 
  
#team_id -> Snowflake (readonly)
Returns The ID of member's team.
      100 101 102  | 
    
      # File 'lib/discorb/application.rb', line 100 def team_id @team_id end  | 
  
#user -> Discorb::User (readonly)
Returns The user.
      98 99 100  | 
    
      # File 'lib/discorb/application.rb', line 98 def user @user end  | 
  
Instance Method Details
#==(other) -> Object
      146 147 148  | 
    
      # File 'lib/discorb/application.rb', line 146 def ==(other) super || @user == other end  | 
  
#accepted? -> Boolean
      134 135 136  | 
    
      # File 'lib/discorb/application.rb', line 134 def accepted? @membership_state == :accepted end  | 
  
#inspect -> Object
      138 139 140  | 
    
      # File 'lib/discorb/application.rb', line 138 def inspect "#<#{self.class} id=#{@user.id}>" end  | 
  
#owner? -> Boolean
      142 143 144  | 
    
      # File 'lib/discorb/application.rb', line 142 def owner? @team.owner_user_id == @user.id end  | 
  
#pending? -> Boolean
      130 131 132  | 
    
      # File 'lib/discorb/application.rb', line 130 def pending? @membership_state == :invited end  |