class Spotify::Music::Importer::SpotifyMatch
Public Class Methods
new(results, options = {})
click to toggle source
# File lib/spotify/music/importer/spotify_match.rb, line 5 def initialize(results, options = {}) @results = results @clean_album = options.delete(:clean_album) { false } @clean_track = options.delete(:clean_track) { false } end
Public Instance Methods
album()
click to toggle source
# File lib/spotify/music/importer/spotify_match.rb, line 27 def album if @clean_album AlbumNameCleaner.new(@results["tracks"]['items'].first['album']['name']).clean else @results["tracks"]['items'].first['album']['name'] end end
artist()
click to toggle source
# File lib/spotify/music/importer/spotify_match.rb, line 23 def artist @results["tracks"]['items'].first['artists'].first['name'] end
found_match?()
click to toggle source
# File lib/spotify/music/importer/spotify_match.rb, line 11 def found_match? @results['tracks']['items'].count > 0 end
id()
click to toggle source
# File lib/spotify/music/importer/spotify_match.rb, line 35 def id @results ["tracks"]["items"].first["id"] end
name()
click to toggle source
# File lib/spotify/music/importer/spotify_match.rb, line 15 def name if @clean_track TrackNameCleaner.new(@results["tracks"]["items"].first["name"]).clean else @results["tracks"]["items"].first["name"] end end
to_s()
click to toggle source
# File lib/spotify/music/importer/spotify_match.rb, line 39 def to_s "Name: #{name} Album: #{album} Artist: #{artist} id: #{id}" end