NAME

WWW::Google::API::Base - Perl client to the Google Base API <http://code.google.com/apis/base/>

VERSION

version 0.001

$Id$

SYNOPSIS

use WWW::Google::API::Base;

my $file_conf = LoadFile($ENV{HOME}.'/.gapi');

my $api_key  = $ENV{gapi_key};
my $api_user = $ENV{gapi_user};
my $api_pass = $ENV{gapi_pass};

my $gbase = WWW::Google::API::Base->new( { auth_type => 'ProgrammaticLogin',
                                           api_key   => $api_key,
                                           api_user  => $api_user,
                                           api_pass  => $api_pass  },
                                         { } );

METHODS

insert

$insert_entry = $gbase->insert( 
  'http://www.google.com/base/feeds/itemtypes/en_US/Recipes',
  { -title      => 'He Jingxian\'s chicken',
    -content    => "<div xmlns='http://www.w3.org/1999/xhtml'>Delectable Sichuan specialty</div>",
    -link       => [ 
      { rel  => 'alternate',
        type => 'text/html',
        href => 'http://localhost/uniqueid'
      },
    ],
    cooking_time    => 30,
    label           => [qw(foo bar baz)],
    main_ingredient => [qw(chicken chili peanuts)],
    servings        => 5,
  },
);

$new_id = $insert_entry->id;

update

$update_entry = $gbase->update( 
  $new_id,
  { -title      => 'He Jingxian\'s chicken',
    -content    => "<div xmlns='http://www.w3.org/1999/xhtml'>Delectable Sichuan specialty</div>",
    -link       => [ 
      { rel  => 'alternate',
        type => 'text/html',
        href => 'http://localhost/uniqueid'
      },
    ],
    cooking_time    => 60,
    label           => [qw(fio bir biz)],
    main_ingredient => [qw(chicken chili peanuts)],
    servings        => 15,
  },
);

delete

my $delete_response;
eval {
  $delete_response =$gbase->delete($new_id);
};
if ($@) { 
  my $e = $@;
  die $e->status_line;  # HTTP::Response
}

die "Successfully deleted if $delete_response->code == 200; # HTTP::Response

select

Currently only supports querying by id

my $select_inserted_entry;
eval {
  $select_inserted_entry =$gbase->select($new_id);
};
if ($@) {
  my $e = $@;
  die $e->status_line;  # HTTP::Response
}