Class: DiscordRDA::ResolvedData
- Inherits:
-
Object
- Object
- DiscordRDA::ResolvedData
- Defined in:
- lib/discord_rda/entity/support.rb
Overview
Represents resolved data from interactions
Instance Attribute Summary collapse
-
#data ⇒ Hash
readonly
Raw data.
Instance Method Summary collapse
-
#attachments ⇒ Hash<Snowflake, Attachment>
Get resolved attachments.
-
#channels ⇒ Hash<Snowflake, Channel>
Get resolved channels.
-
#initialize(data) ⇒ ResolvedData
constructor
Initialize resolved data.
-
#members ⇒ Hash<Snowflake, Member>
Get resolved members.
-
#messages ⇒ Hash<Snowflake, Message>
Get resolved messages.
-
#roles ⇒ Hash<Snowflake, Role>
Get resolved roles.
-
#users ⇒ Hash<Snowflake, User>
Get resolved users.
Constructor Details
#initialize(data) ⇒ ResolvedData
Initialize resolved data
166 167 168 |
# File 'lib/discord_rda/entity/support.rb', line 166 def initialize(data) @data = data || {} end |
Instance Attribute Details
#data ⇒ Hash (readonly)
Returns Raw data.
162 163 164 |
# File 'lib/discord_rda/entity/support.rb', line 162 def data @data end |
Instance Method Details
#attachments ⇒ Hash<Snowflake, Attachment>
Get resolved attachments
212 213 214 215 216 |
# File 'lib/discord_rda/entity/support.rb', line 212 def return {} unless @data['attachments'] @data['attachments'].transform_values { |a| Attachment.new(a) } end |
#channels ⇒ Hash<Snowflake, Channel>
Get resolved channels
196 197 198 199 200 |
# File 'lib/discord_rda/entity/support.rb', line 196 def channels return {} unless @data['channels'] @data['channels'].transform_values { |c| Channel.new(c) } end |
#members ⇒ Hash<Snowflake, Member>
Get resolved members
180 181 182 183 184 |
# File 'lib/discord_rda/entity/support.rb', line 180 def members return {} unless @data['members'] @data['members'].transform_values { |m| Member.new(m) } end |
#messages ⇒ Hash<Snowflake, Message>
Get resolved messages
204 205 206 207 208 |
# File 'lib/discord_rda/entity/support.rb', line 204 def return {} unless @data['messages'] @data['messages'].transform_values { |m| Message.new(m) } end |