flickrie 1.5.2 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -296,9 +296,20 @@ basis of this gem.
296
296
  "flickr.photos.upload.checkTickets" -> Flickrie.check_upload_tickets
297
297
 
298
298
  # photosets
299
+ "flickr.photosets.addPhoto" -> Flickrie.add_photo_to_set
300
+ "flickr.photosets.create" -> Flickrie.create_set
301
+ "flickr.photosets.delete" -> Flickrie.delete_set
302
+ "flickr.photosets.editMeta" -> Flickrie.edit_set_metadata
303
+ "flickr.photosets.editPhotos" -> Flickrie.edit_set_photos
304
+ "flickr.photosets.getContext" -> Flickrie.get_set_context
299
305
  "flickr.photosets.getInfo" -> Flickrie.get_set_info
300
306
  "flickr.photosets.getList" -> Flickrie.sets_from_user
301
307
  "flickr.photosets.getPhotos" -> Flickrie.photos_from_set
308
+ "flickr.photosets.orderSets" -> Flickrie.order_sets
309
+ "flickr.photosets.removePhoto" -> Flickrie.remove_photos_from_set
310
+ "flickr.photosets.removePhotos" -> Flickrie.remove_photos_from_set
311
+ "flickr.photosets.reorderPhotos" -> Flickrie.reorder_photos_in_set
312
+ "flickr.photosets.setPrimaryPhoto" -> Flickrie.set_primary_photo_to_set
302
313
 
303
314
  # test
304
315
  "flickr.test.login" -> Flickrie.test_login
@@ -779,6 +779,74 @@ module Flickrie
779
779
  map { |info| Ticket.new(info) }
780
780
  end
781
781
 
782
+ # Adds existing photo/video to a set with the given ID.
783
+ #
784
+ # @param set_id [Fixnum, String]
785
+ # @return [nil]
786
+ # @api_method [flickr.photosets.addPhoto](http://www.flickr.com/services/api/flickr.photosets.addPhoto.html)
787
+ #
788
+ # @note This method requires authentication with "write" permissions.
789
+ def add_media_to_set(set_id, media_id, params = {})
790
+ client.add_media_to_set(set_id, media_id, params)
791
+ end
792
+ alias add_photo_to_set add_media_to_set
793
+ alias add_video_to_set add_media_to_set
794
+
795
+ # Creates a new set.
796
+ #
797
+ # @return [Flickrie::Set]
798
+ # @api_method [flickr.photosets.create](http://www.flickr.com/services/api/flickr.photosets.create.html)
799
+ #
800
+ # @note This method requires authentication with "write" permissions.
801
+ def create_set(params = {})
802
+ response = client.create_set(params)
803
+ Set.new(response.body['photoset'], self)
804
+ end
805
+
806
+ # Deletes a set.
807
+ #
808
+ # @param set_id [Fixnum, String]
809
+ # @return [nil]
810
+ # @api_method [flickr.photosets.delete](http://www.flickr.com/services/api/flickr.photosets.delete.html)
811
+ #
812
+ # @note This method requires authentication with "write" permissions.
813
+ def delete_set(set_id, params = {})
814
+ client.delete_set(set_id, params)
815
+ nil
816
+ end
817
+
818
+ # Modifies metadata of a set.
819
+ #
820
+ # @param set_id [Fixnum, String]
821
+ # @return [nil]
822
+ # @api_method [flickr.photosets.editMeta](http://www.flickr.com/services/api/flickr.photosets.editMeta.html)
823
+ #
824
+ # @note This method requires authentication with "write" permissions.
825
+ def edit_set_metadata(set_id, params = {})
826
+ client.edit_set_metadata(set_id, params)
827
+ nil
828
+ end
829
+
830
+ # Edits photos/videos of a set with the given ID.
831
+ #
832
+ # @param set_id [Fixnum, String]
833
+ # @return [nil]
834
+ # @api_method [flickr.photosets.editPhotos](http://www.flickr.com/services/api/flickr.photosets.editPhotos.html)
835
+ #
836
+ # @note This method requires authentication with "write" permissions.
837
+ def edit_set_media(set_id, params = {})
838
+ client.edit_set_photos(set_id, params)
839
+ nil
840
+ end
841
+ alias edit_set_photos edit_set_media
842
+ alias edit_set_videos edit_set_media
843
+
844
+ # Returns next and previous photos/videos for a photo/video in a set
845
+ def get_set_context(set_id, media_id, params = {})
846
+ response = client.get_set_context(set_id, media_id, params)
847
+ MediaContext.new(response.body, self)
848
+ end
849
+
782
850
  # Fetches information about the set with the given ID.
