class AppleMusic::Artwork

developer.apple.com/documentation/applemusicapi/artwork

Attributes

bg_color[R]
height[R]
text_color1[R]
text_color2[R]
text_color3[R]
text_color4[R]
url[R]
width[R]

Public Class Methods

new(props = {}) click to toggle source
# File lib/apple_music/artwork.rb, line 10
def initialize(props = {})
  @bg_color = props['bgColor']
  @height = props['height'] # required
  @width = props['width'] # required
  @text_color1 = props['textColor1']
  @text_color2 = props['textColor2']
  @text_color3 = props['textColor3']
  @text_color4 = props['textColor4']
  @url = props['url'] # required
end

Public Instance Methods

image_url(options = {}) click to toggle source
# File lib/apple_music/artwork.rb, line 21
def image_url(options = {})
  @image_url ||= begin
    width = options[:width] || self.width
    height = options[:height] || self.height
    size = options[:size] || "#{width}x#{height}"
    url.gsub('{w}x{h}', size)
  end
end