NAME
WebService::GData::Query - implements the basic query parameters available in the google data API v2.
VERSION
0.01
SYNOPSIS
use WebService::GData::Query;
#create an object that only has read access
my $query = new WebService::GData::Query();
$query->to_query_string();# by default:?alt=json&v=2&prettyprint=true&strict=true
#?alt=json-c&v=2&prettyprint=true&strict=true&start-index=1&max-results=10
$query->alt('json-c')->limit(10,1)->to_query_string();
print $query->get('alt');#json-c
DESCRIPTION
inherits from WebService::GData;
Google data API supports searching the different services via a common set of parameters.
This package implements some helpers functions.
The parameters set are not checked for validity, meaning that you could build unproper requests.
Most of the time, you will receive an error from the service.
The package will be expanded to offer data validation. It should therefore avoid unnecessary network transactions and
reduce the risk of reaching quota limitations in use for the service you are querying.
GENERAL METHODS
new
Creates a basic query instance.
The following parameters are set by default:
- alt is set to json
- v is set to 2
- prettyprint is set to true
- strict is set to true
Example:
use WebService::GData::Query;
#create an object that only has read access
my $query = new WebService::GData::Query();
$query->to_query_string();# by default:?alt=json&v=2&prettyprint=true&strict=true
get
Returns the parameter specified
Example:
use WebService::GData::Query;
#create an object that only has read access
my $query = new WebService::GData::Query();
$query->get('alt');#json
to_query_string
Returns the query string representation of the object.
Example:
use WebService::GData::Query;
#create an object that only has read access
my $query = new WebService::GData::Query();
$query->to_query_string();#?alt=json&v=2&prettyprint=true&strict=true
PARAMETER METHODS
All the methods that set a parameter return the object itself so that you can chain them.
Example: $query->alt('json-c')->limit(10,1)->strict('true')->prettyprint('false')->to_query_string();
The following setters are available:
strict
If set to true (default), setting a parameter not supported by a service will fail the request.
fields
Allows you to query partial data.
This is a Google data experimental feature as of this version.
Example:
use WebService::GData::Query;
#create an object that only has read access
my $query = new WebService::GData::Query();
$query->fields('id,entry(author)');#only get the id and the author in the entry tag
v
Set the google Data API version number. Default to 2.
WebService::GData related packages require a version number superior or equal to 2.
alt
Specify the response format used. Default to json.
WebService::GData related packages require the response to be in json if you use the Feed related packages.
Possible values: json,jsonc,atom,rss
prettyprint
If set to true (default false),the result from the service will contain indentation.
author
specify the author of the contents you are retrieving.
Each service derives the meaning for their own feed and it may vary accordingly.
updated_min
Retrieve the contents which update date is a minimum equal to the one specified (inclusive).
Note that you should retrieve the value as 'updated-min' when used with get().
Format:2005-08-09T10:57:00-08:00
updated_max
Retrieve the contents which update date is at maximum equal to the one specified (exclusive).
Note that you should retrieve the value as 'updated-max' when used with get().
Format:2005-08-09T10:57:00-08:00
published_min
Retrieve the contents which publish date is a minimum equal to the one specified (inclusive).
Note that you should retrieve the value as 'published-min' when used with get().
Format:2005-08-09T10:57:00-08:00
published_max
Retrieve the contents which publish date is a maximum equal to the one specified (exclusive).
Note that you should retrieve the value as 'published-max' when used with get().
Format:2005-08-09T10:57:00-08:00
start_index
Retrieve the contents starting from a certain result. Start from 1.
Setting 0 will revert to 1.
Note that you should retrieve the value as 'start-index' when used with get().
max_results
Retrieve the contents up to a certain amount of entry (Most of the services set it to 25 by default).
Note that you should retrieve the value as 'max-results' when used with get().
limit (limit,offset)
An extension that allows you to set start_index and max_results in one method call:
get('limit') will return undef.
Example:
use WebService::GData::Query;
#create an object that only has read access
my $query = new WebService::GData::Query();
$query->limit(10,5);
#equivalent to
$query->max_results(10)->start_index(5);
q
insensitive freewords search where:
words in quotation means exact match:"word1 word2"
words separated by a space means AND:word1 word2
words prefixed with an hyphen means NOT(containing):-word1
Example:
use WebService::GData::Query;
#create an object that only has read access
my $query = new WebService::GData::Query();
$query->q('"exact phrase" snowbaord sports -ski');
q
insensitive freewords search where:
words in quotation means exact match:"word1 word2"
words separated by a space means AND:word1 word2
words prefixed with an hyphen means NOT(containing):-word1
Example:
use WebService::GData::Query;
#create an object that only has read access
my $query = new WebService::GData::Query();
$query->q('"exact phrase" snowbaord sports -ski');
category
look up for specifics categories
words in quotation means exact match:"word1 word2"
words separated by a comma(,) means AND:word1,word2
words separated by a pipe(|) means OR:word1|word2
Example:
use WebService::GData::Query;
#create an object that only has read access
my $query = new WebService::GData::Query();
$query->q('"exact phrase" snowbaord sports -ski');
SEE ALSO
Documentation of the parameters:
http://code.google.com/intl/en/apis/gdata/docs/2.0/reference.html#Queries
CONFIGURATION AND ENVIRONMENT
none
DEPENDENCIES
none
INCOMPATIBILITIES
none
BUGS AND LIMITATIONS
If you do me the favor to _use_ this module and find a bug, please email me i will try to do my best to fix it (patches welcome)!
AUTHOR
shiriru <shiriru0111[arobas]hotmail.com>
LICENSE AND COPYRIGHT
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
19 POD Errors
The following errors were encountered while parsing the POD:
- Around line 175:
You forgot a '=back' before '=head2'
- Around line 190:
You forgot a '=back' before '=head2'
- Around line 205:
You forgot a '=back' before '=head1'
- Around line 221:
You forgot a '=back' before '=head2'
- Around line 238:
You forgot a '=back' before '=head2'
- Around line 247:
You forgot a '=back' before '=head2'
- Around line 258:
You forgot a '=back' before '=head2'
- Around line 264:
You forgot a '=back' before '=head2'
- Around line 272:
You forgot a '=back' before '=head2'
- Around line 282:
You forgot a '=back' before '=head2'
- Around line 292:
You forgot a '=back' before '=head2'
- Around line 302:
You forgot a '=back' before '=head2'
- Around line 312:
You forgot a '=back' before '=head2'
- Around line 322:
You forgot a '=back' before '=head2'
- Around line 330:
You forgot a '=back' before '=head2'
- Around line 349:
You forgot a '=back' before '=head2'
- Around line 370:
You forgot a '=back' before '=head2'
- Around line 392:
You forgot a '=back' before '=head2'
- Around line 413:
You forgot a '=back' before '=head1'