-
-
02 Aug 2010 21:50:49 UTC
- Distribution: WebService-Gravatar
- Module version: 0.10
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (0)
- Testers (58 / 0 / 0)
- Kwalitee
Bus factor: 0- License: unknown
- Activity
24 month- Tools
- Download (4.72KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- RPC::XML::Client
- Test::More
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
WebService::Gravatar - Perl interface to Gravatar API
VERSION
Version 0.10
SYNOPSIS
WebService::Gravatar provides an interface to Gravatar XML-RPC API.
use WebService::Gravatar; # Create a new instance of WebService::Gravatar my $grav = WebService::Gravatar->new(email => '[email protected]', apikey => 'your_API_key'); # Get a list of addresses my $addresses = $grav->addresses; if (defined $addresses) { # Print the userimage URL for each e-mail address foreach my $email (keys %$addresses) { print $addresses->{$email}->{'userimage_url'} . "\n"; } } else { # We have a problem print STDERR "Error: " . $grav->errstr . "\n"; } # Read image file data my $data; { local $/ = undef; open(F, "< my_pretty_face.png"); $data = <F>; close(F); } # Save the image as a new userimage $grav->save_data(data => $data, rating => 0); ...
DESCRIPTION
WebService::Gravatar is a Perl interface to Gravatar API. It aims at providing a close representation of the basic XML-RPC API, as documented on Gravatar website: http://en.gravatar.com/site/implement/xmlrpc/. All the method names, parameter names, and data structures are the same as in the API -- the only exception is that in the API the methods are named with camelCase, while the module uses lowercase_with_infix_underscores.
METHODS
All the instance methods return
undef
on failure. More detailed error information can be obtained by calling "err" and "errstr".new
Creates a new instance of WebService::Gravatar.
my $grav = WebService::Gravatar->new(email => '[email protected]', apikey => 'your_API_key');
Parameters:
email
(Required) E-mail address.
apikey
(Required) API key. Can be ommitted if
password
is defined.password
(Required) Account password. Can be ommitted if
apikey
is defined.
exists
Checks whether a hash has a gravatar.
$result = $grav->exists(hashes => ['e52beb5a6966554a02a56072cafebabe', '62345cdd79773f62a87fcbc6abadbabe'])
Parameters:
hashes
(Required) An array of email hashes to check.
Returns: A reference to a hash that maps email hashes to statuses. Example:
$result = { 'e52beb5a6966554a02a56072cafebabe' => '1', '62345cdd79773f62a87fcbc6abadbabe' => '0' };
addresses
Gets a list of addresses for this account.
$addresses = $grav->addresses;
Returns: A reference to a hash that maps addresses to userimage data. Example:
$addresses = { '[email protected]' => { 'rating' => '0', 'userimage' => '8bfc8da2562a53ddd7e630a68badf00d', 'userimage_url' => 'http://en.gravatar.com/userimage/123456/8bfc8da2562a53ddd7e630a68badf00d.jpg' }, '[email protected]' => { 'rating' => '1', 'userimage' => '90f269fe7b67d0ce49f96427deadbabe', 'userimage_url' => 'http://en.gravatar.com/userimage/123456/90f269fe7b67d0ce49f96427deadbabe.jpg' } };
userimages
Gets a list of userimages for this account.
$userimages = $grav->userimages;
Returns: A reference to a hash that maps userimages to data. Example:
$userimages = { '8bfc8da2562a53ddd7e630a68badf00d' => [ '0', 'http://en.gravatar.com/userimage/123456/8bfc8da2562a53ddd7e630a68badf00d.jpg' ], '90f269fe7b67d0ce49f96427deadbabe' => [ '1', 'http://en.gravatar.com/userimage/123456/90f269fe7b67d0ce49f96427deadbabe.jpg' ] };
save_data
Saves binary image data as a userimage for this account.
$grav->save_data(data => $data, rating => 1);
Parameters:
data
(Required) A base64 encoded image.
rating
(Required) Rating.
Returns: Userimage string.
save_url
Reads an image via its URL and saves that as a userimage for this account.
$grav->save_url(url => 'http://some.domain.com/image.png', rating => 0);
Parameters:
url
(Required) A full URL to an image.
rating
(Required) Rating.
Returns: Userimage string.
use_userimage
Uses the specified userimage as a gravatar for one or more addresses on this account.
$grav->use_userimage(userimage => '9116aa83a568563290a681df61c0ffee'. addresses => ['[email protected]', '[email protected]']);
Parameters:
userimage
(Required) The userimage to be used.
addresses
(Required) An array of email addresses for which this userimage will be used.
Returns: 1 on success, undef on failure.
remove_image
Removes the userimage associated with one or more email addresses.
$result = $grav->remove_image(addresses => ['[email protected]', '[email protected]'])
Parameters:
addresses
(Required) An array of email addresses to remove userimages for.
Returns: A reference to a hash that maps email addresses to statuses. Example:
result = { '[email protected]' => 1, '[email protected]' => 0 };
delete_userimage
Removes a userimage from the account and any email addresses with which it is associated.
$grav->delete_userimage(userimage => '292ed56ce849657d47b04105deadbeef');
Parameters:
userimage
(Required) The userimage to be removed from the account.
Returns: 1 on success, undef on failure.
test
API test method.
$result = $grav->test(param => 1);
Returns: A reference to a hash which represents the parameters passed to the test method.
err
Returns the numeric code of last error.
$err_code = $grav->err;
errstr
Returns the human readable text for last error.
$err_description = $grav->errstr;
AUTHOR
Michal Wojciechowski,
<odyniec at cpan.org>
BUGS
Please report any bugs or feature requests to
bug-webservice-gravatar at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WebService-Gravatar. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.SUPPORT
You can find documentation for this module with the perldoc command.
perldoc WebService::Gravatar
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WebService-Gravatar
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
COPYRIGHT & LICENSE
Copyright 2010 Michal Wojciechowski, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Gravatar XML-RPC API Documentation
Module Install Instructions
To install WebService::Gravatar, copy and paste the appropriate command in to your terminal.
cpanm WebService::Gravatar
perl -MCPAN -e shell install WebService::Gravatar
For more information on module installation, please visit the detailed CPAN module installation guide.