Class: RubyCord::Application::Team::Member

Inherits:
DiscordModel show all
Defined in:
lib/rubycord/application.rb

Overview

Represents a member of team.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DiscordModel

#eql?

Constructor Details

#initialize(client, team, data) ⇒ Member

Returns a new instance of Member.



170
171
172
173
174
175
176
177
178
179
# File 'lib/rubycord/application.rb', line 170

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.

Returns:

  • (Boolean)

    Whether the member accepted joining the team.



# File 'lib/rubycord/application.rb', line 159


#membership_state:invited, :accepted (readonly) Also known as: state

Returns The member's membership state.

Returns:

  • (:invited, :accepted)

    The member's membership state.



153
154
155
# File 'lib/rubycord/application.rb', line 153

def membership_state
  @membership_state
end

#owner?Boolean (readonly)

Returns Whether the member is the team's owner.

Returns:

  • (Boolean)

    Whether the member is the team's owner.



# File 'lib/rubycord/application.rb', line 159


#pending?Boolean (readonly)

Returns Whether the member is not joined to the team.

Returns:

  • (Boolean)

    Whether the member is not joined to the team.



# File 'lib/rubycord/application.rb', line 159


#permissionsArray<Symbol> (readonly)

Note:

This always return :*.

Returns The permissions of the member.

Returns:

  • (Array<Symbol>)

    The permissions of the member.



157
158
159
# File 'lib/rubycord/application.rb', line 157

def permissions
  @permissions
end

#team_idSnowflake (readonly)

Returns The ID of member's team.

Returns:



151
152
153
# File 'lib/rubycord/application.rb', line 151

def team_id
  @team_id
end

#userRubyCord::User (readonly)

Returns The user.

Returns:



149
150
151
# File 'lib/rubycord/application.rb', line 149

def user
  @user
end

Instance Method Details

#==(other) ⇒ Object



201
202
203
# File 'lib/rubycord/application.rb', line 201

def ==(other)
  super || @user == other
end

#inspectString

Returns Object class and attributes.

Returns:

  • (String)

    Object class and attributes.



192
193
194
# File 'lib/rubycord/application.rb', line 192

def inspect
  "#<#{self.class} id=#{@user.id}>"
end