ayn-flickr_fu 0.3.6 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 3
4
- :patch: 6
4
+ :patch: 7
data/flickr_fu.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{flickr_fu}
8
- s.version = "0.3.6"
8
+ s.version = "0.3.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ben Wyrosdick", "Maciej Bilas"]
12
- s.date = %q{2009-09-15}
12
+ s.date = %q{2009-09-16}
13
13
  s.description = %q{Provides a ruby interface to flickr via the REST api}
14
14
  s.email = %q{ayn@andrewng.com}
15
15
  s.extra_rdoc_files = [
data/lib/flickr/photo.rb CHANGED
@@ -4,7 +4,7 @@ class Flickr::Photos::Photo
4
4
  attr_accessor :license_id, :uploaded_at, :taken_at, :owner_name, :icon_server, :original_format, :updated_at, :geo, :tags, :machine_tags, :o_dims, :views, :media, :url_l # extra attributes
5
5
  attr_accessor :info_added, :description, :original_secret, :owner_username, :owner_realname, :url_photopage, :notes # info attributes
6
6
  attr_accessor :comments # comment attributes
7
-
7
+
8
8
  # create a new instance of a flickr photo.
9
9
  #
10
10
  # Params
@@ -55,22 +55,21 @@ class Flickr::Photos::Photo
55
55
  # :original - original image, either a jpg, gif or png, depending on source format
56
56
  #
57
57
  def image_url(size = :medium)
58
- # It turns out that flickr always stores all the sizes of the picture even when getSizes call returns otherwise.
59
- # Not calling getSizes is also very important for performance reasons.
60
- # Retrieving 30 search results means calling the API 31 times if you call getSizes every time.
61
- # Mind that you still need to call getSizes if you go out for the original image.
62
- if size == :original
63
- size_hash[size.to_s].source if size_hash.has_key? size.to_s
64
- else
65
- key = "_#{size_key(size.to_sym)}"
66
- key = "" if key == "_"
67
- "http://farm#{farm}.static.flickr.com/#{server}/#{id}_#{secret}#{key}.jpg"
68
- end
58
+ # It turns out that flickr always stores all the sizes of the picture even when getSizes call returns otherwise.
59
+ # Not calling getSizes is also very important for performance reasons.
60
+ # Retrieving 30 search results means calling the API 31 times if you call getSizes every time.
61
+ # Mind that you still need to call getSizes if you go out for the original image.
62
+ if size == :original
63
+ size_hash[size.to_s].source if size_hash.has_key? size.to_s
64
+ else
65
+ key = "_#{size_key(size.to_sym)}"
66
+ key = "" if key == "_"
67
+ "http://farm#{farm}.static.flickr.com/#{server}/#{id}_#{secret}#{key}.jpg"
68
+ end
69
69
  end
70
70
 
71
71
  def photopage_url
72
- # Keeping the same convention as image_url (foo_url)
73
- url_photopage
72
+ "http://www.flickr.com/photos/#{owner}/#{id}/"
74
73
  end
75
74
 
76
75
  def video_url
@@ -106,7 +105,7 @@ class Flickr::Photos::Photo
106
105
  f
107
106
  end
108
107
  end
109
-
108
+
110
109
  # Add tags to a photo.
111
110
  #
112
111
  # Params
@@ -117,7 +116,7 @@ class Flickr::Photos::Photo
117
116
  @flickr.send_request('flickr.photos.addTags', {:photo_id => self.id, :tags => tags}, :post)
118
117
  true
119
118
  end
120
-
119
+
121
120
  # Add comment to a photo as the currently authenticated user.
122
121
  #
123
122
  # Params
@@ -128,7 +127,7 @@ class Flickr::Photos::Photo
128
127
  @flickr.send_request('flickr.photos.comments.addComment', {:photo_id => self.id, :comment_text => message}, :post)
129
128
  true
130
129
  end
131
-
130
+
132
131
  # Add a note to a photo. Coordinates and sizes are in pixels, based on the 500px image size shown on individual photo pages.
133
132
  #
134
133
  # Params
@@ -147,7 +146,7 @@ class Flickr::Photos::Photo
147
146
  @flickr.send_request('flickr.photos.notes.add', {:photo_id => self.id, :note_x => x, :note_y => y, :note_w => w, :note_h => h, :note_text => message}, :post)
148
147
  true
149
148
  end
150
-
149
+
151
150
  # Rotate a photo.
152
151
  #
153
152
  # Params
@@ -158,7 +157,7 @@ class Flickr::Photos::Photo
158
157
  @flickr.send_request('flickr.photos.transform.rotate', {:photo_id => self.id, :degrees => degrees}, :post)
159
158
  true
160
159
  end
161
-
160
+
162
161
  # return the license associated with the photo
163
162
  #
164
163
  def license
@@ -187,7 +186,7 @@ class Flickr::Photos::Photo
187
186
  end
188
187
  @location = location
189
188
  end
190
-
189
+
191
190
  # Sets the license for a photo.
192
191
  #
193
192
  # Params
@@ -197,7 +196,7 @@ class Flickr::Photos::Photo
197
196
  @flickr.send_request('flickr.photos.licenses.setLicense', {:photo_id => self.id, :license_id => license_id}, :post)
198
197
  true
199
198
  end
200
-
199
+
201
200
  def description # :nodoc:
202
201
  attach_info
203
202
  @description
@@ -229,31 +228,31 @@ class Flickr::Photos::Photo
229
228
  self.comments = []
230
229
  else
231
230
  rsp = @flickr.send_request('flickr.photos.comments.getList', :photo_id => self.id)
232
-
231
+
233
232
  self.comments = []
234
-
233
+
235
234
  rsp.comments.comment.each do |comment|
236
235
  self.comments << Flickr::Photos::Comment.new(:id => comment[:id],
237
- :comment => comment.to_s,
238
- :author => comment[:author],
239
- :author_name => comment[:authorname],
240
- :permalink => comment[:permalink],
241
- :created_at => (Time.at(comment[:datecreate].to_i) rescue nil))
236
+ :comment => comment.to_s,
237
+ :author => comment[:author],
238
+ :author_name => comment[:authorname],
239
+ :permalink => comment[:permalink],
240
+ :created_at => (Time.at(comment[:datecreate].to_i) rescue nil))
242
241
  end
