Class: Nehm::Artwork
- Inherits:
-
Object
- Object
- Nehm::Artwork
- Defined in:
- lib/nehm/artwork.rb
Overview
Artwork objects contains all needed information of track’s artwork
Instance Method Summary collapse
- #file_path ⇒ Object
-
#initialize(track) ⇒ Artwork
constructor
A new instance of Artwork.
-
#name ⇒ Object
Use in Get.dl.
- #suicide ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(track) ⇒ Artwork
Returns a new instance of Artwork.
4 5 6 |
# File 'lib/nehm/artwork.rb', line 4 def initialize(track) @track = track end |
Instance Method Details
#file_path ⇒ Object
8 9 10 |
# File 'lib/nehm/artwork.rb', line 8 def file_path File.join('/tmp', "#{@track.id}.jpg") end |
#name ⇒ Object
Use in Get.dl
13 14 15 |
# File 'lib/nehm/artwork.rb', line 13 def name 'artwork' end |
#suicide ⇒ Object
17 18 19 |
# File 'lib/nehm/artwork.rb', line 17 def suicide File.delete(file_path) end |
#url ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/nehm/artwork.rb', line 21 def url hash = @track.hash url = if hash['artwork_url'].nil? hash['user']['avatar_url'] else hash['artwork_url'] end url.sub('large', 't500x500') end |