Class: AppleMusic::Artwork
- Inherits:
-
Object
- Object
- AppleMusic::Artwork
- Defined in:
- lib/apple_music/artwork.rb
Overview
Instance Attribute Summary collapse
-
#bg_color ⇒ Object
readonly
Returns the value of attribute bg_color.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#text_color1 ⇒ Object
readonly
Returns the value of attribute text_color1.
-
#text_color2 ⇒ Object
readonly
Returns the value of attribute text_color2.
-
#text_color3 ⇒ Object
readonly
Returns the value of attribute text_color3.
-
#text_color4 ⇒ Object
readonly
Returns the value of attribute text_color4.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #image_url(options = {}) ⇒ Object
-
#initialize(props = {}) ⇒ Artwork
constructor
A new instance of Artwork.
Constructor Details
#initialize(props = {}) ⇒ Artwork
Returns a new instance of Artwork.
10 11 12 13 14 15 16 17 18 19 |
# 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 |
Instance Attribute Details
#bg_color ⇒ Object (readonly)
Returns the value of attribute bg_color.
6 7 8 |
# File 'lib/apple_music/artwork.rb', line 6 def bg_color @bg_color end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
6 7 8 |
# File 'lib/apple_music/artwork.rb', line 6 def height @height end |
#text_color1 ⇒ Object (readonly)
Returns the value of attribute text_color1.
6 7 8 |
# File 'lib/apple_music/artwork.rb', line 6 def text_color1 @text_color1 end |
#text_color2 ⇒ Object (readonly)
Returns the value of attribute text_color2.
6 7 8 |
# File 'lib/apple_music/artwork.rb', line 6 def text_color2 @text_color2 end |
#text_color3 ⇒ Object (readonly)
Returns the value of attribute text_color3.
6 7 8 |
# File 'lib/apple_music/artwork.rb', line 6 def text_color3 @text_color3 end |
#text_color4 ⇒ Object (readonly)
Returns the value of attribute text_color4.
6 7 8 |
# File 'lib/apple_music/artwork.rb', line 6 def text_color4 @text_color4 end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/apple_music/artwork.rb', line 6 def url @url end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
6 7 8 |
# File 'lib/apple_music/artwork.rb', line 6 def width @width end |
Instance Method Details
#image_url(options = {}) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/apple_music/artwork.rb', line 21 def image_url( = {}) @image_url ||= begin width = [:width] || self.width height = [:height] || self.height size = [:size] || "#{width}x#{height}" url.gsub('{w}x{h}', size) end end |