flickr-objects 0.6.0 → 0.6.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da97710af16b03fe15e23c1bd8c523db79b26b85
4
- data.tar.gz: 65ee1ec70dacbda2850ba99d10247d8b681f4880
3
+ metadata.gz: f4f95d067768c10e04a1fb7203b1f3cd56e8bffd
4
+ data.tar.gz: 3ff31499a4b3488adbbbc7637bf60102dc935c0f
5
5
  SHA512:
6
- metadata.gz: 8375724b89bbd0aa84bde3355309e773e40497eebc0a3030dd65d8d5c2e2684a8e6212333c1633455002c9620d02b91e7d93814d6d5cf524c7e46e2b84f45f9c
7
- data.tar.gz: 40fa5a43230f9f4f0ad3d0ac1c24d69f2269a4afdd0141129d68facde2e4c729f4f6fded406f8fb832054ef6c257535528b852a0a0925f6d1900a5ea95995687
6
+ metadata.gz: 5bec77a91adb2e1dce4af3d7b824af6ca9ad3a3497407966aff7142545f7573285a4cabcddd8642ffa529d4bfc31b0a44a6e4e1da4f050dcac12c4a559c09b70
7
+ data.tar.gz: 0fad102f3f9318886421298b64cb2fff2a0f0c77047e1d407a3c8875c693d8c5e023f09f7ba1cecfd21b7892168ed4f26f1f234ccf700e9514450432b3840951
data/lib/flickr/client.rb CHANGED
@@ -24,11 +24,6 @@ module Flickr
24
24
  :Upload => "upload",
25
25
  :OAuth => "oauth"
26
26
 
27
- DEFAULTS = {
28
- open_timeout: 8,
29
- timeout: 10,
30
- }
31
-
32
27
  def initialize
33
28
  @connection = Faraday.new(url, connection_options) do |builder|
34
29
  builder.use Flickr::Middleware::CatchTimeout
@@ -82,11 +77,11 @@ module Flickr
82
77
  end
83
78
 
84
79
  def open_timeout
85
- Flickr.open_timeout || DEFAULTS[:open_timeout]
80
+ Flickr.open_timeout
86
81
  end
87
82
 
88
83
  def timeout
89
- Flickr.timeout || DEFAULTS[:timeout]
84
+ Flickr.timeout
90
85
  end
91
86
 
92
87
  def use_ssl?
@@ -50,15 +50,11 @@ module Flickr
50
50
  # Time to wait for the connection to Flickr to open. After that
51
51
  # {Flickr::TimeoutError} is thrown.
52
52
  #
53
- # Default is `5` seconds.
54
- #
55
53
  attr_accessor :open_timeout
56
54
  ##
57
55
  # Time to wait for the first block of response from Flickr. After that
58
56
  # {Flickr::TimeoutError} is thrown.
59
57
  #
60
- # Default is `10` seconds.
61
- #
62
58
  attr_accessor :timeout
63
59
 
64
60
  ##
@@ -129,7 +129,7 @@ module Flickr
129
129
  @attributes["sizes"] && @attributes["sizes"]["size"].find { |h| h["label"] == size.label }
130
130
  end
131
131
 
132
- SIZES.first(9) | sizes.map(&:name) | ["Original"]
132
+ sizes.map(&:name) | ["Original"]
133
133
  },
134
134
  ],
135
135
  largest_size: [
@@ -213,6 +213,19 @@ module Flickr
213
213
  dup.largest!
214
214
  end
215
215
 
216
+ ##
217
+ # Changes the size of the photo.
218
+ #
219
+ def size!(name)
220
+ if name != nil and not Size.exists?(name)
221
+ raise ArgumentError, "\"#{name}\" isn't a valid photo size"
222
+ end
223
+
224
+ @size = Size.new(name)
225
+
226
+ self
227
+ end
228
+
216
229
  ##
217
230
  # @return [self]
218
231
  # @see Flickr::Api::Photo#get_info
@@ -330,21 +343,6 @@ module Flickr
330
343
  api.set_license(id, license_id, params)
331
344
  end
332
345
 
333
- private
334
-
335
- ##
336
- # Changes the size of the photo.
337
- #
338
- def size!(name)
339
- if name != nil and not Size.exists?(name)
340
- raise ArgumentError, "\"#{name}\" isn't a valid photo size"
341
- end
342
-
343
- @size = Size.new(name)
344
-
345
- self
346
- end
347
-
348
346
  end
349
347
 
350
348
  end
@@ -56,6 +56,7 @@ module Flickr
56
56
  def get_photos(params = {})
57
57
  api.get_photos(id, params)
58
58
  end
59
+ alias photos get_photos
59
60
 
60
61
  ##
61
62
  # @return [response]
@@ -36,10 +36,10 @@ module Flickr
36
36
  @file = @original[:tempfile]
37
37
  @content_type = @original[:type]
38
38
  @path = @original[:tempfile].path
39
- elsif file?
39
+ elsif io?
40
40
  @file = @original
41
41
  @content_type = @original.content_type if @original.respond_to?(:content_type)
42
- @path = @original.path
42
+ @path = @original.path if @original.respond_to?(:path)
43
43
  elsif string?
44
44
  @file = File.open(@original)
45
45
  @content_type = nil
@@ -57,8 +57,8 @@ module Flickr
57
57
  defined?(Sinatra) and @original.is_a?(Hash)
58
58
  end
59
59
 
60
- def file?
61
- @original.respond_to?(:read) and @original.respond_to?(:path)
60
+ def io?
61
+ @original.respond_to?(:read)
62
62
  end
63
63
 
64
64
  def string?
@@ -1,5 +1,5 @@
1
1
  module Flickr
2
2
 
3
- VERSION = "0.6.0"
3
+ VERSION = "0.6.1"
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.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-11 00:00:00.000000000 Z
11
+ date: 2015-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday