Google::Adwords::AdSchedule - A Google Adwords AdSchedule object.


Google-Adwords documentation Contained in the Google-Adwords distribution.

Index


Code Index:

NAME

Top

Google::Adwords::AdSchedule - A Google Adwords AdSchedule object.

VERSION

Top

This documentation refers to Google::Adwords::AdSchedule version 0.0.1

SYNOPSIS

Top

    # Create the Campaign object
    my $campaign = Google::Adwords::Campaign->new();

    # Campaign Details
    $campaign->name('Campaign with an Ad Schedule');
    $campaign->dailyBudget(100000);
    $campaign->languageTargeting({
        languages => 'en',
    });

    # Ad schedule
    my $schedule1 = Google::Adwords::SchedulingInterval->new();
    $schedule1->day('Monday')
              ->startHour(1)
              ->endHour(10)
              ->multiplier(1)
    ;

    my $ad_schedule = Google::Adwords::AdSchedule->new();
    $ad_schedule->status('Enabled');
    $ad_schedule->intervals([ $schedule1 ]);

    # Associate the Ad Schedule with the Campaign
    $campaign->schedule($ad_schedule);




DESCRIPTION

Top

This object should be used with the CampaignService API calls

METHODS

Top

Mutators (read/write)

* intervals - An arrayref of Google::Adwords::SchedulingInterval objects

* status - Values of 'Enabled' or 'Disabled'

SEE ALSO

Top

* Google::Adwords::CampaignService
* Google::Adwords::SchedulingInterval

AUTHOR

Top

Rohan Almeida <rohan@almeida.in>

LICENSE AND COPYRIGHT

Top


Google-Adwords documentation Contained in the Google-Adwords distribution.

package Google::Adwords::AdSchedule;
use strict;
use warnings;

use version; our $VERSION = qv('0.0.1');

use base 'Google::Adwords::Data';

my @fields = qw/
    _intervals
    status
    /;

__PACKAGE__->mk_accessors(@fields);

sub new
{
    my $proto = shift;

    my $class = ref $proto || $proto;

    if (@_)
    {
        my $obj     = $class->SUPER::new();
        my $hashref = shift;
        for ( keys %{$hashref} )
        {
            $obj->$_( $hashref->{$_} );
        }
        return $obj;
    }
    else
    {
        return $class->SUPER::new();
    }
} # end sub new

# intervals should always return an array ref
sub intervals
{
    my $self = shift;

    # if its a put
    if (@_)
    {
        my $put_ref = [];

        for (@_)
        {
            if ( ref $_ ne 'ARRAY' )
            {
                push @{$put_ref}, $_;
            }
            else
            {
                push @{$put_ref}, @{$_};
            }
        }

        $self->set( '_intervals', $put_ref );
        return $self;
    } # end if (@_)

    return $self->get('_intervals');
} # end sub intervals

1;