Class: MijDiscord::Data::Embed
- Inherits:
-
Object
- Object
- MijDiscord::Data::Embed
- Defined in:
- lib/mij-discord/data/embed.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#footer ⇒ Object
readonly
Returns the value of attribute footer.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#thumbnail ⇒ Object
readonly
Returns the value of attribute thumbnail.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#video ⇒ Object
readonly
Returns the value of attribute video.
Instance Method Summary collapse
-
#initialize(data) ⇒ Embed
constructor
A new instance of Embed.
Constructor Details
#initialize(data) ⇒ Embed
Returns a new instance of Embed.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/mij-discord/data/embed.rb', line 31 def initialize(data) @type, @url = data['type'], data['url'] @title, @description = data['title'], data['description'] @color = ColorRGB.new(data['color']) if data['color'] @timestamp = Time.parse(data['timestamp']).utc if data['timestamp'] @footer = EmbedFooter.new(data['footer']) if data['footer'] @thumbnail = EmbedMedia.new(data['thumbnail']) if data['thumbnail'] @image = EmbedMedia.new(data['image']) if data['image'] @video = EmbedMedia.new(data['video']) if data['video'] @author = EmbedAuthor.new(data['author']) if data['author'] @provider = EmbedProvider.new(data['provider']) if data['provider'] @fields = data['fields']&.map {|x| EmbedField.new(x) } end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
27 28 29 |
# File 'lib/mij-discord/data/embed.rb', line 27 def @author end |
#color ⇒ Object (readonly)
Returns the value of attribute color.
15 16 17 |
# File 'lib/mij-discord/data/embed.rb', line 15 def color @color end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
9 10 11 |
# File 'lib/mij-discord/data/embed.rb', line 9 def description @description end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
29 30 31 |
# File 'lib/mij-discord/data/embed.rb', line 29 def fields @fields end |
#footer ⇒ Object (readonly)
Returns the value of attribute footer.
17 18 19 |
# File 'lib/mij-discord/data/embed.rb', line 17 def @footer end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
21 22 23 |
# File 'lib/mij-discord/data/embed.rb', line 21 def image @image end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
25 26 27 |
# File 'lib/mij-discord/data/embed.rb', line 25 def provider @provider end |
#thumbnail ⇒ Object (readonly)
Returns the value of attribute thumbnail.
19 20 21 |
# File 'lib/mij-discord/data/embed.rb', line 19 def thumbnail @thumbnail end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
13 14 15 |
# File 'lib/mij-discord/data/embed.rb', line 13 def @timestamp end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
7 8 9 |
# File 'lib/mij-discord/data/embed.rb', line 7 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/mij-discord/data/embed.rb', line 5 def type @type end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
11 12 13 |
# File 'lib/mij-discord/data/embed.rb', line 11 def url @url end |
#video ⇒ Object (readonly)
Returns the value of attribute video.
23 24 25 |
# File 'lib/mij-discord/data/embed.rb', line 23 def video @video end |