NAME

Google::Adwords::AccountService - Interact with the Google Adwords AccountService API calls

VERSION

This documentation refers to Google::Adwords::AccountService version 0.2

SYNOPSIS

    use Google::Adwords::AccountService;
    use Google::Adwords::AccountInfo;
    use Google::Adwords::CoverageType;
    use Google::Adwords::EmailPromotionsPreferences;
    use Google::Adwords::CreditCard;
    use Google::Adwords::Address;

    my $service = Google::Adwords::AccountService->new();

    # login to the Adwords server
    $service->email($email)
            ->password($password)
            ->clientEmail($cemail)
            ->applicationToken($app_token)
            ->developerToken($dev_token);

    # getAccountInfo
    my $account = $service->getAccountInfo();
    print "currencyCode : " . $account->currencyCode . "\n";
    print "descriptiveName : " . $account->descriptiveName . "\n";

    # getClientAccounts
    my @emailaccounts = $service->getClientAccounts();
    print "getClientAccounts : " . join('|', @emailaccounts) . "\n";

    # getCreditCard
    my $creditcard      = $service->getCreditCard();

    # setLoginInfo
    my $ret_setlogininfo= $service->setLoginInfo('email@example.com', 'toto');

    # setLocalTimezone to brrr ...
    my $ret_setlocaltimezone = $service->setLocalTimezone('America/Anchorage');

    # setCreditCard
    my $cc = Google::Adwords::CreditCard->new
                    ->cardNumber(12345678912346)
                    ->cardType('VISA')
                    ->cardVerificationNumber(123)
                    ->expirationMonth(1)
                    ->expirationYear(2008);

    my $addr = Google::Adwords::Address->new
                    ->addressLine1('down the street')
                    ->city('Paris')
                    ->companyName('Up there')
                    ->countryCode('FR')
                    ->emailAddress('me@example.com')
                    ->name('Up there')
                    ->phoneNumber('+33112345678')
                    ->postalCode('75020');

    my $ret_setcreditcard = $service->setCreditCard($cc, $addr);
 
    # createAdWordsAccount
    my $emailPrefs = Google::Adwords::EmailPromotionsPreferences->new
                        ->marketResearchEnabled(1)
                        ->newsletterEnabled(1)
                        ->promotionsEnabled(0);

    my $covType = Google::Adwords::CoverageType->new
                        ->optInContentNetwork(0)
                        ->optInSearchNetwork(1);
    
    my $ret = $service->createAdWordsAccount({
        loginEmail  => $loginEmail, 
        password    => $password, 
        languagePreference => $lgPref, 
        emailPrefs  => $emailPrefs, 
        currencyCode => $curCode, 
        cardInfo => $creditcard, 
        contactInfo => $address, 
        defaultAdsCoverage => $covType, 
        timeZoneId => $timeZoneId
    });

    # updateAccountInfo
    $account->primaryBusinessCategory('Advertising, Marketing, SEO');
    my $ret_updateaccountinfo = $service->updateAccountInfo($account);

DESCRIPTION

This module provides an interface to the Google Adword AccountService API calls.

METHODS

createAdWordsAccount()

Description

    Create a new AdWords account for an online advertiser. If this operation succeeds, the new account is ready for use. Customers need explicit permission from Google to use this method.

Usage

        my $ret = $obj->createAdWordsAccount({
            loginEmail  => $loginEmail,
            password    => $password,
            languagePreference => $lgPref,
            emailPrefs  => $emailPrefs,
            currencyCode => $curCode,
            cardInfo => $creditcard,
            contactInfo => $address,
            defaultAdsCoverage => $coverageType,
            timeZoneId => $timeZoneId
        });

Parameters

Takes a hashref with following keys:

  • loginEmail : the login email.

  • password : the password.

  • languagePreference : the language preference.

  • emailPrefs : a Google::Adwords::EmailPromotionsPreferences object.

  • currencyCode : the currency code.

  • cardInfo : a Google::Adwords::CreditCard object.

  • contactInfo : a Google::Adwords::Address object.

  • defaultAdsCoverage : a Google::Adwords::CoverageType object.

  • timeZoneId : the id of the timezone.

Returns

    1 on success

getAccountInfo()

Description

    Return the AdWords account specified by the client account header.

Usage

         my $accountinfo = $obj->getAccountInfo();

Parameters

    None.

Returns

    A Google::Adwords::AccountInfo object.

getClientAccounts()

Description

    Gets the primary email address for each account managed by the effective user. If the effective user user has no client accounts, an empty array is returned.

Usage

        my @emails = $obj->getClientAccounts();

Parameters

    None.

Returns

    An array of account login emails.

getCreditCard()

Description

    Return credit card information for the current account.

Usage

        my $creditcard = $obj->getCreditCard();

Parameters

    None.

Returns

    A Google::Adwords::CreditCard object.

setCreditCard()

Description

    Set the credit card information for the current account.

Usage

        my $ret = $obj->setCreditCard($creditcard, $address);

Parameters

  • $creditcard : a Google::Adwords::CreditCard object.

  • $address : a Google::Adwords::Address object.

Returns

    1 on success

setLocalTimezone()

Description

    Set the local timezone for this Account.

Usage

        my $ret = $obj->setLocalTimezone($timezone);

Parameters

  • $timezone : the timezone.

Returns

    1 on success

setLoginInfo()

Description

    Set the login information for the current user.

Usage

        my $ret = $obj->setLoginInfo($login, $newPassword);

Parameters

  • $login : the login.

  • $newPassword : the password.

Returns

    1 on success

updateAccountInfo()

Description

    Updates the database to reflect the changes in the account object.

Usage

        my $ret = $obj->updateAccountInfo($account);

Parameters

  • $account : a Google::Adwords::AccountInfo object.

Returns

    1 on success

SEE ALSO

AUTHORS

Rohan Almeida <rohan@almeida.in>

Mathieu Jondet <mathieu@eulerian.com>

LICENCE AND COPYRIGHT

Copyright (c) 2006 Rohan Almeida <rohan@almeida.in>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.