783
851
  #
784
852
  # @param set_id [String, Fixnum]
@@ -828,6 +896,60 @@ module Flickrie
828
896
  media_from_set(set_id, {:media => 'videos'}.merge(params))
829
897
  end
830
898
 
899
+ # Sets the order of sets belonging to the authenticated user.
900
+ #
901
+ # @param set_ids [String, Fixnum]
902
+ # @return [nil]
903
+ # @api_method [flickr.photosets.orderSets](http://www.flickr.com/services/api/flickr.photosets.orderSets.html)
904
+ #
905
+ # @note This method requires authentication with "write" permissions.
906
+ def order_sets(set_ids, params = {})
907
+ client.order_sets(set_ids, params)
908
+ nil
909
+ end
910
+
911
+ # Removes photos/videos from a set.
912
+ #
913
+ # @param set_id [Fixnum, String]
914
+ # @param media_ids [String]
915
+ # @api_method [flickr.photosets.removePhotos](http://www.flickr.com/services/api/flickr.photosets.removePhotos.html)
916
+ #
917
+ # @note This method requires authentication with "write" permissions.
918
+ def remove_media_from_set(set_id, media_ids, params = {})
919
+ client.remove_media_from_set(set_id, media_ids, params)
920
+ nil
921
+ end
922
+ alias remove_photos_from_set remove_media_from_set
923
+ alias remove_videos_from_set remove_media_from_set
924
+
925
+ # Reorders photos/videos inside a set.
926
+ #
927
+ # @param set_id [Fixnum, String]
928
+ # @param media_ids [String]
929
+ # @api_method [flickr.photosets.reorderPhotos](http://www.flickr.com/services/api/flickr.photosets.reorderPhotos.html)
930
+ #
931
+ # @note This method requires authentication with "write" permissions.
932
+ def reorder_media_in_set(set_id, media_ids, params = {})
933
+ client.reorder_media_in_set(set_id, media_ids, params)
934
+ nil
935
+ end
936
+ alias reorder_photos_in_set reorder_media_in_set
937
+ alias reorder_videos_in_set reorder_media_in_set
938
+
939
+ # Sets set's primary photo/video.
940
+ #
941
+ # @param set_id [Fixnum, String]
942
+ # @param media_id [String]
943
+ # @api_method [flickr.photosets.setPrimaryPhoto](http://www.flickr.com/services/api/flickr.photosets.setPrimaryPhoto.html)
944
+ #
945
+ # @note This method requires authentication with "write" permissions.
946
+ def set_primary_media_to_set(set_id, media_id, params = {})
947
+ client.set_primary_media_to_set(set_id, media_id, params)
948
+ nil
949
+ end
950
+ alias set_primary_photo_to_set set_primary_media_to_set
951
+ alias set_primary_video_to_set set_primary_media_to_set
952
+
831
953
  # Tests if the authentication was successful. If it was, it
832
954
  # returns info of the user who just authenticated.
833
955
  #
@@ -194,6 +194,33 @@ module Flickrie
194
194
  end
195
195
 
196
196
  # photosets
197
+ def add_media_to_set(set_id, media_id, params = {})
198
+ post 'flickr.photosets.addPhoto',
199
+ {:photoset_id => set_id, :photo_id => media_id}.merge(params)
200
+ end
201
+
202
+ def create_set(params = {})
203
+ post 'flickr.photosets.create', params
204
+ end
205
+
206
+ def delete_set(set_id, params = {})
207
+ post 'flickr.photosets.delete', {:photoset_id => set_id}.merge(params)
208
+ end
209
+
210
+ def edit_set_metadata(set_id, params = {})
211
+ post 'flickr.photosets.editMeta', {:photoset_id => set_id}.merge(params)
212
+ end
213
+
214
+ def edit_set_photos(set_id, params = {})
215
+ post 'flickr.photosets.editPhotos',
216
+ {:photoset_id => set_id}.merge(params)
217
+ end
218
+
219
+ def get_set_context(set_id, media_id, params = {})
220
+ get 'flickr.photosets.getContext',
221
+ {:photoset_id => set_id, :photo_id => media_id}.merge(params)
222
+ end
223
+
197
224
  def get_set_info(set_id, params = {})