243
242
  end
244
243
 
245
244
  self.comments
246
245
  end
247
246
  end
248
-
247
+
249
248
  def sizes # :nodoc:
250
249
  @sizes ||= begin
251
250
  rsp = @flickr.send_request('flickr.photos.getSizes', :photo_id => self.id)
252
-
251
+
253
252
  _sizes = []
254
253
  rsp.sizes.size.each do |size|
255
254
  _sizes << Flickr::Photos::Size.new(:label => size[:label], :width => size[:width],
256
- :height => size[:height], :source => size[:source], :url => size[:url])
255
+ :height => size[:height], :source => size[:source], :url => size[:url])
257
256
  end
258
257
  _sizes
259
258
  end
@@ -277,7 +276,7 @@ class Flickr::Photos::Photo
277
276
 
278
277
  private
279
278
  attr_accessor :comment_count
280
-
279
+
281
280
  # convert the size to the key used in the flickr url
282
281
  def size_key(size)
283
282
  case size.to_sym
@@ -308,13 +307,13 @@ class Flickr::Photos::Photo
308
307
 
309
308
  rsp.photo.notes.note.each do |note|
310
309
  self.notes << Flickr::Photos::Note.new(:id => note[:id],
311
- :note => note.to_s,
312
- :author => note[:author],
313
- :author_name => note[:authorname],
314
- :x => note[:x],
315
- :y => note[:y],
316
- :width => note[:w],
317
- :height => note[:h])
310
+ :note => note.to_s,
311
+ :author => note[:author],
312
+ :author_name => note[:authorname],
313
+ :x => note[:x],
314
+ :y => note[:y],
315
+ :width => note[:w],
316
+ :height => note[:h])
318
317
  end if rsp.photo.notes.note
319
318
  end
320
319
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ayn-flickr_fu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Wyrosdick
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-09-15 00:00:00 -07:00
13
+ date: 2009-09-16 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency