| 1 |
|
| 2 |
====================== |
| 3 |
Flickr::API Subclasses |
| 4 |
====================== |
| 5 |
|
| 6 |
The Flickr::API has a number of derived subclasses to aid in the |
| 7 |
use of the various sections of Flickr's API as described on |
| 8 |
https://www.flickr.com/services/api/ |
| 9 |
|
| 10 |
|
| 11 |
A NOTE ON TESTING |
| 12 |
|
| 13 |
These subclasses rely on an existing OAuth configuration as is used by |
| 14 |
earlier tests. When you test them, you will need to have done the `make test' |
| 15 |
with MAKETEST_OAUTH_CFG=config_file specified. |
| 16 |
|
| 17 |
|
| 18 |
A NOTE ON AUTHENTICATION |
| 19 |
|
| 20 |
Flickr::API subclasses don't use Flickr's original (deprecated) |
| 21 |
authentication. You will need to use OAuth. On the other hand, |
| 22 |
some methods don't require authentication, just changing key to |
| 23 |
consumer_key and secret to consumer_secret should work on these. |
| 24 |
|
| 25 |
|
| 26 |
The Flickr::API is derived from LWP::UserAgent. It adds three main |
| 27 |
keys to the LWP::UserAgent: $self->{flickr}, $self->{oauth} and |
| 28 |
$self->{fauth}. The oauth key contains the key/value pairs needed |
| 29 |
to handle Flickr's OAuth authentication. An OAuth section will look |
| 30 |
something like: |
| 31 |
|
| 32 |
'oauth' => { |
| 33 |
'token' => '12345678909876543-b77c2eface79e3d3', |
| 34 |
'signature_method' => 'HMAC-SHA1', |
| 35 |
'request_method' => 'GET', |
| 36 |
'consumer_key' => '123beeffaceade94a0a3611ca1f5a5e0', |
| 37 |
'access_token' => bless( { |
| 38 |
'token_secret' => 'beefcafe349be12d', |
| 39 |
'token' => '12345678909876543-b77c2eface79e3d3', |
| 40 |
'extra_params' => { |
| 41 |
'fullname' => 'ASCII, Character', |
| 42 |
'user_nsid' => '1234567890@N00', |
| 43 |
'username' => 'abcdefg' |
| 44 |
}, |
| 45 |
'from_hash' => 1 |
| 46 |
}, 'Net::OAuth::AccessTokenResponse' ), |
| 47 |
'consumer_secret' => '64beefca1f7eecad', |
| 48 |
'request_url' => 'https://api.flickr.com/services/rest/', |
| 49 |
'callback' => 'https://127.0.0.1', |
| 50 |
'nonce' => '3c0f553fa1eba3b1c62cfabf2ee9afaa', |
| 51 |
'timestamp' => 1438806177, |
| 52 |
'version' => '1.0', |
| 53 |
'token_secret' => 'beefcafe349be12d' |
| 54 |
} |
| 55 |
|
| 56 |
The fauth key contains the key/value pairs needed to handle Flickr's |
| 57 |
(original but deprecated) authentication. An FAuth section will look |
| 58 |
something like: |
| 59 |
|
| 60 |
'fauth' => { |
| 61 |
'frob' => '34567890987654321-78faced1b7e8eda3-1234542', |
| 62 |
'token' => '12345678909876543-42b0ceded01f65f5', |
| 63 |
'secret' => '64beefca1f7eecad', |
| 64 |
'key' => '123beeffaceade94a0a3611ca1f5a5e0' |
| 65 |
}, |
| 66 |
|
| 67 |
The flickr key contains everything else Flickr. This is where values |
| 68 |
used by the various classes derived from Flickr::API will be stored. |
| 69 |
|
| 70 |
|
| 71 |
'flickr' => { |
| 72 |
'status' => { |
| 73 |
'_rc' => 0, |
| 74 |
'error_code' => 0, |
| 75 |
'success' => 1, |
| 76 |
'error_message' => '' |
| 77 |
} |
| 78 |
}, |
| 79 |
|
| 80 |
|
| 81 |
In addition, and to help maintain continuity with earlier versions, |
| 82 |
the following individual keys are used in the Flickr::API |
| 83 |
|
| 84 |
|
| 85 |
'api_key' => '123beeffaceade94a0a3611ca1f5a5e0' |
| 86 |
'api_secret' => '64beefca1f7eecad', |
| 87 |
'unicode' => 0, |
| 88 |
'rest_uri' => 'https://api.flickr.com/services/rest/', |
| 89 |
'auth_uri' => 'https://api.flickr.com/services/auth/', |
| 90 |
'api_type' => 'oauth', |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
Flickr::API::Cameras |
| 96 |
==================== |
| 97 |
|
| 98 |
Flickr::API::Cameras is a subclass of Flickr::API with some additions |
| 99 |
for using Flickr's flickr.cameras methods: |
| 100 |
|
| 101 |
brands_list - returns a list of camera brands as an array |
| 102 |
brands_hash - returns a list of camera brands as a hashref |
| 103 |
|
| 104 |
get_cameras - returns a hashref of camera models by the specified |
| 105 |
brand as a hashref |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
Flickr::API::Reflection |
| 110 |
======================= |
| 111 |
|
| 112 |
|
| 113 |
Flickr::API::Reflection is a subclass of Flickr::API with some (hopefully) |
| 114 |
useful additions for using Flickr's flickr.reflection methods. |
| 115 |
|
| 116 |
|
| 117 |
methods_list - returns a list of Flickr's methods as an array |
| 118 |
methods_hash - returns a list of Flickr's methods as a hashref |
| 119 |
|
| 120 |
get_method - returns the description of a specified method as a |
| 121 |
hashref |
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
COPYRIGHT AND LICENSE |
| 127 |
|
| 128 |
Copyright (C) 2015 Louis B. Moore <[email protected]> |
| 129 |
License: Perl Artistic License 2.0 |