198
225
  get 'flickr.photosets.getInfo',
199
226
  {:photoset_id => set_id}.merge(params)
@@ -209,6 +236,25 @@ module Flickrie
209
236
  ensure_media({:photoset_id => set_id}.merge(params))
210
237
  end
211
238
 
239
+ def order_sets(set_ids, params = {})
240
+ post 'flickr.photosets.orderSets', {:photoset_ids => set_ids}.merge(params)
241
+ end
242
+
243
+ def remove_media_from_set(set_id, media_ids, params = {})
244
+ post 'flickr.photosets.removePhotos',
245
+ {:photoset_id => set_id, :photo_ids => media_ids}.merge(params)
246
+ end
247
+
248
+ def reorder_media_in_set(set_id, media_ids, params = {})
249
+ post 'flickr.photosets.reorderPhotos',
250
+ {:photoset_id => set_id, :photo_ids => media_ids}.merge(params)
251
+ end
252
+
253
+ def set_primary_media_to_set(set_id, media_id, params = {})
254
+ post 'flickr.photosets.setPrimaryPhoto',
255
+ {:photoset_id => set_id, :photo_id => media_id}.merge(params)
256
+ end
257
+
212
258
  # test
213
259
  def test_login(params = {})
214
260
  get 'flickr.test.login', params
@@ -9,8 +9,8 @@ module Flickrie
9
9
 
10
10
  def initialize(hash, api_caller)
11
11
  count = hash['count']['_content'].to_i
12
- previous = Media.new(hash['prevphoto'], api_caller) rescue nil
13
- next_ = Media.new(hash['nextphoto'], api_caller) rescue nil
12
+ previous = hash['prevphoto']['id'].to_i > 0 ? Media.new(hash['prevphoto'], api_caller) : nil
13
+ next_ = hash['nextphoto']['id'].to_i > 0 ? Media.new(hash['nextphoto'], api_caller) : nil
14
14
  @count, @previous, @next = count, previous, next_
15
15
  end
16
16
  end
@@ -74,7 +74,13 @@ module Flickrie
74
74
  def updated_at() Time.at(Integer(@hash['date_update'])) rescue nil end
75
75
 
76
76
  # @return [String]
77
- def url() "http://www.flickr.com/photos/#{owner.nsid}/sets/#{id}" rescue nil end
77
+ def url
78
+ if @hash['url']
79
+ @hash['url']
80
+ elsif owner
81
+ "http://www.flickr.com/photos/#{owner.nsid}/sets/#{id}"
82
+ end
83
+ end
78
84
 
79
85
  def [](key) @hash[key] end
80
86
  # @return [Hash]
@@ -1,3 +1,3 @@
1
1
  module Flickrie
2
- VERSION = "1.5.2"
2
+ VERSION = "1.6.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flickrie
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-10 00:00:00.000000000 Z
12
+ date: 2012-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday_middleware
16
- requirement: &70237381004760 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -24,10 +24,18 @@ dependencies:
24
24
  version: '0.9'
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *70237381004760
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 0.8.7
33
+ - - <
34
+ - !ruby/object:Gem::Version
35
+ version: '0.9'
28
36
  - !ruby/object:Gem::Dependency
29
37
  name: faraday
30
- requirement: &70237381003940 !ruby/object:Gem::Requirement
38
+ requirement: !ruby/object:Gem::Requirement
31
39
  none: false
32
40
  requirements:
33
41
  - - ! '>='
@@ -38,10 +46,18 @@ dependencies:
38
46
  version: '0.9'
39
47
  type: :runtime
40
48
  prerelease: false
41
- version_requirements: *70237381003940
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.7.6
55
+ - - <
56
+ - !ruby/object:Gem::Version
57
+ version: '0.9'
42
58
  - !ruby/object:Gem::Dependency
