Class: Shortwave::Facade::Auth

Inherits:
Remote
  • Object
show all
Defined in:
lib/shortwave/facade/lastfm.rb

Instance Method Summary collapse

Methods inherited from Remote

#initialize

Constructor Details

This class inherits a constructor from Shortwave::Facade::Remote

Instance Method Details

#mobile_session(username, authToken) ⇒ Object

Create a web service session for a user. Used for authenticating a user when the password can be inputted by the user. Only suitable for standalone mobile devices. See the authentication how-to for more.

username

The last.fm username.

authToken

A 32-byte ASCII hexadecimal MD5 hash of the last.fm username and the user’s password hash. i.e. md5(username + md5(password)), where ‘+’ represents a concatenation.



835
836
837
# File 'lib/shortwave/facade/lastfm.rb', line 835

def mobile_session(username, authToken)
  get(:signed, {:method => "auth.getMobileSession", :username => username, :authToken => authToken})
end

#session(token) ⇒ Object

Fetch a session key for a user. The third step in the authentication process. See the authentication how-to for more information.

token

A 32-character ASCII hexadecimal MD5 hash returned by step 1 of the authentication process (following the granting of permissions to the application by the user)



842
843
844
# File 'lib/shortwave/facade/lastfm.rb', line 842

def session(token)
  get(:signed, {:method => "auth.getSession", :token => token})
end

#tokenObject

Fetch an unathorized request token for an API account. This is step 2 of the authentication process for desktop applications. Web applications do not need to use this service.



822
823
824
# File 'lib/shortwave/facade/lastfm.rb', line 822

def token()
  get(:signed, {:method => "auth.getToken"})
end

#web_sessionObject

Used by our flash embeds (on trusted domains) to use a site session cookie to seed a ws session without requiring a password. Uses the site cookie so must be accessed over a .last.fm domain.



827
828
829
# File 'lib/shortwave/facade/lastfm.rb', line 827

def web_session()
  get(:signed, {:method => "auth.getWebSession"})
end