class Pandora::Partner
Attributes
decryption_key[R]
device[R]
encryption_key[R]
partner_auth_token[R]
partner_id[R]
password[R]
time_offset[R]
username[R]
Public Class Methods
new(username, password, device, encryption_key, decryption_key)
click to toggle source
# File lib/pandora/partner.rb, line 11 def initialize(username, password, device, encryption_key, decryption_key) @username, @password, @device, @encryption_key, @decryption_key = username, password, device, encryption_key, decryption_key authenticate end
Public Instance Methods
login_user(username, password)
click to toggle source
# File lib/pandora/partner.rb, line 21 def login_user(username, password) User.new(self, username, password) end
marshal_dump()
click to toggle source
# File lib/pandora/partner.rb, line 25 def marshal_dump [@username, @password, @device, @encryption_key, @decryption_key, @partner_id, @partner_auth_token, @time_offset] end
marshal_load(objects)
click to toggle source
# File lib/pandora/partner.rb, line 30 def marshal_load(objects) @username, @password, @device, @encryption_key, @decryption_key, @partner_id, @partner_auth_token, @time_offset = objects end
reauthenticate()
click to toggle source
# File lib/pandora/partner.rb, line 17 def reauthenticate authenticate end
Private Instance Methods
authenticate()
click to toggle source
# File lib/pandora/partner.rb, line 42 def authenticate @partner_id = @partner_auth_token = @time_offset = nil result = call 'auth.partnerLogin', { secure: true, encrypt: false }, { username: @username, password: @password, deviceModel: @device, version: '5' } @partner_id = result['partnerId'] @partner_auth_token = result['partnerAuthToken'] server_time = cryptor.decrypt(result['syncTime'])[4..-1].to_i @time_offset = Time.now.to_i - server_time end
cryptor()
click to toggle source
# File lib/pandora/partner.rb, line 38 def cryptor @cryptor ||= Cryptor.new(@encryption_key, @decryption_key) end
user_auth_token()
click to toggle source
# File lib/pandora/partner.rb, line 58 def user_auth_token nil end
user_id()
click to toggle source
# File lib/pandora/partner.rb, line 62 def user_id nil end