flickraw 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.rdoc +1 -1
  2. data/lib/flickraw.rb +4 -3
  3. data/rakefile +2 -2
  4. data/test/test.rb +27 -1
  5. metadata +7 -9
data/README.rdoc CHANGED
@@ -120,7 +120,7 @@ You can pass some options to modify flickraw behavior:
120
120
 
121
121
  There are some helpers to build flickr urls :
122
122
 
123
- === url, url_m, url_s, url_t, url_b, url_o
123
+ === url, url_m, url_s, url_t, url_b, url_z, url_o
124
124
 
125
125
  info = flickr.photos.getInfo(:photo_id => "3839885270")
126
126
  FlickRaw.url_b(info) # => "http://farm3.static.flickr.com/2485/3839885270_6fb8b54e06_b.jpg"
data/lib/flickraw.rb CHANGED
@@ -26,14 +26,13 @@ require 'digest/md5'
26
26
  require 'json'
27
27
 
28
28
  FlickRawOptions = {} if not Object.const_defined? :FlickRawOptions # :nodoc:
29
- FlickRawOptions['api_key'] ||= '7b124df89b638e545e3165293883ef62'
30
29
  if ENV['http_proxy'] and not FlickRawOptions['proxy_host']
31
30
  proxy = URI.parse ENV['http_proxy']
32
31
  FlickRawOptions.update('proxy_host' => proxy.host, 'proxy_port' => proxy.port, 'proxy_user' => proxy.user, 'proxy_password' => proxy.password)
33
32
  end
34
33
 
35
34
  module FlickRaw
36
- VERSION='0.8.2'
35
+ VERSION='0.8.3'
37
36
 
38
37
  FLICKR_HOST='api.flickr.com'.freeze
39
38
  REST_PATH='/services/rest/?'.freeze
@@ -157,6 +156,7 @@ module FlickRaw
157
156
  #
158
157
  # Raises FailedResponse if the response status is _failed_.
159
158
  def call(req, args={})
159
+ @token = nil if req == "flickr.auth.getFrob"
160
160
  http_response = open_flickr do |http|
161
161
  request = Net::HTTP::Post.new(REST_PATH, 'User-Agent' => "Flickraw/#{VERSION}")
162
162
  request.set_form_data(build_args(args, req))
@@ -207,7 +207,7 @@ module FlickRaw
207
207
  end
208
208
 
209
209
  def upload_flickr(method, file, args={})
210
- photo = File.open(file, 'rb') { |f| f.read }
210
+ photo = open(file, 'rb') { |f| f.read }
211
211
  boundary = Digest::MD5.hexdigest(photo)
212
212
 
213
213
  header = {'Content-type' => "multipart/form-data, boundary=#{boundary} ", 'User-Agent' => "Flickraw/#{VERSION}"}
@@ -286,6 +286,7 @@ module FlickRaw
286
286
  def url_s(r); PHOTO_SOURCE_URL % [r.farm, r.server, r.id, r.secret, "_s", "jpg"] end
287
287
  def url_t(r); PHOTO_SOURCE_URL % [r.farm, r.server, r.id, r.secret, "_t", "jpg"] end
288
288
  def url_b(r); PHOTO_SOURCE_URL % [r.farm, r.server, r.id, r.secret, "_b", "jpg"] end
289
+ def url_z(r); PHOTO_SOURCE_URL % [r.farm, r.server, r.id, r.secret, "_z", "jpg"] end
289
290
  def url_o(r); PHOTO_SOURCE_URL % [r.farm, r.server, r.id, r.originalsecret, "_o", r.originalformat] end
290
291
  def url_profile(r); URL_PROFILE + (r.owner.respond_to?(:nsid) ? r.owner.nsid : r.owner) + "/" end
291
292
  def url_photopage(r); url_photostream(r) + r.id end
data/rakefile CHANGED
@@ -66,7 +66,7 @@ task :gem => ["flickraw-cached.rb"]
66
66
 
67
67
  desc "Create cached gemspec file"
68
68
  file "flickraw-cached.gemspec" do
69
- open("flickraw-cached.gemspec", "w") {|g| g.puts spec.to_ruby }
69
+ open("flickraw-cached.gemspec", "w") {|g| g.puts spec_cached.to_ruby }
70
70
  end
71
71
  task :gem => ["flickraw-cached.gemspec"]
72
72
  CLOBBER.add "flickraw-cached.gemspec"
@@ -101,6 +101,6 @@ New Flickr API methods :
101
101
 
102
102
  # Update cache and clean gem files
103
103
  open(FREEZED_CACHE_FILE, 'w') {|f| remote_list.each {|m| f.puts m} }
104
- Rake.application[:clobber_package].invoke
104
+ Rake.application[:clobber].invoke
105
105
  end
106
106
  end
