Class: Shortwave::Authentication::Desktop

Inherits:
Session
  • Object
show all
Defined in:
lib/shortwave/authentication.rb

Overview

Authentication for destop applications. Send your user to the page given by uri and then call authenticate.

Instance Attribute Summary

Attributes inherited from Session

#session_key

Instance Method Summary collapse

Methods inherited from Session

#initialize, #merge!, #signature, #signed_in?

Constructor Details

This class inherits a constructor from Shortwave::Authentication::Session

Instance Method Details

#authenticateObject

Gets an authenticated session key. Call after the user has logged in at uri.



102
103
104
# File 'lib/shortwave/authentication.rb', line 102

def authenticate
  parse_session_response(@facade.session(token))
end

#uriObject

A uri the user should log in at.



95
96
97
98
99
# File 'lib/shortwave/authentication.rb', line 95

def uri
  response = @facade.token
  @token = Nokogiri::XML(response).css("token").text.strip
  "http://www.last.fm/api/auth/?api_key=#{@api_key}&token=#{@token}"
end