Class: Rockstar::Auth

Inherits:
Base
  • Object
show all
Defined in:
lib/rockstar/auth.rb

Instance Method Summary collapse

Methods inherited from Base

connection, fetch_and_parse, get_instance

Instance Method Details

#session(token) ⇒ Object

Returns the token for a session. You have to use TokenAuth first and then use this class with the token that is given by last.fm to create a session token This session token can be stored in your database, it is not expiring. See Rockstar::TokenAuth for a detailed example



10
11
12
13
# File 'lib/rockstar/auth.rb', line 10

def session(token)
  doc = self.class.fetch_and_parse("auth.getSession", {:token => token}, true)
  Rockstar::Session.new_from_xml(doc)
end

#tokenObject



15
16
17
18
19
# File 'lib/rockstar/auth.rb', line 15

def token
  doc = self.class.fetch_and_parse("auth.getToken", {}, true)
  token = (doc).at(:token).inner_html if (doc).at(:token)
  token
end