data/test/test.rb CHANGED
@@ -7,7 +7,7 @@ class Basic < Test::Unit::TestCase
7
7
  def test_request
8
8
  flickr_objects = %w{activity auth blogs collections commons contacts
9
9
  favorites galleries groups interestingness machinetags panda
10
- people photos photosets places prefs reflection tags
10
+ people photos photosets places prefs reflection stats tags
11
11
  test urls
12
12
  }
13
13
  assert_equal FlickRaw::Flickr.flickr_objects, flickr_objects
@@ -39,8 +39,14 @@ class Basic < Test::Unit::TestCase
39
39
  flickr.favorites.getPublicList
40
40
  flickr.favorites.remove
41
41
  flickr.galleries.addPhoto
42
+ flickr.galleries.create
43
+ flickr.galleries.editMeta
44
+ flickr.galleries.editPhoto
45
+ flickr.galleries.editPhotos
46
+ flickr.galleries.getInfo
42
47
  flickr.galleries.getList
43
48
  flickr.galleries.getListForPhoto
49
+ flickr.galleries.getPhotos
44
50
  flickr.groups.browse
45
51
  flickr.groups.getInfo
46
52
  flickr.groups.members.getList
@@ -61,6 +67,7 @@ class Basic < Test::Unit::TestCase
61
67
  flickr.people.findByEmail
62
68
  flickr.people.findByUsername
63
69
  flickr.people.getInfo
70
+ flickr.people.getPhotos
64
71
  flickr.people.getPhotosOf
65
72
  flickr.people.getPublicGroups
66
73
  flickr.people.getPublicPhotos
@@ -132,6 +139,9 @@ class Basic < Test::Unit::TestCase
132
139
  flickr.photosets.getPhotos
133
140
  flickr.photosets.orderSets
134
141
  flickr.photosets.removePhoto
142
+ flickr.photosets.removePhotos
143
+ flickr.photosets.reorderPhotos
144
+ flickr.photosets.setPrimaryPhoto
135
145
  flickr.places.find
136
146
  flickr.places.findByLatLon
137
147
  flickr.places.getChildrenWithPhotosPublic
@@ -154,6 +164,21 @@ class Basic < Test::Unit::TestCase
154
164
  flickr.prefs.getSafetyLevel
155
165
  flickr.reflection.getMethodInfo
156
166
  flickr.reflection.getMethods
167
+ flickr.stats.getCollectionDomains
168
+ flickr.stats.getCollectionReferrers
169
+ flickr.stats.getCollectionStats
170
+ flickr.stats.getCSVFiles
171
+ flickr.stats.getPhotoDomains
172
+ flickr.stats.getPhotoReferrers
173
+ flickr.stats.getPhotosetDomains
174
+ flickr.stats.getPhotosetReferrers
175
+ flickr.stats.getPhotosetStats
176
+ flickr.stats.getPhotoStats
177
+ flickr.stats.getPhotostreamDomains
178
+ flickr.stats.getPhotostreamReferrers
179
+ flickr.stats.getPhotostreamStats
180
+ flickr.stats.getPopularPhotos
181
+ flickr.stats.getTotalViews
157
182
  flickr.tags.getClusterPhotos
158
183
  flickr.tags.getClusters
159
184
  flickr.tags.getHotList
@@ -168,6 +193,7 @@ class Basic < Test::Unit::TestCase
168
193
  flickr.urls.getGroup
169
194
  flickr.urls.getUserPhotos
170
195
  flickr.urls.getUserProfile
196
+ flickr.urls.lookupGallery
171
197
  flickr.urls.lookupGroup
172
198
  flickr.urls.lookupUser
173
199
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flickraw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mael Clerambault
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-05-05 00:00:00 +02:00
12
+ date: 2010-08-06 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -36,16 +36,14 @@ files:
36
36
  - LICENSE
37
37
  - README.rdoc
38
38
  - rakefile
39
- - examples/auth.rb
40
39
  - examples/flickr_KDE.rb
40
+ - examples/auth.rb
41
41
  - examples/interestingness.rb
42
42
  - examples/upload.rb
43
- - test/test.rb
44
43
  - test/test_upload.rb
45
- has_rdoc: true
44
+ - test/test.rb
45
+ has_rdoc: false
46
46
  homepage: http://hanklords.github.com/flickraw/
47
- licenses: []
48
-
49
47
  post_install_message:
50
48
  rdoc_options: []
51
49
 
@@ -66,9 +64,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
64
  requirements: []
67
65
 
68
66
  rubyforge_project:
69
- rubygems_version: 1.3.5
67
+ rubygems_version: 1.3.1
70
68
  signing_key:
71
- specification_version: 3
69
+ specification_version: 2
72
70
  summary: Flickr library with a syntax close to the syntax described on http://www.flickr.com/services/api
73
71
  test_files: []
74
72