class Discorb::Embed::Thumbnail

Represents a thumbnail of embed.

Attributes

height[R]

@return [Integer] The height of thumbnail. @return [nil] The Thumbnail object wasn't created from gateway.

proxy_url[R]

@return [String] The proxy url of thumbnail. @return [nil] The Thumbnail object wasn't created from gateway.

url[RW]

@return [String] The url of thumbnail.

width[R]

@return [Integer] The width of thumbnail. @return [nil] The Thumbnail object wasn't created from gateway.

Public Class Methods

new(url) click to toggle source

Initialize a new Thumbnail object.

@param [String] url URL of thumbnail.

# File lib/discorb/embed.rb, line 284
def initialize(url)
  data = url
  if data.is_a? String
    @url = data
  else
    @url = data[:url]
    @proxy_url = data[:proxy_url]
    @height = data[:height]
    @width = data[:width]
  end
end

Public Instance Methods

to_hash() click to toggle source

Convert thumbnail to hash for sending.

@see discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure Offical Discord API Docs @return [Hash] Converted thumbnail.

# File lib/discorb/embed.rb, line 302
def to_hash
  { url: @url }
end