Google::Adwords::CountryTargets - Contains country targets


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

Index


Code Index:

NAME

Top

Google::Adwords::CountryTargets - Contains country targets

SYNOPSIS

Top

    use Google::Adwords::CountryTargets;

    my $targets = Google::Adwords::CountryTargets->new();
    $targets->countries([ 'US', 'IN' ]);




METHODS

Top

Mutators (read/write)

* countries

SEE ALSO

Top

* Google::Adwords::GeoTarget

AUTHOR

Top

Rohan Almeida <rohan@almeida.in>

LICENSE AND COPYRIGHT

Top


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

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

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

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

my @fields = qw/
    _countries
    _excludedCountries
    /;

__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

# countries should always return an array ref
sub countries
{
    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( '_countries', $put_ref );
        return $self;
    } # end if (@_)

    return $self->get('_countries');
} # end sub countries

# excludedCountries should always return an array ref
sub excludedCountries
{
    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( '_excludedCountries', $put_ref );
        return $self;
    } # end if (@_)

    return $self->get('_excludedCountries');
} # end sub excludedCountries

1;