Class: Pandora::User

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Client
Defined in:
lib/pandora/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(partner, username, password) ⇒ User

Returns a new instance of User.



16
17
18
19
# File 'lib/pandora/user.rb', line 16

def initialize(partner, username, password)
  @partner, @username, @password = partner, username, password
  
end

Instance Attribute Details

#partnerObject (readonly)

Returns the value of attribute partner.



10
11
12
# File 'lib/pandora/user.rb', line 10

def partner
  @partner
end

#passwordObject (readonly)

Returns the value of attribute password.



10
11
12
# File 'lib/pandora/user.rb', line 10

def password
  @password
end

#user_auth_tokenObject (readonly)

Returns the value of attribute user_auth_token.



11
12
13
# File 'lib/pandora/user.rb', line 11

def user_auth_token
  @user_auth_token
end

#user_idObject (readonly)

Returns the value of attribute user_id.



11
12
13
# File 'lib/pandora/user.rb', line 11

def user_id
  @user_id
end

#usernameObject (readonly)

Returns the value of attribute username.



10
11
12
# File 'lib/pandora/user.rb', line 10

def username
  @username
end

Instance Method Details

#marshal_dumpObject



32
33
34
# File 'lib/pandora/user.rb', line 32

def marshal_dump
  [@partner, @username, @password, @user_auth_token, @user_id]
end

#marshal_load(objects) ⇒ Object



36
37
38
# File 'lib/pandora/user.rb', line 36

def marshal_load(objects)
  @partner, @username, @password, @user_auth_token, @user_id = objects
end

#reauthenticateObject



21
22
23
24
# File 'lib/pandora/user.rb', line 21

def reauthenticate
  @partner.reauthenticate
  
end

#stationsObject



26
27
28
29
30
# File 'lib/pandora/user.rb', line 26

def stations
  call('user.getStationList')['stations'].map do |station_data|
    Station.new(self, station_data)
  end
end