flickr-objects 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7c36dd232a2505c2e6c76906c38ba1f7374d524
4
- data.tar.gz: 76f717ac84e25285b984870db90f86132d526021
3
+ metadata.gz: da97710af16b03fe15e23c1bd8c523db79b26b85
4
+ data.tar.gz: 65ee1ec70dacbda2850ba99d10247d8b681f4880
5
5
  SHA512:
6
- metadata.gz: f2f4c0109eb781b3956aae38c6feae2471059d032dd76f4219b76f577c957e8f8b56bde30e6ec638915dfeb01ce5f13b4eb715b2284085a7aff3c951e6a17cd8
7
- data.tar.gz: 96d9b8301f3615f4eb0b2315f46cfd9e956c387d40c40d896e6e16cbaec8fc89321911c1f3f7d070087e0787ead5cf6f92c2816458bf55cffd3591dac36bba35
6
+ metadata.gz: 8375724b89bbd0aa84bde3355309e773e40497eebc0a3030dd65d8d5c2e2684a8e6212333c1633455002c9620d02b91e7d93814d6d5cf524c7e46e2b84f45f9c
7
+ data.tar.gz: 40fa5a43230f9f4f0ad3d0ac1c24d69f2269a4afdd0141129d68facde2e4c729f4f6fded406f8fb832054ef6c257535528b852a0a0925f6d1900a5ea95995687
data/lib/flickr/api.rb CHANGED
@@ -5,7 +5,7 @@ module Flickr
5
5
  extend Flickr::AutoloadHelper
6
6
 
7
7
  autoload_names \
8
- :Abstract, :General, :Photo, :Person, :Set, :UploadTicket
8
+ :Abstract, :General, :Photo, :Person, :Set, :UploadTicket, :License
9
9
 
10
10
  ##
11
11
  # @return [Flickr::Api::Photo]
@@ -35,6 +35,13 @@ module Flickr
35
35
  Flickr::Api::UploadTicket.new(access_token)
36
36
  end
37
37
 
38
+ ##
39
+ # @return [Flickr::Api::License]
40
+ #
41
+ def licenses
42
+ Flickr::Api::License.new(access_token)
43
+ end
44
+
38
45
  ##
39
46
  # @return [String]
40
47
  # @see Flickr::Api::General#upload
@@ -103,7 +103,7 @@ module Flickr
103
103
  # # [#<Flickr::Object::Photo:0x007ffe6b4ff760 owner=#<Flickr::Object::Person:0x007ffe6b52d408 >>,
104
104
  # # #<Flickr::Object::Photo:0x007ffe6b4fdcd0 owner=#<Flickr::Object::Person:0x007ffe6b556ab0 >>]>
105
105
  #
106
- def new_list(class_name, attributes_list, list_attributes)
106
+ def new_list(class_name, attributes_list, list_attributes = {})
107
107
  objects = attributes_list.map { |attributes| new_object(class_name, attributes) }
108
108
  list = Flickr::Object::List.new(list_attributes)
109
109
  list.populate(objects)
@@ -0,0 +1,19 @@
1
+ module Flickr
2
+ module Api
3
+
4
+ class License < Abstract
5
+
6
+ ##
7
+ # @param params [Hash] See documentation below
8
+ # @return [Flickr::Object::List<Flickr::Object::License>]
9
+ # @docs [flickr.photos.licenses.getInfo](https://www.flickr.com/services/api/flickr.photos.licenses.getInfo.html)
10
+ #
11
+ def all(params = {})
12
+ response = get "photos.licenses.getInfo", params
13
+ new_list(:License, response["licenses"].delete("license"))
14
+ end
15
+
16
+ end
17
+
18
+ end
19
+ end
@@ -240,6 +240,15 @@ module Flickr
240
240
  post "photos.setSafetyLevel", params.merge(photo_id: photo_id)
241
241
  end
242
242
 
243
+ ##
244
+ # @param params [Hash] See documentation below
245
+ # @return [response]
246
+ # @docs [flickr.photos.licenses.setLicense](https://www.flickr.com/services/api/flickr.photos.licenses.setLicense.html)
247
+ #
248
+ def set_license(photo_id, license_id, params = {})
249
+ post "photos.licenses.setLicense", params.merge(photo_id: photo_id, license_id: license_id)
250
+ end
251
+
243
252
  end
244
253
 
245
254
  end
data/lib/flickr/object.rb CHANGED
@@ -13,7 +13,7 @@ module Flickr
13
13
 
14
14
  autoload_names \
15
15
  :List, :Photo, :Person, :Set, :UploadTicket, :Permissions, :Location,
16
- :Visibility
16
+ :Visibility, :License
17
17
 
18
18
  ##
19
19
  # Overriding Flickr::Attributes#attribute to add a default location.
@@ -0,0 +1,13 @@
1
+ module Flickr
2
+ class Object
3
+
4
+ class License < Flickr::Object
5
+
6
+ attribute :id, Integer
7
+ attribute :name, String
8
+ attribute :url, String
9
+
10
+ end
11
+
12
+ end
13
+ end
@@ -322,6 +322,14 @@ module Flickr
322
322
  api.set_safety_level(id, params)
323
323
  end
324
324
 
325
+ ##
326
+ # @return [response]
327
+ # @see Flickr::Api::Photo#set_license
328
+ #
329
+ def set_license(license_id, params = {})
330
+ api.set_license(id, license_id, params)
331
+ end
332
+
325
333
  private
326
334
 
327
335
  ##
@@ -1,5 +1,5 @@
1
1
  module Flickr
2
2
 
3
- VERSION = "0.5.3"
3
+ VERSION = "0.6.0"
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flickr-objects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-29 00:00:00.000000000 Z
11
+ date: 2015-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -193,6 +193,7 @@ files:
193
193
  - lib/flickr/api/abstract.rb
194
194
  - lib/flickr/api/abstract/params_processor.rb
195
195
  - lib/flickr/api/general.rb
196
+ - lib/flickr/api/license.rb
196
197
  - lib/flickr/api/person.rb
197
198
  - lib/flickr/api/photo.rb
198
199
  - lib/flickr/api/set.rb
@@ -220,6 +221,7 @@ files:
220
221
  - lib/flickr/object/attribute_locations/set.rb
221
222
  - lib/flickr/object/attribute_locations/upload_ticket.rb
222
223
  - lib/flickr/object/attribute_locations/visibility.rb
224
+ - lib/flickr/object/license.rb
223
225
  - lib/flickr/object/list.rb
224
226
  - lib/flickr/object/list/kaminari.rb
225
227
  - lib/flickr/object/list/normal.rb