Flickr-API
view release on metacpan or search on metacpan
lib/Flickr/API.pm view on Meta::CPAN
}
my $ac_rc = $api->oauth_access_token(\%request_token);
if ( $ac_rc eq 'ok' ) {
$api->export_storable_config($config_file);
my $response = $api->execute_method('flickr.auth.oauth.checkToken');
my $hash_ref = $response->as_hash();
$response = $api->execute_method('flickr.prefs.getPrivacy');
my $rsp_node = $response->as_tree();
}
=head2 The OAuth authorization uri will look something like:
https://api.flickr.com/services/oauth/authorize?oauth_token=12345678901234567-890abcdefedcba98&perms=read
=head2 The callback is called with a token and verifier such as:
https://127.0.0.1/?oauth_token=12345678901234567-890abcdefedcba98&oauth_verifier=cafe12345678feed
t/06-flickr-authenticated-methods.t view on Meta::CPAN
$rsp = $api->execute_method('flickr.test.login', {auth_token => $api->{fauth}->{token}});
$ref = $rsp->as_hash();
is($ref->{stat}, 'ok', "Did flickr.test.login complete sucessfully");
isnt($ref->{user}->{id}, undef, "Did flickr.test.login return id");
isnt($ref->{user}->{username}, undef, "Did flickr.test.login return username");
$rsp = $api->execute_method('flickr.prefs.getPrivacy', {auth_token => $api->{fauth}->{token}});
$ref = $rsp->as_hash();
is($ref->{stat}, 'ok', "Did flickr.prefs.getPrivacy complete sucessfully");
isnt($ref->{person}->{nsid}, undef, "Did flickr.prefs.getPrivacy return nsid");
isnt($ref->{person}->{privacy}, undef, "Did flickr.prefs.getPrivacy return privacy");
}
}
exit;
__END__
t/06-oauth-authenticated-methods.t view on Meta::CPAN
'Did flickr.test.login return id'
);
isnt(
$ref->{user}->{username},
undef,
'Did flickr.test.login return username'
);
$rsp = $api->execute_method('flickr.prefs.getPrivacy');
$ref = $rsp->as_hash;
is(
$ref->{stat},
'ok',
'Did flickr.prefs.getPrivacy complete sucessfully'
);
isnt(
$ref->{person}->{nsid},
undef,
'Did flickr.prefs.getPrivacy return nsid'
);
isnt(
$ref->{person}->{privacy},
undef,
'Did flickr.prefs.getPrivacy return privacy'
);
}
}
exit;
__END__
( run in 0.957 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )