NAME

WebService::Pandora::Partner - Pandora WebService API Partner

SYNOPSIS

# creating a new Partner object

package WebService::Pandora::Partner::MyPartner;

use base 'WebService::Pandora::Partner';

sub new {

  my $caller = shift;

  my $class = ref( $caller );
  $class = $caller if ( !$class );

  my $self = $class->SUPER::new( username => 'username',
                                 password => 'password',
                                 deviceModel => 'model',
                                 decryption_key => 'key',
                                 encryption_key => 'key',
                                 host => 'tuner.pandora.com' );

  return $self;
}

# using a partner object

$partner = WebService::Pandora::Partner::MyPartner->new();
$result = $partner->login() or die( $partner->error() );

DESCRIPTION

This module is a base class that should be inherited and not used directly. When logging in to the Pandora API, you must first login using a particular partner, such as an Apple iOS or Android device. Each partner has its own credentials and encryption/decryption keys, and some use different HTTP hosts than others to query the API. The WebService::Pandora package provides modules for several known partners and will default to using WebService::Pandora::Partner::iOS if one isn't provided.

CONSTRUCTOR

new

Creates a new WebService::Pandora::Partner object with the arguments given. All of the options are required and used by the login() method.

username => STRING [required]

The username of the partner to use when logging in.

password => STRING [required]

The password of the partner to use when logging in.

deviceModel => STRING [required]

The device model name to use when logging in.

encryption_key => STRING [required]

The encryption key to use when encrypting the JSON data being sent to the Pandora API method.

decryption_key => STRING [required]

The decryption key to use when decrypting the JSON data send back from the Pandora API method.

host => STRING [required]

The host portion of the URL to use when issuing the HTTP request to the Pandora API method.

METHODS

login

Returns a hashref containing the information from the login request when the login was successful, or a false value on failure. Internally, this will execute the auth.partnerLogin Pandora API method using the WebService::Pandora::Method library.

$result = $partner->login() or die( $partner->error() );

error

Returns a string containing a message about why the login call failed. The error string may come from internally in the module, from a failed HTTP request, or from the Pandora API itself.

SEE ALSO

WebService::Pandora WebService::Pandora::Method

AUTHOR

Mitch McCracken <mrmccrac@gmail.com>