43
59
  name: simple_oauth
44
- requirement: &70237381003160 !ruby/object:Gem::Requirement
60
+ requirement: !ruby/object:Gem::Requirement
45
61
  none: false
46
62
  requirements:
47
63
  - - ~>
@@ -49,10 +65,15 @@ dependencies:
49
65
  version: '0.1'
50
66
  type: :runtime
51
67
  prerelease: false
52
- version_requirements: *70237381003160
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ~>
72
+ - !ruby/object:Gem::Version
73
+ version: '0.1'
53
74
  - !ruby/object:Gem::Dependency
54
75
  name: multi_xml
55
- requirement: &70237381002580 !ruby/object:Gem::Requirement
76
+ requirement: !ruby/object:Gem::Requirement
56
77
  none: false
57
78
  requirements:
58
79
  - - ~>
@@ -60,10 +81,15 @@ dependencies:
60
81
  version: '0.4'
61
82
  type: :runtime
62
83
  prerelease: false
63
- version_requirements: *70237381002580
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '0.4'
64
90
  - !ruby/object:Gem::Dependency
65
91
  name: bundler
66
- requirement: &70237381002100 !ruby/object:Gem::Requirement
92
+ requirement: !ruby/object:Gem::Requirement
67
93
  none: false
68
94
  requirements:
69
95
  - - ~>
@@ -71,10 +97,15 @@ dependencies:
71
97
  version: '1.0'
72
98
  type: :development
73
99
  prerelease: false
74
- version_requirements: *70237381002100
100
+ version_requirements: !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ~>
104
+ - !ruby/object:Gem::Version
105
+ version: '1.0'
75
106
  - !ruby/object:Gem::Dependency
76
107
  name: rake
77
- requirement: &70237381001620 !ruby/object:Gem::Requirement
108
+ requirement: !ruby/object:Gem::Requirement
78
109
  none: false
79
110
  requirements:
80
111
  - - ~>
@@ -82,10 +113,15 @@ dependencies:
82
113
  version: '0.9'
83
114
  type: :development
84
115
  prerelease: false
85
- version_requirements: *70237381001620
116
+ version_requirements: !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ~>
120
+ - !ruby/object:Gem::Version
121
+ version: '0.9'
86
122
  - !ruby/object:Gem::Dependency
87
123
  name: rspec
88
- requirement: &70237381001120 !ruby/object:Gem::Requirement
124
+ requirement: !ruby/object:Gem::Requirement
89
125
  none: false
90
126
  requirements:
91
127
  - - ! '>='
@@ -96,10 +132,18 @@ dependencies:
96
132
  version: '3'
97
133
  type: :development
98
134
  prerelease: false
99
- version_requirements: *70237381001120
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ none: false
137
+ requirements:
138
+ - - ! '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '2.10'
141
+ - - <
142
+ - !ruby/object:Gem::Version
143
+ version: '3'
100
144
  - !ruby/object:Gem::Dependency
101
145
  name: vcr
102
- requirement: &70237381000280 !ruby/object:Gem::Requirement
146
+ requirement: !ruby/object:Gem::Requirement
103
147
  none: false
104
148
  requirements:
105
149
  - - ~>
@@ -107,7 +151,12 @@ dependencies:
107
151
  version: '2.1'
108
152
  type: :development
109
153
  prerelease: false
110
- version_requirements: *70237381000280
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ none: false
156
+ requirements:
157
+ - - ~>
158
+ - !ruby/object:Gem::Version
159
+ version: '2.1'
111
160
  description: This gem wraps the Flickr API with a nice object-oriented interface.
112
161
  email: janko.marohnic@gmail.com
113
162
  executables: []
@@ -165,13 +214,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
214
  - - ! '>='
166
215
  - !ruby/object:Gem::Version
167
216
  version: '0'
168
- segments:
169
- - 0
170
- hash: -3513964845288430156
171
217
  requirements: []
172
218
  rubyforge_project:
173
- rubygems_version: 1.8.11
219
+ rubygems_version: 1.8.23
174
220
  signing_key:
175
221
  specification_version: 3
176
222
  summary: This gem wraps the Flickr API with a nice object-oriented interface.
177
223
  test_files: []
224
+ has_rdoc: