class SpotifyOsxController::Search
Public Class Methods
new(parameters = {})
click to toggle source
# File lib/spotify_osx_controller/search.rb, line 7 def initialize (parameters = {}) @track = parameters[:track] @artist = parameters[:artist] @album = parameters[:album] @query = construct_query @results = run_query end
Public Instance Methods
any?()
click to toggle source
# File lib/spotify_osx_controller/search.rb, line 15 def any? @results.any? end
first()
click to toggle source
# File lib/spotify_osx_controller/search.rb, line 19 def first @results.first end
Private Instance Methods
construct_query()
click to toggle source
# File lib/spotify_osx_controller/search.rb, line 33 def construct_query query = "" query += "artist:#{@artist} " if @artist query += "track:#{@track} " if @track query += "album:#{@album}" if @album query end
run_query()
click to toggle source
# File lib/spotify_osx_controller/search.rb, line 25 def run_query () if !@track RSpotify::Album.search @query else RSpotify::Track.search @query end end