API-Instagram

 view release on metacpan or  search on metacpan

lib/API/Instagram.pm  view on Meta::CPAN

			client_id     => $client_id,
			client_secret => $client_secret,
			redirect_uri  => 'http://localhost',
			scope         => 'basic',
			response_type => 'code',
			granty_type   => 'authorization_code',
			no_cache      => 1,
	});

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,
			client_secret => $client_secret,
			redirect_uri  => 'http://localhost',
	});

Returns the singleton instance of L<API::Instagram>.

Note: if no instance was created before, creates a new L<API::Instagram> object initialized with arguments provided and then returns it.

=head2 get_auth_url

	my $auth_url = $instagram->get_auth_url;
	print $auth_url;

Returns an Instagram authorization URL.

=head2 get_access_token

	my $access_token = $instagram->get_access_token;

	or

	my ( $access_token, $auth_user ) = $instagram->get_access_token;

Returns the access token string if the context is looking for a scalar, or an
array containing the access token string and the authenticated user
L<API::Instagram::User> object if looking for a list value.

=head2 media

	my $media = $instagram->media( $media_id );
	say $media->type;

Get information about a media object. Returns an L<API::Instagram::Media> object.

=head2 user

	my $me = $instagram->user; # Authenticated user
	say $me->username;

	my $user = $instagram->user( $user_id );
	say $user->full_name;

Get information about an user. Returns an L<API::Instagram::User> object.

=head2 location

	my $location = $instagram->location( $location_id );
	say $location->name;

Get information about a location. Returns an L<API::Instagram::Location> object.

=head2 tag

	my $tag = $instagram->tag('perl');
	say $tag->media_count;

Get information about a tag. Returns an L<API::Instagram::Tag> object.

=head2 search

	my $search = $instagram->search('user');
	my $users = $search->find( q => 'larry' );
	for my $user ( @$users ) {
		say $user->username;
	}

Returns an L<API::Instagram::Search> object, capable to search for the given B<type>.

Where B<type> can be: C<user>, C<media>, C<tag> or C<location>.

See L<API::Instagram::Search> for more details and examples.

=head2 popular_medias

	my $medias = $user->popular_medias( count => 3 );
	print $_->caption . $/ for @$medias;

Returns a list of L<API::Instagram::Media> objects of Instagram most popular media at the moment.

=head1 AUTHOR

Gabriel Vieira <gabriel.vieira@gmail.com>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Gabriel Vieira.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut



( run in 0.550 second using v1.01-cache-2.11-cpan-5623c5533a1 )