API-Instagram
view release on metacpan or search on metacpan
Date : 2014-08-27 00:20:02 +0000
Tests reorganized
Change: 18d4c00985ef334e019f94be9d2d7a1bfd00764e
Author: Gabriel Vieira <gabriel.vieira@gmail.com>
Date : 2014-08-26 23:16:30 +0000
Starting version 0.012. Add popular_medias method to API::Instagram.
Some methods do not require token anymore (as Instagram API Docs
describes). Add relatioship get/set method to API::Instagramm::User.
Change: 3e4383545f6a505294ff8a4eb0ed754e4720cd04
Author: Gabriel Vieira <gabriel.vieira@gmail.com>
Date : 2014-08-23 12:07:07 +0000
The Object is created via 'new' again, instance is a new method.
Removed MooX::Singleton dependencie. Starting version 0.011
Change: 4436d8ec5c7eca17222ed619716760f1307c1309
Author: Gabriel Vieira <gabriel.vieira@gmail.com>
% cpanm API::Instagram
If you are installing into a system-wide directory, you may need to pass the
"-S" flag to cpanm, which uses sudo to install the module:
% cpanm -S API::Instagram
## Installing with the CPAN shell
Alternatively, if your CPAN shell is set up, you should just be able to do:
% cpan API::Instagram
## Manual installation
As a last resort, you can manually install it. Download the tarball, untar it,
then build it:
% perl Makefile.PL
% make && make test
registered to your application. See
<http://instagram.com/developer/clients/manage/>.
"scope" is the scope of access. See
<http://instagram.com/developer/authentication/#scope>.
"response_type" and "granty_type" do no vary. See
<http://instagram.com/developer/authentication/>.
By default, API::Instagram caches created objects to avoid duplications.
You can disable this feature setting a true value to "no_chace"
parameter.
instance
my $instagram = API::Instagram->instance;
print $instagram->user->full_name;
or
my $instagram = API::Instagram->instance({
client_id => $client_id,
lib/API/Instagram.pm view on Meta::CPAN
# Returns if CODE is not optional and not defined or if it's not a string
return if (!$optional_code and !defined $code) or ref $code;
# Code used as cache key
my $cache_code = md5_hex( $code // $data);
# Returns cached value or creates a new object
my $return = $self->_cache($type)->{$cache_code} //= ("API::Instagram::$type")->new( $data );
# Deletes cache if no-cache is set
delete $self->_cache($type)->{$cache_code} if $self->no_cache;
return $return;
}
###################################
# Returns a list of Media Objects #
###################################
sub _medias {
my ($self, $url, $params, $opts) = @_;
lib/API/Instagram.pm view on Meta::CPAN
Returns an L<API::Instagram> object.
Set C<client_id>, C<client_secret> and C<redirect_uri> with the ones registered
to your application. See L<http://instagram.com/developer/clients/manage/>.
C<scope> is the scope of access. See L<http://instagram.com/developer/authentication/#scope>.
C<response_type> and C<granty_type> do no vary. See L<http://instagram.com/developer/authentication/>.
By default, L<API::Instagram> caches created objects to avoid duplications. You can disable
this feature setting a true value to C<no_chace> parameter.
=head2 instance
my $instagram = API::Instagram->instance;
print $instagram->user->full_name;
or
my $instagram = API::Instagram->instance({
client_id => $client_id,
lib/API/Instagram/Media.pm view on Meta::CPAN
=head2 likes
printf "Total Likes: %d\n", $media->likes; # Total likes when object was created
or
printf "Total Likes: %d\n", $media->likes(1); # Up to date total likes
Returns media total likes.
If you set C<1> as parameter it will renew all media data and return an up-do-date total likes.
Note: C<1> as parameter also updates total comments, last likes and last comments.
=head2 last_likes
for my $user ( @{ $media->last_likes } ) {
say $user->username;
}
Returns a list of C<API::Instagram::User> of the last users who liked the media.
If you set C<1> as parameter it will renew all media data and return an up-do-date list.
Note: C<1> as parameter also updates total likes, total comments and last comments.
=head2 get_likes
my @likers = $media->get_likes( count => 5 );
Returns a list of L<API::Instagram::User> objects of users who liked the media.
Accepts C<count>.
lib/API/Instagram/Media.pm view on Meta::CPAN
=head2 comments
printf "Total Comments: %d\n", $media->comments; # Total comments when object was created
or
printf "Total Comments: %d\n", $media->comments(1); # Up to date total comments
Returns media total comments.
If you set C<1> as parameter it will renew all media data and return an up-do-date total comments.
Note: C<1> as parameter also updates total likes, last likes and last comments.
=head2 last_comments
for my $comment ( @{ $media->last_comments } ) {
printf "%s: %s\n", $comment->from->username, $comment->text;
}
Returns a list of C<API::Instagram::Media::Comment> of the last comments on the media.
If you set C<1> as parameter it will renew all media data and return an up-do-date list.
Note: C<1> as parameter also updates total likes, total comments and last likes.
=head2 get_comments
my @comments = $media->get_comments( count => 5 );
Returns a list of L<API::Instagram::Media::Comment> objects of the media.
Accepts C<count>.
( run in 1.024 second using v1.01-cache-2.11-cpan-e1769b4cff6 )