-
-
11 Oct 2011 09:07:49 UTC
- Distribution: Google-Plus
- Module version: 0.004
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues
- Testers (317 / 0 / 13)
- Kwalitee
Bus factor: 1- 25.45% Coverage
- License: perl_5
- Perl: v5.10.1
- Activity
24 month- Tools
- Download (12.28KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
++ed by:1 non-PAUSE userNAME
Google::Plus - simple interface to Google+
SYNOPSIS
use Google::Plus; use v5.10.1; my $plus = Google::Plus->new(key => $your_gplus_api_key); # get a person's profile my $user_id = '112708775709583792684'; my $person = $plus->person($user_id); say "Name: ", $person->{displayName}; # get this person's activities my $activities = $plus->activities($user_id); while ($activities->{nextPageToken}) { my $next = $activities->{nextPageToken}; for my $item (@{$activities->{items}}) { ...; } $activities = $plus->activities($user_id, $next); } # get a specific activity my $post = 'z13uxtsawqqwwbcjt04cdhsxcnfyir44xeg'; my $act = $plus->activity($post); say "Activity: ", $act->{title};
DESCRIPTION
This module lets you access Google+ people profiles and activities from Perl. Currently, only access to public data is supported; authenticated requests for
me
and other private data will follow in a future release.This module is alpha software, use at your own risk.
ATTRIBUTES
key
my $key = $plus->key; my $key = $plus->key('xxxxNEWKEYxxxx');
Google+ API key, used for retrieving content. Usually set using "new".
ua
my $ua = $plus->ua; my $ua = $plus->ua(Mojo::UserAgent->new);
User agent object that retrieves JSON from the Google+ API endpoint. Defaults to a Mojo::UserAgent object. This object will use HTTP/HTTPS proxies when available (via
HTTP_PROXY
andHTTPS_PROXY
environment variables.)METHODS
Google::Plus implements the following methods:
new
my $plus = Google::Plus->new(key => $google_plus_api_key);
Construct a new Google::Plus object. Needs a valid Google+ API key, which you can get at https://code.google.com/apis/console.
person
my $person = $plus->person('userId'); my $person = $plus->person('userId', 'fields');
Get a Google+ person's public profile. Returns a Mojo::JSON decoded hashref describing the person's profile in Portable Contacts format. If
fields
is given, limit response to the specified fields; see the Partial Responses section of https://developers.google.com/+/api.activities
my $acts = $plus->activities('userId'); my $acts = $plus->activities('userId', 'collection'); my $acts = $plus->activities('userId', 'collection', nextPage'); my $acts = $plus->activities('userId', 'collection', nextPage', 'fields');
Get person's list of public activities, returning a Mojo::JSON decoded hashref describing the person's activities in Activity Streams format; this method also accepts requesting partial responses if
fields
is given. Ifcollection
is given, use that as the collection of activities to list; the default is to listpublic
activities instead. If anextPage
token is given, this method retrieves the next page of activities this person has.activity
my $post = $plus->activity('activityId') my $post = $plus->activity('activityId', fields');
Get a specific activity/post. Returns a Mojo::JSON decoded hashref describing the activity in Activity Streams format. If
fields
is given, limit response to specified fields.SEE ALSO
DEVELOPMENT
This project is hosted on Github, at https://github.com/zakame/perl-google-plus. Post issues to CPAN RT.
AUTHOR
Zak B. Elep,
zakame@cpan.org
COPYRIGHT AND LICENSE
This software is Copyright (c) 2011, Zak B. Elep.
This is free software, you can redistribute it and/or modify it under the same terms as Perl language system itself.
Module Install Instructions
To install Google::Plus, copy and paste the appropriate command in to your terminal.
cpanm Google::Plus
perl -MCPAN -e shell install Google::Plus
For more information on module installation, please visit the detailed CPAN module installation guide.