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
- 
  
    
      #accepted? -> Boolean 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Whether the member accepted joining the team.
 - 
  
    
      #membership_state -> :invited, :accepted 
    
    
      (also: #state)
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
The member's membership state.
 - 
  
    
      #owner? -> Boolean 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Whether the member is the team's owner.
 - 
  
    
      #pending? -> Boolean 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Whether the member is not joined to the team.
 - 
  
    
      #permissions -> Array<Symbol> 
    
    
  
  
  
  
    
      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
 - 
  
    
      #initialize(client, team, data) -> Member 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Member.
 - #inspect -> Object
 
Methods inherited from DiscordModel
Constructor Details
#initialize(client, team, data) -> Member
Returns a new instance of Member.
      165 166 167 168 169 170 171 172 173 174  | 
    
      # File 'lib/discorb/application.rb', line 165 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 = MEMBERSHIP_STATE[data[:membership_state]] @permissions = data[:permissions].map(&:to_sym) end  | 
  
Instance Attribute Details
#accepted? -> Boolean (readonly)
Returns Whether the member accepted joining the team.
| 
       | 
    
      # File 'lib/discorb/application.rb', line 154
     | 
  
#membership_state -> :invited, :accepted (readonly) Also known as: state
Returns The member's membership state.
      148 149 150  | 
    
      # File 'lib/discorb/application.rb', line 148 def membership_state @membership_state end  | 
  
#owner? -> Boolean (readonly)
Returns Whether the member is the team's owner.
| 
       | 
    
      # File 'lib/discorb/application.rb', line 154
     | 
  
#pending? -> Boolean (readonly)
Returns Whether the member is not joined to the team.
| 
       | 
    
      # File 'lib/discorb/application.rb', line 154
     | 
  
#permissions -> Array<Symbol> (readonly)
    Note:
    
  
This always return :*.
Returns The permissions of the member.
      152 153 154  | 
    
      # File 'lib/discorb/application.rb', line 152 def @permissions end  | 
  
#team_id -> Snowflake (readonly)
Returns The ID of member's team.
      146 147 148  | 
    
      # File 'lib/discorb/application.rb', line 146 def team_id @team_id end  | 
  
#user -> Discorb::User (readonly)
Returns The user.
      144 145 146  | 
    
      # File 'lib/discorb/application.rb', line 144 def user @user end  | 
  
Instance Method Details
#==(other) -> Object
      192 193 194  | 
    
      # File 'lib/discorb/application.rb', line 192 def ==(other) super || @user == other end  | 
  
#inspect -> Object
      184 185 186  | 
    
      # File 'lib/discorb/application.rb', line 184 def inspect "#<#{self.class} id=#{@user.id}>" end  |