class Nehm::Artwork

Artwork objects contains all information of track’s artwork

Public Class Methods

new(track) click to toggle source
# File lib/nehm/artwork.rb, line 8
def initialize(track)
  @track = track
end

Public Instance Methods

file_path() click to toggle source
# File lib/nehm/artwork.rb, line 12
def file_path
  File.join('/tmp', "#{@track.id}.jpg")
end
suicide() click to toggle source
# File lib/nehm/artwork.rb, line 16
def suicide
  File.delete(file_path)
end
url() click to toggle source
# File lib/nehm/artwork.rb, line 20
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