shrine-cloudinary 0.4.2 → 0.5.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: 705e20f18504b9412177cdb7fa61da3460d9f54d
4
- data.tar.gz: a3848b2726032c48c48dd0f8430c476100ab14ab
3
+ metadata.gz: 0a16ba989d270ce7bad7ae78f8ee4de14653611e
4
+ data.tar.gz: e637b6622916f412f65dff91778d835d9d7e43f4
5
5
  SHA512:
6
- metadata.gz: ac24a2656d36fc87a70473ad498ea7b744a52d4616caf161fc97464bdd7d96b7f0a09493ca5301f5345b1303419b9112788f8189d468f733f1aa8367d5cd35b4
7
- data.tar.gz: 07901084386db42a2fe37e1a2090fe730e697097444cb04e5b3f2b8ce78e7950af70dbe88d0be3ee6726ffdec0b6e11549c136f4ae462d35c3c2bb1847efcc49
6
+ metadata.gz: 81ab2d08a2885910ba4a1b7db14a3e41ea7fdef6082f229db32732bae0e5532e46ec4a55d3a05c4af0aec6b44cb020ea5bfb852041a0932be557c9c319d4700c
7
+ data.tar.gz: 1edc5b32d58aa6252e18f0894b01e5d7a565b67e91b02fb3e2033f71ab24947527db603c6eec1de0f0c730edc3acc782da8266fdf826dcd2ff9aed62843a4924
data/README.md CHANGED
@@ -3,7 +3,8 @@
3
3
  Provides [Cloudinary] storage for [Shrine].
4
4
 
5
5
  Cloudinary provides storage and advanced processing for images and videos, both
6
- on-demand and on upload, and an HTML widget for direct uploads.
6
+ on-demand and on upload, automatic and intelligent responsive breakpoints, and
7
+ an HTML widget for direct uploads.
7
8
 
8
9
  ## Installation
9
10
 
@@ -129,12 +130,19 @@ class MyUploader < Shrine
129
130
  end
130
131
  ```
131
132
 
133
+ Finally, you can pass upload options when using the uploader directly:
134
+
135
+ ```rb
136
+ uploader.upload(file, upload_options: {format: "png"})
137
+ ```
138
+
132
139
  ### URLs
133
140
 
134
141
  You can pass transformation options to the URLs:
135
142
 
136
143
  ```rb
137
144
  user.avatar_url(width: 100, height: 100, crop: :fit) # :crop is mandatory with :width or :height
145
+ #=> "https://res.cloudinary.com/myapp/image/upload/w_100,h_100,c_fit/nature.jpg"
138
146
  ```
139
147
 
140
148
  See [Rails image manipulation] for all URL options you can pass in.
@@ -181,20 +189,35 @@ for images. In Shrine you can leverage this via `:upload_options` and
181
189
 
182
190
  ```rb
183
191
  Shrine::Storage::Cloudinary.new(
184
- store_data: true,
185
192
  upload_options: {responsive_breakpoints: {...}},
186
- **cloudinary_options
193
+ store_data: true,
187
194
  )
188
195
  ```
189
196
 
190
197
  Now each upload will generate responsive breakpoints, and the result will be
191
198
  saved in the uploaded file's metadata hash under "cloudinary".
192
199
 
200
+ ```rb
201
+ user.avatar.metadata["cloudinary"]["responsive_breakpoints"] #=>
202
+ # [{
203
+ # "breakpoints": {
204
+ # {
205
+ # "width": 1000,
206
+ # "height": 667,
207
+ # "bytes": 79821,
208
+ # "url": "http://res.cloudinary.com/demo/image/upload/c_scale,w_1000/v1453637947/dog.jpg",
209
+ # "secure_url": "https://res.cloudinary.com/demo/image/upload/c_scale,w_1000/v1453637947/dog.jpg"
210
+ # },
211
+ # ...
212
+ # }
213
+ # }]
214
+ ```
215
+
193
216
  If the `:responsive_breakpoints` value needs to be dynamic, you can use the
194
- upload_options plugin:
217
+ `upload_options` plugin:
195
218
 
196
219
  ```rb
197
- Shrine.plugin :upload_options, store: ->(io, context) do
220
+ Shrine.plugin :upload_options, store: -> (io, context) do
198
221
  {responsive_breakpoints: {...}}
199
222
  end
200
223
  ```
@@ -30,10 +30,6 @@ class Shrine
30
30
  result
31
31
  end
32
32
 
33
- def download(id)
34
- Down.download(url(id))
35
- end
36
-
37
33
  def update(id, **options)
38
34
  ::Cloudinary::Uploader.explicit(public_id(id), default_options.merge(options))
39
35
  end
@@ -50,10 +46,6 @@ class Shrine
50
46
  Down.open(url(id))
51
47
  end
52
48
 
53
- def read(id)
54
- ::Cloudinary::Downloader.download(url(id), default_options)
55
- end
56
-
57
49
  def exists?(id)
58
50
  result = ::Cloudinary::Api.resources_by_ids([public_id(id)], default_options)
59
51
  result.fetch("resources").any?
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "shrine-cloudinary"
3
- gem.version = "0.4.2"
3
+ gem.version = "0.5.0"
4
4
 
5
5
  gem.required_ruby_version = ">= 2.1"
6
6
 
@@ -13,8 +13,8 @@ Gem::Specification.new do |gem|
13
13
  gem.files = Dir["README.md", "LICENSE.txt", "lib/**/*.rb", "*.gemspec"]
14
14
  gem.require_path = "lib"
15
15
 
16
- gem.add_dependency "shrine", "~> 2.0"
17
- gem.add_dependency "cloudinary", ">= 1.1.7", "< 2"
16
+ gem.add_dependency "shrine", "~> 2.2"
17
+ gem.add_dependency "cloudinary", ">= 1.1.7", "< 1.7.0"
18
18
  gem.add_dependency "down", ">= 2.3.3"
19
19
 
20
20
  gem.add_development_dependency "rake"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shrine-cloudinary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.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: 2016-06-24 00:00:00.000000000 Z
11
+ date: 2017-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shrine
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '2.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: '2.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cloudinary
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: 1.1.7
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '2'
36
+ version: 1.7.0
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 1.1.7
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: '2'
46
+ version: 1.7.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: down
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -131,9 +131,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  requirements: []
133
133
  rubyforge_project:
134
- rubygems_version: 2.5.1
134
+ rubygems_version: 2.6.11
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Provides Cloudinary storage for Shrine.
138
138
  test_files: []
139
- has_rdoc: