flickr 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +11 -0
- data/.travis.yml +11 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +2 -0
- data/README.md +251 -0
- data/flickr.gemspec +33 -0
- data/flickr_rdoc.rb +7 -7
- data/lib/flickr.rb +21 -19
- data/lib/flickr/version.rb +1 -1
- data/rakefile +19 -6
- metadata +69 -14
- data/README.rdoc +0 -192
- data/test/test.rb +0 -471
- data/test/test_cache.rb +0 -45
- data/test/test_request.rb +0 -36
- data/test/test_response.rb +0 -30
- data/test/test_upload.rb +0 -41
data/lib/flickr/version.rb
CHANGED
data/rakefile
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/clean"
|
3
|
+
require "rdoc/task"
|
4
|
+
require "rake/testtask"
|
4
5
|
|
5
6
|
lib = File.expand_path('../lib/', __FILE__)
|
6
7
|
$:.unshift lib unless $:.include?(lib)
|
@@ -13,10 +14,22 @@ Rake::RDocTask.new do |rd|
|
|
13
14
|
rd.rdoc_files.include "README.rdoc", "lib/flickr.rb"
|
14
15
|
end
|
15
16
|
|
16
|
-
Rake::TestTask.new do |t|
|
17
|
-
t.
|
17
|
+
Rake::TestTask.new(:unit_tests) do |t|
|
18
|
+
t.description = "Run the unit tests"
|
19
|
+
t.libs << "test/unit_tests"
|
20
|
+
t.pattern = "test/unit_tests/*_test.rb"
|
21
|
+
t.warning = true
|
22
|
+
end
|
23
|
+
|
24
|
+
Rake::TestTask.new(:integration_tests) do |t|
|
25
|
+
t.description = "Run the integration tests"
|
26
|
+
t.libs << "test/integration_tests"
|
27
|
+
t.pattern = "test/integration_tests/*_test.rb"
|
28
|
+
t.warning = true
|
18
29
|
end
|
19
30
|
|
20
31
|
task :console do
|
21
|
-
exec
|
32
|
+
exec "pry -I ./lib -r flickr"
|
22
33
|
end
|
34
|
+
|
35
|
+
task default: :unit_tests
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flickr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mael Clerambault
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-06-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -53,21 +53,81 @@ dependencies:
|
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '1.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: webmock
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '2.0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: minitest
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '5.0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '5.0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: bundler-audit
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0.6'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0.6'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: vcr
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '4.0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '4.0'
|
56
112
|
description:
|
57
|
-
email:
|
113
|
+
email: aidan.samuel@gmail.com
|
58
114
|
executables: []
|
59
115
|
extensions: []
|
60
116
|
extra_rdoc_files: []
|
61
117
|
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
62
120
|
- CHANGELOG.md
|
121
|
+
- Gemfile
|
63
122
|
- LICENSE
|
64
|
-
- README.
|
123
|
+
- README.md
|
65
124
|
- examples/auth.rb
|
66
125
|
- examples/interestingness.rb
|
67
126
|
- examples/search.rb
|
68
127
|
- examples/sinatra.rb
|
69
128
|
- examples/upload.rb
|
70
129
|
- examples/web_oauth.rb
|
130
|
+
- flickr.gemspec
|
71
131
|
- flickr_rdoc.rb
|
72
132
|
- lib/flickr.rb
|
73
133
|
- lib/flickr/errors.rb
|
@@ -78,19 +138,14 @@ files:
|
|
78
138
|
- lib/flickr/util.rb
|
79
139
|
- lib/flickr/version.rb
|
80
140
|
- rakefile
|
81
|
-
|
82
|
-
- test/test_cache.rb
|
83
|
-
- test/test_request.rb
|
84
|
-
- test/test_response.rb
|
85
|
-
- test/test_upload.rb
|
86
|
-
homepage: https://github.com/hanklords/flickraw
|
141
|
+
homepage: https://github.com/cyclotron3k/flickr
|
87
142
|
licenses:
|
88
143
|
- MIT
|
89
144
|
metadata:
|
90
|
-
bug_tracker_uri: https://github.com/
|
91
|
-
changelog_uri: https://github.com/
|
92
|
-
documentation_uri: https://github.com/
|
93
|
-
source_code_uri: https://github.com/
|
145
|
+
bug_tracker_uri: https://github.com/cyclotron3k/flickr/issues
|
146
|
+
changelog_uri: https://github.com/cyclotron3k/flickr/blob/master/CHANGELOG.md
|
147
|
+
documentation_uri: https://github.com/cyclotron3k/flickr/blob/v2.0.2/README.md
|
148
|
+
source_code_uri: https://github.com/cyclotron3k/flickr
|
94
149
|
post_install_message:
|
95
150
|
rdoc_options: []
|
96
151
|
require_paths:
|
data/README.rdoc
DELETED
@@ -1,192 +0,0 @@
|
|
1
|
-
= Flickr
|
2
|
-
|
3
|
-
Flickr (formerly FlickRaw) is a library to access the Flickr[https://flickr.com] API in a simple way.
|
4
|
-
It maps exactly the methods described in {the official API documentation}[https://www.flickr.com/services/api/].
|
5
|
-
It also tries to present the data returned in a simple and intuitive way.
|
6
|
-
The methods are fetched from Flickr when loading the library by using introspection capabilities. So it is always up-to-date with regards to new methods added by Flickr.
|
7
|
-
|
8
|
-
The github repository: https://github.com/hanklords/flickraw
|
9
|
-
|
10
|
-
= Upgrading from FlickRaw?
|
11
|
-
|
12
|
-
If you're upgrading from FlickRaw 0.9.x there are a few breaking changes to be aware of:
|
13
|
-
* Instantiate a new object with `client = Flickr.new` instead of `FlickRaw::Flickr.new`.
|
14
|
-
* The global `flickr` variable is no longer created.
|
15
|
-
* Local caching of the Flickr API specification is no longer achieved with a separate gem.
|
16
|
-
|
17
|
-
= Installation
|
18
|
-
Type this in a console (you might need to be superuser)
|
19
|
-
|
20
|
-
gem install flickr
|
21
|
-
|
22
|
-
This will recreate the documentation by fetching the method descriptions from Flickr and then virtually plugging them in standard rdoc documentation.
|
23
|
-
$ cd flickr
|
24
|
-
$ rake rdoc
|
25
|
-
|
26
|
-
= Features
|
27
|
-
|
28
|
-
* Minimal dependencies
|
29
|
-
* Complete support of Flickr API. This doesn't require an update of the library
|
30
|
-
* Ruby syntax similar to the Flickr API
|
31
|
-
* Flickr authentication
|
32
|
-
* HTTPS Support
|
33
|
-
* Photo upload
|
34
|
-
* Proxy support
|
35
|
-
* Flickr URLs helpers
|
36
|
-
|
37
|
-
= Usage
|
38
|
-
|
39
|
-
== Getting started
|
40
|
-
|
41
|
-
To use the Flickr API, you must first obtain an API key and shared secret from Flickr. You can do this by logging in to Flickr and creating an application here[https://www.flickr.com/services/apps/create/apply]. API keys are usually granted automatically and instantly.
|
42
|
-
|
43
|
-
require 'flickr'
|
44
|
-
|
45
|
-
# The credentials can be provided as parameters:
|
46
|
-
|
47
|
-
flickr = Flickr.new "YOUR API KEY", "YOUR SHARED SECRET"
|
48
|
-
|
49
|
-
# Alternatively, if the API key and Shared Secret are not provided, Flickr will attempt to read them
|
50
|
-
# from environment variables:
|
51
|
-
# ENV['FLICKR_API_KEY']
|
52
|
-
# ENV['FLICKR_SHARED_SECRET']
|
53
|
-
|
54
|
-
flickr = Flickr.new
|
55
|
-
|
56
|
-
# Flickr will raise an error if either parameter is not explicitly provided, or available via environment variables.
|
57
|
-
|
58
|
-
|
59
|
-
== Simple
|
60
|
-
|
61
|
-
list = flickr.photos.getRecent
|
62
|
-
|
63
|
-
id = list[0].id
|
64
|
-
secret = list[0].secret
|
65
|
-
info = flickr.photos.getInfo :photo_id => id, :secret => secret
|
66
|
-
|
67
|
-
puts info.title # => "PICT986"
|
68
|
-
puts info.dates.taken # => "2006-07-06 15:16:18"
|
69
|
-
|
70
|
-
|
71
|
-
sizes = flickr.photos.getSizes :photo_id => id
|
72
|
-
|
73
|
-
original = sizes.find { |s| s.label == 'Original' }
|
74
|
-
puts original.width # => "800" -- may fail if they have no original marked image
|
75
|
-
|
76
|
-
== Authentication
|
77
|
-
|
78
|
-
token = flickr.get_request_token
|
79
|
-
auth_url = flickr.get_authorize_url(token['oauth_token'], :perms => 'delete')
|
80
|
-
|
81
|
-
puts "Open this url in your browser to complete the authentication process: #{auth_url}"
|
82
|
-
puts "Copy here the number given when you complete the process."
|
83
|
-
verify = gets.strip
|
84
|
-
|
85
|
-
begin
|
86
|
-
flickr.get_access_token(token['oauth_token'], token['oauth_token_secret'], verify)
|
87
|
-
login = flickr.test.login
|
88
|
-
puts "You are now authenticated as #{login.username} with token #{flickr.access_token} and secret #{flickr.access_secret}"
|
89
|
-
rescue Flickr::FailedResponse => e
|
90
|
-
puts "Authentication failed : #{e.msg}"
|
91
|
-
end
|
92
|
-
|
93
|
-
If the user has already been authenticated, you can reuse the access token and access secret:
|
94
|
-
|
95
|
-
flickr.access_token = "... Your access token ..."
|
96
|
-
flickr.access_secret = "... Your access secret ..."
|
97
|
-
|
98
|
-
# From here you are logged:
|
99
|
-
login = flickr.test.login
|
100
|
-
puts "You are now authenticated as #{login.username}"
|
101
|
-
|
102
|
-
If you need to have several users authenticated at the same time in your application (ex: a public web application) you need to create separate Flickr objects since it keeps the authentication data internally.
|
103
|
-
|
104
|
-
flickr = Flickr.new
|
105
|
-
|
106
|
-
== Upload
|
107
|
-
|
108
|
-
PHOTO_PATH = 'photo.jpg'
|
109
|
-
|
110
|
-
# You need to be authenticated to do that, see the previous examples.
|
111
|
-
flickr.upload_photo PHOTO_PATH, :title => "Title", :description => "This is the description"
|
112
|
-
|
113
|
-
== Caching
|
114
|
-
|
115
|
-
The first time the Flickr object is instantiated, it will download the current Flickr API definition and dynamically create all the required classes and objects. This is how the gem remains up-to-date without requiring updates.
|
116
|
-
|
117
|
-
Unfortunately this adds a significant delay to startup, but the Flickr gem can be configured to cache the API definition to a local file. Just set a file location before the Flickr class is instantiated:
|
118
|
-
|
119
|
-
Flickr.cache = '/tmp/flickr-api.yml'
|
120
|
-
flickr = Flickr.new
|
121
|
-
|
122
|
-
== Proxy
|
123
|
-
|
124
|
-
require 'flickr'
|
125
|
-
Flickr.proxy = "https://user:pass@proxy.example.com:3129/"
|
126
|
-
|
127
|
-
=== Server Certificate Verification
|
128
|
-
|
129
|
-
Server certificate verification is enabled by default. If you don't want to check the server certificate:
|
130
|
-
|
131
|
-
require 'flickr'
|
132
|
-
Flickr.check_certificate = false
|
133
|
-
|
134
|
-
=== CA Certificate File Path
|
135
|
-
|
136
|
-
OpenSSL::X509::DEFAULT_CERT_FILE is used as a CA certificate file. If you want to change the path:
|
137
|
-
|
138
|
-
require 'flickr'
|
139
|
-
Flickr.ca_file = '/path/to/cacert.pem'
|
140
|
-
|
141
|
-
You can also specify a path to a directory with a number of certifications:
|
142
|
-
|
143
|
-
Flickr.ca_path = '/path/to/certificates'
|
144
|
-
|
145
|
-
== Flickr URL Helpers
|
146
|
-
|
147
|
-
There are some helpers to build Flickr urls:
|
148
|
-
|
149
|
-
=== url, url_m, url_s, url_t, url_b, url_z, url_q, url_n, url_c, url_o
|
150
|
-
|
151
|
-
# url_s : Square
|
152
|
-
# url_q : Large Square
|
153
|
-
# url_t : Thumbnail
|
154
|
-
# url_m : Small
|
155
|
-
# url_n : Small 320
|
156
|
-
# url : Medium
|
157
|
-
# url_z : Medium 640
|
158
|
-
# url_c : Medium 800
|
159
|
-
# url_b : Large
|
160
|
-
# url_o : Original
|
161
|
-
|
162
|
-
info = flickr.photos.getInfo(:photo_id => "3839885270")
|
163
|
-
Flickr.url_b(info) # => "https://farm3.static.flickr.com/2485/3839885270_6fb8b54e06_b.jpg"
|
164
|
-
|
165
|
-
=== url_profile
|
166
|
-
|
167
|
-
info = flickr.photos.getInfo(:photo_id => "3839885270")
|
168
|
-
Flickr.url_profile(info) # => "https://www.flickr.com/people/41650587@N02/"
|
169
|
-
|
170
|
-
=== url_photopage
|
171
|
-
|
172
|
-
info = flickr.photos.getInfo(:photo_id => "3839885270")
|
173
|
-
Flickr.url_photopage(info) # => "https://www.flickr.com/photos/41650587@N02/3839885270"
|
174
|
-
|
175
|
-
=== url_photoset, url_photosets
|
176
|
-
|
177
|
-
info = flickr.photos.getInfo(:photo_id => "3839885270")
|
178
|
-
Flickr.url_photosets(info) # => "https://www.flickr.com/photos/41650587@N02/sets/"
|
179
|
-
|
180
|
-
=== url_short, url_short_m, url_short_s, url_short_t
|
181
|
-
|
182
|
-
info = flickr.photos.getInfo(:photo_id => "3839885270")
|
183
|
-
Flickr.url_short(info) # => "https://flic.kr/p/6Rjq7s"
|
184
|
-
|
185
|
-
=== url_photostream
|
186
|
-
|
187
|
-
info = flickr.photos.getInfo(:photo_id => "3839885270")
|
188
|
-
Flickr.url_photostream(info) # => "https://www.flickr.com/photos/41650587@N02/"
|
189
|
-
|
190
|
-
== Examples
|
191
|
-
|
192
|
-
See the _examples_ directory to find more examples.
|
data/test/test.rb
DELETED
@@ -1,471 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
lib = File.dirname(__FILE__)
|
4
|
-
$:.unshift lib unless $:.include?(lib)
|
5
|
-
|
6
|
-
require 'flickr'
|
7
|
-
require 'test/unit'
|
8
|
-
|
9
|
-
class Basic < Test::Unit::TestCase
|
10
|
-
|
11
|
-
def setup
|
12
|
-
@flickr = ::Flickr.new
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_request
|
16
|
-
flickr_objects = %w{
|
17
|
-
activity auth blogs cameras collections commons contacts
|
18
|
-
favorites galleries groups interestingness machinetags panda
|
19
|
-
people photos photosets places prefs profile push reflection
|
20
|
-
stats tags test testimonials urls
|
21
|
-
}
|
22
|
-
|
23
|
-
flickr_objects.each { |o|
|
24
|
-
assert_respond_to @flickr, o.to_sym, "Flickr instance should respond to #{o}"
|
25
|
-
assert_kind_of Flickr::Request, @flickr.send(o.to_sym)
|
26
|
-
}
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_known
|
30
|
-
known_methods = %w{
|
31
|
-
flickr.activity.userComments
|
32
|
-
flickr.activity.userPhotos
|
33
|
-
flickr.auth.checkToken
|
34
|
-
flickr.auth.getFrob
|
35
|
-
flickr.auth.getFullToken
|
36
|
-
flickr.auth.getToken
|
37
|
-
flickr.auth.oauth.checkToken
|
38
|
-
flickr.auth.oauth.getAccessToken
|
39
|
-
flickr.blogs.getList
|
40
|
-
flickr.blogs.getServices
|
41
|
-
flickr.blogs.postPhoto
|
42
|
-
flickr.cameras.getBrandModels
|
43
|
-
flickr.cameras.getBrands
|
44
|
-
flickr.collections.getInfo
|
45
|
-
flickr.collections.getTree
|
46
|
-
flickr.commons.getInstitutions
|
47
|
-
flickr.contacts.getList
|
48
|
-
flickr.contacts.getListRecentlyUploaded
|
49
|
-
flickr.contacts.getPublicList
|
50
|
-
flickr.contacts.getTaggingSuggestions
|
51
|
-
flickr.favorites.add
|
52
|
-
flickr.favorites.getContext
|
53
|
-
flickr.favorites.getList
|
54
|
-
flickr.favorites.getPublicList
|
55
|
-
flickr.favorites.remove
|
56
|
-
flickr.galleries.addPhoto
|
57
|
-
flickr.galleries.create
|
58
|
-
flickr.galleries.editMeta
|
59
|
-
flickr.galleries.editPhoto
|
60
|
-
flickr.galleries.editPhotos
|
61
|
-
flickr.galleries.getInfo
|
62
|
-
flickr.galleries.getList
|
63
|
-
flickr.galleries.getListForPhoto
|
64
|
-
flickr.galleries.getPhotos
|
65
|
-
flickr.galleries.removePhoto
|
66
|
-
flickr.groups.browse
|
67
|
-
flickr.groups.discuss.replies.add
|
68
|
-
flickr.groups.discuss.replies.delete
|
69
|
-
flickr.groups.discuss.replies.edit
|
70
|
-
flickr.groups.discuss.replies.getInfo
|
71
|
-
flickr.groups.discuss.replies.getList
|
72
|
-
flickr.groups.discuss.topics.add
|
73
|
-
flickr.groups.discuss.topics.getInfo
|
74
|
-
flickr.groups.discuss.topics.getList
|
75
|
-
flickr.groups.getInfo
|
76
|
-
flickr.groups.join
|
77
|
-
flickr.groups.joinRequest
|
78
|
-
flickr.groups.leave
|
79
|
-
flickr.groups.members.getList
|
80
|
-
flickr.groups.pools.add
|
81
|
-
flickr.groups.pools.getContext
|
82
|
-
flickr.groups.pools.getGroups
|
83
|
-
flickr.groups.pools.getPhotos
|
84
|
-
flickr.groups.pools.remove
|
85
|
-
flickr.groups.search
|
86
|
-
flickr.interestingness.getList
|
87
|
-
flickr.machinetags.getNamespaces
|
88
|
-
flickr.machinetags.getPairs
|
89
|
-
flickr.machinetags.getPredicates
|
90
|
-
flickr.machinetags.getRecentValues
|
91
|
-
flickr.machinetags.getValues
|
92
|
-
flickr.panda.getList
|
93
|
-
flickr.panda.getPhotos
|
94
|
-
flickr.people.findByEmail
|
95
|
-
flickr.people.findByUsername
|
96
|
-
flickr.people.getGroups
|
97
|
-
flickr.people.getInfo
|
98
|
-
flickr.people.getLimits
|
99
|
-
flickr.people.getPhotos
|
100
|
-
flickr.people.getPhotosOf
|
101
|
-
flickr.people.getPublicGroups
|
102
|
-
flickr.people.getPublicPhotos
|
103
|
-
flickr.people.getUploadStatus
|
104
|
-
flickr.photos.addTags
|
105
|
-
flickr.photos.comments.addComment
|
106
|
-
flickr.photos.comments.deleteComment
|
107
|
-
flickr.photos.comments.editComment
|
108
|
-
flickr.photos.comments.getList
|
109
|
-
flickr.photos.comments.getRecentForContacts
|
110
|
-
flickr.photos.delete
|
111
|
-
flickr.photos.geo.batchCorrectLocation
|
112
|
-
flickr.photos.geo.correctLocation
|
113
|
-
flickr.photos.geo.getLocation
|
114
|
-
flickr.photos.geo.getPerms
|
115
|
-
flickr.photos.geo.photosForLocation
|
116
|
-
flickr.photos.geo.removeLocation
|
117
|
-
flickr.photos.geo.setContext
|
118
|
-
flickr.photos.geo.setLocation
|
119
|
-
flickr.photos.geo.setPerms
|
120
|
-
flickr.photos.getAllContexts
|
121
|
-
flickr.photos.getContactsPhotos
|
122
|
-
flickr.photos.getContactsPublicPhotos
|
123
|
-
flickr.photos.getContext
|
124
|
-
flickr.photos.getCounts
|
125
|
-
flickr.photos.getExif
|
126
|
-
flickr.photos.getFavorites
|
127
|
-
flickr.photos.getInfo
|
128
|
-
flickr.photos.getNotInSet
|
129
|
-
flickr.photos.getPerms
|
130
|
-
flickr.photos.getPopular
|
131
|
-
flickr.photos.getRecent
|
132
|
-
flickr.photos.getSizes
|
133
|
-
flickr.photos.getUntagged
|
134
|
-
flickr.photos.getWithGeoData
|
135
|
-
flickr.photos.getWithoutGeoData
|
136
|
-
flickr.photos.licenses.getInfo
|
137
|
-
flickr.photos.licenses.setLicense
|
138
|
-
flickr.photos.notes.add
|
139
|
-
flickr.photos.notes.delete
|
140
|
-
flickr.photos.notes.edit
|
141
|
-
flickr.photos.people.add
|
142
|
-
flickr.photos.people.delete
|
143
|
-
flickr.photos.people.deleteCoords
|
144
|
-
flickr.photos.people.editCoords
|
145
|
-
flickr.photos.people.getList
|
146
|
-
flickr.photos.recentlyUpdated
|
147
|
-
flickr.photos.removeTag
|
148
|
-
flickr.photos.search
|
149
|
-
flickr.photos.setContentType
|
150
|
-
flickr.photos.setDates
|
151
|
-
flickr.photos.setMeta
|
152
|
-
flickr.photos.setPerms
|
153
|
-
flickr.photos.setSafetyLevel
|
154
|
-
flickr.photos.setTags
|
155
|
-
flickr.photos.suggestions.approveSuggestion
|
156
|
-
flickr.photos.suggestions.getList
|
157
|
-
flickr.photos.suggestions.rejectSuggestion
|
158
|
-
flickr.photos.suggestions.removeSuggestion
|
159
|
-
flickr.photos.suggestions.suggestLocation
|
160
|
-
flickr.photos.transform.rotate
|
161
|
-
flickr.photos.upload.checkTickets
|
162
|
-
flickr.photosets.addPhoto
|
163
|
-
flickr.photosets.comments.addComment
|
164
|
-
flickr.photosets.comments.deleteComment
|
165
|
-
flickr.photosets.comments.editComment
|
166
|
-
flickr.photosets.comments.getList
|
167
|
-
flickr.photosets.create
|
168
|
-
flickr.photosets.delete
|
169
|
-
flickr.photosets.editMeta
|
170
|
-
flickr.photosets.editPhotos
|
171
|
-
flickr.photosets.getContext
|
172
|
-
flickr.photosets.getInfo
|
173
|
-
flickr.photosets.getList
|
174
|
-
flickr.photosets.getPhotos
|
175
|
-
flickr.photosets.orderSets
|
176
|
-
flickr.photosets.removePhoto
|
177
|
-
flickr.photosets.removePhotos
|
178
|
-
flickr.photosets.reorderPhotos
|
179
|
-
flickr.photosets.setPrimaryPhoto
|
180
|
-
flickr.places.find
|
181
|
-
flickr.places.findByLatLon
|
182
|
-
flickr.places.getChildrenWithPhotosPublic
|
183
|
-
flickr.places.getInfo
|
184
|
-
flickr.places.getInfoByUrl
|
185
|
-
flickr.places.getPlaceTypes
|
186
|
-
flickr.places.getShapeHistory
|
187
|
-
flickr.places.getTopPlacesList
|
188
|
-
flickr.places.placesForBoundingBox
|
189
|
-
flickr.places.placesForContacts
|
190
|
-
flickr.places.placesForTags
|
191
|
-
flickr.places.placesForUser
|
192
|
-
flickr.places.resolvePlaceId
|
193
|
-
flickr.places.resolvePlaceURL
|
194
|
-
flickr.places.tagsForPlace
|
195
|
-
flickr.prefs.getContentType
|
196
|
-
flickr.prefs.getGeoPerms
|
197
|
-
flickr.prefs.getHidden
|
198
|
-
flickr.prefs.getPrivacy
|
199
|
-
flickr.prefs.getSafetyLevel
|
200
|
-
flickr.profile.getProfile
|
201
|
-
flickr.push.getSubscriptions
|
202
|
-
flickr.push.getTopics
|
203
|
-
flickr.push.subscribe
|
204
|
-
flickr.push.unsubscribe
|
205
|
-
flickr.reflection.getMethodInfo
|
206
|
-
flickr.reflection.getMethods
|
207
|
-
flickr.stats.getCSVFiles
|
208
|
-
flickr.stats.getCollectionDomains
|
209
|
-
flickr.stats.getCollectionReferrers
|
210
|
-
flickr.stats.getCollectionStats
|
211
|
-
flickr.stats.getPhotoDomains
|
212
|
-
flickr.stats.getPhotoReferrers
|
213
|
-
flickr.stats.getPhotoStats
|
214
|
-
flickr.stats.getPhotosetDomains
|
215
|
-
flickr.stats.getPhotosetReferrers
|
216
|
-
flickr.stats.getPhotosetStats
|
217
|
-
flickr.stats.getPhotostreamDomains
|
218
|
-
flickr.stats.getPhotostreamReferrers
|
219
|
-
flickr.stats.getPhotostreamStats
|
220
|
-
flickr.stats.getPopularPhotos
|
221
|
-
flickr.stats.getTotalViews
|
222
|
-
flickr.tags.getClusterPhotos
|
223
|
-
flickr.tags.getClusters
|
224
|
-
flickr.tags.getHotList
|
225
|
-
flickr.tags.getListPhoto
|
226
|
-
flickr.tags.getListUser
|
227
|
-
flickr.tags.getListUserPopular
|
228
|
-
flickr.tags.getListUserRaw
|
229
|
-
flickr.tags.getMostFrequentlyUsed
|
230
|
-
flickr.tags.getRelated
|
231
|
-
flickr.test.echo
|
232
|
-
flickr.test.login
|
233
|
-
flickr.test.null
|
234
|
-
flickr.testimonials.addTestimonial
|
235
|
-
flickr.testimonials.approveTestimonial
|
236
|
-
flickr.testimonials.deleteTestimonial
|
237
|
-
flickr.testimonials.editTestimonial
|
238
|
-
flickr.testimonials.getAllTestimonialsAbout
|
239
|
-
flickr.testimonials.getAllTestimonialsAboutBy
|
240
|
-
flickr.testimonials.getAllTestimonialsBy
|
241
|
-
flickr.testimonials.getPendingTestimonialsAbout
|
242
|
-
flickr.testimonials.getPendingTestimonialsAboutBy
|
243
|
-
flickr.testimonials.getPendingTestimonialsBy
|
244
|
-
flickr.testimonials.getTestimonialsAbout
|
245
|
-
flickr.testimonials.getTestimonialsAboutBy
|
246
|
-
flickr.testimonials.getTestimonialsBy
|
247
|
-
flickr.urls.getGroup
|
248
|
-
flickr.urls.getUserPhotos
|
249
|
-
flickr.urls.getUserProfile
|
250
|
-
flickr.urls.lookupGallery
|
251
|
-
flickr.urls.lookupGroup
|
252
|
-
flickr.urls.lookupUser
|
253
|
-
}
|
254
|
-
found_methods = @flickr.reflection.getMethods
|
255
|
-
assert_instance_of Flickr::ResponseList, found_methods
|
256
|
-
assert_equal known_methods.sort, found_methods.to_a.sort
|
257
|
-
end
|
258
|
-
|
259
|
-
def test_list
|
260
|
-
list = @flickr.photos.getRecent :per_page => '10'
|
261
|
-
assert_instance_of Flickr::ResponseList, list
|
262
|
-
assert_equal(list.size, 10)
|
263
|
-
end
|
264
|
-
|
265
|
-
def people(user)
|
266
|
-
assert_equal "41650587@N02", user.id
|
267
|
-
assert_equal "41650587@N02", user.nsid
|
268
|
-
assert_equal "ruby_flickraw", user.username
|
269
|
-
end
|
270
|
-
|
271
|
-
def photo(info)
|
272
|
-
assert_equal "3839885270", info.id
|
273
|
-
assert_equal "41650587@N02", info.owner
|
274
|
-
assert_equal "6fb8b54e06", info.secret
|
275
|
-
assert_equal "2485", info.server
|
276
|
-
assert_equal 3, info.farm
|
277
|
-
assert_equal "cat", info.title
|
278
|
-
assert_equal 1, info.ispublic
|
279
|
-
end
|
280
|
-
|
281
|
-
# favorites
|
282
|
-
def test_favorites_getPublicList
|
283
|
-
list = @flickr.favorites.getPublicList :user_id => "41650587@N02"
|
284
|
-
assert_equal 1, list.size
|
285
|
-
assert_equal "3829093290", list[0].id
|
286
|
-
end
|
287
|
-
|
288
|
-
# groups
|
289
|
-
def test_groups_getInfo
|
290
|
-
info = @flickr.groups.getInfo :group_id => "51035612836@N01"
|
291
|
-
assert_equal "51035612836@N01", info.id
|
292
|
-
assert_equal "Flickr API", info.name
|
293
|
-
end
|
294
|
-
|
295
|
-
def test_groups_search
|
296
|
-
list = @flickr.groups.search :text => "Flickr API"
|
297
|
-
assert list.any? { |g| g.nsid == "51035612836@N01"}
|
298
|
-
end
|
299
|
-
|
300
|
-
# people
|
301
|
-
def test_people_findByEmail
|
302
|
-
user = @flickr.people.findByEmail :find_email => "flickraw@yahoo.com"
|
303
|
-
people user
|
304
|
-
end
|
305
|
-
|
306
|
-
def test_people_findByUsername
|
307
|
-
user = @flickr.people.findByUsername :username => "ruby_flickraw"
|
308
|
-
people user
|
309
|
-
end
|
310
|
-
|
311
|
-
def test_people_getInfo
|
312
|
-
user = @flickr.people.getInfo :user_id => "41650587@N02"
|
313
|
-
people user
|
314
|
-
assert_equal "Flickraw", user.realname
|
315
|
-
assert_equal "https://www.flickr.com/photos/41650587@N02/", user.photosurl
|
316
|
-
assert_equal "https://www.flickr.com/people/41650587@N02/", user.profileurl
|
317
|
-
assert_equal "https://m.flickr.com/photostream.gne?id=41630239", user.mobileurl
|
318
|
-
assert_equal 0, user.ispro
|
319
|
-
end
|
320
|
-
|
321
|
-
def test_people_getPublicGroups
|
322
|
-
groups = @flickr.people.getPublicGroups :user_id => "41650587@N02"
|
323
|
-
assert groups.to_a.empty?
|
324
|
-
end
|
325
|
-
|
326
|
-
def test_people_getPublicPhotos
|
327
|
-
info = @flickr.people.getPublicPhotos :user_id => "41650587@N02"
|
328
|
-
assert_equal 1, info.size
|
329
|
-
assert_equal "1", info.total
|
330
|
-
assert_equal 1, info.pages
|
331
|
-
assert_equal 1, info.page
|
332
|
-
photo info[0]
|
333
|
-
end
|
334
|
-
|
335
|
-
# photos
|
336
|
-
def test_photos_getInfo
|
337
|
-
id = "3839885270"
|
338
|
-
info = nil
|
339
|
-
assert_nothing_raised(Flickr::FailedResponse) {
|
340
|
-
info = @flickr.photos.getInfo(:photo_id => id)
|
341
|
-
}
|
342
|
-
|
343
|
-
%w{id secret server farm license owner title description dates comments tags media}.each { |m|
|
344
|
-
assert_respond_to info, m
|
345
|
-
assert_not_nil info[m]
|
346
|
-
}
|
347
|
-
|
348
|
-
assert_equal id, info.id
|
349
|
-
assert_equal "cat", info.title
|
350
|
-
assert_equal "This is my cat", info.description
|
351
|
-
assert_equal "ruby_flickraw", info.owner["username"]
|
352
|
-
assert_equal "Flickraw", info.owner["realname"]
|
353
|
-
assert_equal %w{cat pet}, info.tags.map { |t| t.to_s}.sort
|
354
|
-
end
|
355
|
-
|
356
|
-
def test_photos_getExif
|
357
|
-
info = @flickr.photos.getExif :photo_id => "3839885270"
|
358
|
-
assert_equal "Canon DIGITAL IXUS 55", info.exif.find { |f| f.tag == "Model"}.raw
|
359
|
-
assert_equal "1/60", info.exif.find { |f| f.tag == "ExposureTime"}.raw
|
360
|
-
assert_equal "4.9", info.exif.find { |f| f.tag == "FNumber"}.raw
|
361
|
-
assert_equal "1600", info.exif.find { |f| f.tag == "RelatedImageWidth"}.raw
|
362
|
-
assert_equal "1200", info.exif.find { |f| f.tag == "RelatedImageHeight"}.raw
|
363
|
-
end
|
364
|
-
|
365
|
-
def test_photos_getSizes
|
366
|
-
info = @flickr.photos.getSizes :photo_id => "3839885270"
|
367
|
-
assert_equal "https://www.flickr.com/photos/41650587@N02/3839885270/sizes/l/", info.find { |f| f.label == "Large" }.url
|
368
|
-
source = "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_b.jpg"
|
369
|
-
|
370
|
-
assert_equal source, info.find { |f| f.label == "Large"}.source
|
371
|
-
end
|
372
|
-
|
373
|
-
def test_photos_search
|
374
|
-
info = @flickr.photos.search :user_id => "41650587@N02"
|
375
|
-
photo info[0]
|
376
|
-
end
|
377
|
-
|
378
|
-
# photos.comments
|
379
|
-
def test_photos_comments_getList
|
380
|
-
comments = @flickr.photos.comments.getList :photo_id => "3839885270"
|
381
|
-
assert_equal 1, comments.size
|
382
|
-
assert_equal "3839885270", comments.photo_id
|
383
|
-
assert_equal "41630239-3839885270-72157621986549875", comments[0].id
|
384
|
-
assert_equal "41650587@N02", comments[0].author
|
385
|
-
assert_equal "ruby_flickraw", comments[0].authorname
|
386
|
-
assert_equal "https://www.flickr.com/photos/41650587@N02/3839885270/#comment72157621986549875", comments[0].permalink
|
387
|
-
assert_equal "This is a cute cat !", comments[0].to_s
|
388
|
-
end
|
389
|
-
|
390
|
-
# tags
|
391
|
-
def test_tags_getListPhoto
|
392
|
-
tags = @flickr.tags.getListPhoto :photo_id => "3839885270"
|
393
|
-
assert_equal 2, tags.tags.size
|
394
|
-
assert_equal "3839885270", tags.id
|
395
|
-
assert_equal %w{cat pet}, tags.tags.map { |t| t.to_s}.sort
|
396
|
-
end
|
397
|
-
|
398
|
-
def test_tags_getListUser
|
399
|
-
tags = @flickr.tags.getListUser :user_id => "41650587@N02"
|
400
|
-
assert_equal "41650587@N02", tags.id
|
401
|
-
assert_equal %w{cat pet}, tags.tags.sort
|
402
|
-
end
|
403
|
-
|
404
|
-
# urls
|
405
|
-
def test_urls_getGroup
|
406
|
-
info = @flickr.urls.getGroup :group_id => "51035612836@N01"
|
407
|
-
assert_equal "51035612836@N01", info.nsid
|
408
|
-
assert_equal "https://www.flickr.com/groups/api/", info.url
|
409
|
-
end
|
410
|
-
|
411
|
-
def test_urls_getUserPhotos
|
412
|
-
info = @flickr.urls.getUserPhotos :user_id => "41650587@N02"
|
413
|
-
assert_equal "41650587@N02", info.nsid
|
414
|
-
assert_equal "https://www.flickr.com/photos/41650587@N02/", info.url
|
415
|
-
end
|
416
|
-
|
417
|
-
def test_urls_getUserProfile
|
418
|
-
info = @flickr.urls.getUserProfile :user_id => "41650587@N02"
|
419
|
-
assert_equal "41650587@N02", info.nsid
|
420
|
-
assert_equal "https://www.flickr.com/people/41650587@N02/", info.url
|
421
|
-
end
|
422
|
-
|
423
|
-
def test_urls_lookupGroup
|
424
|
-
info = @flickr.urls.lookupGroup :url => "https://www.flickr.com/groups/api/"
|
425
|
-
assert_equal "51035612836@N01", info.id
|
426
|
-
assert_equal "Flickr API", info.groupname
|
427
|
-
end
|
428
|
-
|
429
|
-
def test_urls_lookupUser
|
430
|
-
info = @flickr.urls.lookupUser :url => "https://www.flickr.com/photos/41650587@N02/"
|
431
|
-
assert_equal "41650587@N02", info.id
|
432
|
-
assert_equal "ruby_flickraw", info.username
|
433
|
-
end
|
434
|
-
|
435
|
-
def test_urls
|
436
|
-
id = "3839885270"
|
437
|
-
info = @flickr.photos.getInfo(:photo_id => id)
|
438
|
-
|
439
|
-
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06.jpg", Flickr.url(info)
|
440
|
-
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_m.jpg", Flickr.url_m(info)
|
441
|
-
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_s.jpg", Flickr.url_s(info)
|
442
|
-
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_t.jpg", Flickr.url_t(info)
|
443
|
-
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_b.jpg", Flickr.url_b(info)
|
444
|
-
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_z.jpg", Flickr.url_z(info)
|
445
|
-
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_q.jpg", Flickr.url_q(info)
|
446
|
-
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_n.jpg", Flickr.url_n(info)
|
447
|
-
assert_equal "https://farm3.staticflickr.com/2485/3839885270_6fb8b54e06_c.jpg", Flickr.url_c(info)
|
448
|
-
|
449
|
-
assert_equal "https://www.flickr.com/people/41650587@N02/", Flickr.url_profile(info)
|
450
|
-
assert_equal "https://www.flickr.com/photos/41650587@N02/", Flickr.url_photostream(info)
|
451
|
-
assert_equal "https://www.flickr.com/photos/41650587@N02/3839885270", Flickr.url_photopage(info)
|
452
|
-
assert_equal "https://www.flickr.com/photos/41650587@N02/sets/", Flickr.url_photosets(info)
|
453
|
-
assert_equal "https://flic.kr/p/6Rjq7s", Flickr.url_short(info)
|
454
|
-
end
|
455
|
-
|
456
|
-
def test_url_escape
|
457
|
-
result_set = nil
|
458
|
-
assert_nothing_raised {
|
459
|
-
result_set = @flickr.photos.search :text => "family vacation"
|
460
|
-
}
|
461
|
-
assert_operator result_set.total.to_i, :>=, 0
|
462
|
-
|
463
|
-
# Unicode tests
|
464
|
-
echo = nil
|
465
|
-
utf8_text = "Hélène François, €uro"
|
466
|
-
assert_nothing_raised {
|
467
|
-
echo = @flickr.test.echo :utf8_text => utf8_text
|
468
|
-
}
|
469
|
-
assert_equal echo.utf8_text, utf8_text
|
470
|
-
end
|
471
|
-
end
|