Class: Postrocktues::Adapters::Spotify

Inherits:
Object
  • Object
show all
Defined in:
lib/postrocktues/adapters/spotify.rb

Instance Method Summary collapse

Instance Method Details

#init_hallonObject



7
8
9
10
11
12
13
14
# File 'lib/postrocktues/adapters/spotify.rb', line 7

def init_hallon
  if appkey = Postrocktues::Config.load.appkey
    config = Postrocktues::Config.load
    session = Hallon::Session.initialize IO.read(appkey)
    session.login!(config.username, config.password)
    self
  end
end

#playlist(uri) ⇒ Object



25
26
27
# File 'lib/postrocktues/adapters/spotify.rb', line 25

def playlist uri
  Hallon::Playlist.new uri
end

#search(query) ⇒ Object



16
17
18
19
# File 'lib/postrocktues/adapters/spotify.rb', line 16

def search query
  result = search_wrapper query
  valid_search?(result) ? result.first : nil
end

#track(uri) ⇒ Object



21
22
23
# File 'lib/postrocktues/adapters/spotify.rb', line 21

def track uri
  Hallon::Track.new uri
end