cloudinary 1.0.84 → 1.0.85
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 +13 -5
- data/CHANGELOG.md +5 -0
- data/Rakefile +1 -1
- data/lib/cloudinary/helper.rb +1 -1
- data/lib/cloudinary/uploader.rb +1 -1
- data/lib/cloudinary/utils.rb +16 -0
- data/lib/cloudinary/version.rb +1 -1
- data/lib/cloudinary/video_helper.rb +1 -5
- metadata +19 -21
- data/lib/cloudinary/active_support/core_ext/hash/keys.rb +0 -166
- data/lib/cloudinary/active_support/core_ext/hash/readme.md +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZTNjODQ0YjA3MzJjMjNhMmEwNzIyZGExNTRiY2JhMGZjZGYyNTI0MQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MjhkM2NkNzk1YTExOWQ0ZjdjMTJlNWIzOTE2YzZhMjE2NWZhNDM5OQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YWM4OGJmYmQxNjc3OGIwYWQ5Y2U4OThhNGJkMDYxNTBlOWNlYzBjZDliYTBm
|
10
|
+
OWIyZmY1MDI4NzlhODIzZmFmNWJkZDQyYTAyOWZmNzc0MzFjMWRlZDUyZGY5
|
11
|
+
ZmYwYjQ5ODFiODM0Y2VlNjViN2JjOTJmODI2ODBiNzk4NWViMjk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NTE4NDkyMGU0ZDk3MDNiNjA0OWMwZDZjNTU1OThjNjI3OTQ3Zjg1ZTkxM2U2
|
14
|
+
MGFjODMxOTBiNDgyYmMyYTdmZmM1Y2FkMWM0ZGZmOWI2MjM3NjUzY2E4ZDhk
|
15
|
+
YTc5OGY1OWIzNTIzYjcwYzRmNmMzZThiZjcwMTI4MTQyOTU3NmY=
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
+
# Version 1.0.85 - 2015-04-08
|
2
|
+
* Remove symoblize_keys intrusive implementation.
|
3
|
+
* Use upload API endpoint instead of upload_chunked.
|
4
|
+
|
1
5
|
# Version 1.0.84 - 2015-03-29
|
2
6
|
* Fixed sources tag url.
|
3
7
|
* Added video thumbnail and video tags to the sample project.
|
4
8
|
* CHANGELOG renamed to CHANGELOG.md
|
9
|
+
|
5
10
|
# Version 1.0.83 - 2015-03-22
|
6
11
|
* Added Video Support
|
7
12
|
* `cl_video_tag` creates an HTML video tag with optionally inner `source` tags
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ task :default => :spec
|
|
7
7
|
Bundler::GemHelper.install_tasks
|
8
8
|
|
9
9
|
task :fetch_assets do
|
10
|
-
system "/bin/rm -rf vendor/assets; mkdir -p vendor/assets; cd vendor/assets; curl -L https://github.com/cloudinary/cloudinary_js/
|
10
|
+
system "/bin/rm -rf vendor/assets; mkdir -p vendor/assets; cd vendor/assets; curl -L https://github.com/cloudinary/cloudinary_js/archive/1.0.23.tar.gz | tar zxvf - --strip=1"
|
11
11
|
system "mkdir -p vendor/assets/javascripts; mv vendor/assets/js vendor/assets/javascripts/cloudinary"
|
12
12
|
File.open("vendor/assets/javascripts/cloudinary/index.js", "w") do
|
13
13
|
|f|
|
data/lib/cloudinary/helper.rb
CHANGED
@@ -197,7 +197,7 @@ module CloudinaryHelper
|
|
197
197
|
end
|
198
198
|
|
199
199
|
def cl_upload_url(options={})
|
200
|
-
Cloudinary::Utils.cloudinary_api_url(
|
200
|
+
Cloudinary::Utils.cloudinary_api_url("upload", {:resource_type=>:auto}.merge(options))
|
201
201
|
end
|
202
202
|
|
203
203
|
def cl_upload_tag_params(options={})
|
data/lib/cloudinary/uploader.rb
CHANGED
@@ -113,7 +113,7 @@ class Cloudinary::Uploader
|
|
113
113
|
# Upload large files. Note that public_id should include an extension for best results.
|
114
114
|
def self.upload_large_part(file, options={})
|
115
115
|
options[:resource_type] ||= :raw
|
116
|
-
call_api("
|
116
|
+
call_api("upload", options) do
|
117
117
|
params = build_upload_params(options)
|
118
118
|
if file.is_a?(Pathname) || !file.respond_to?(:read)
|
119
119
|
params[:file] = File.open(file, "rb")
|
data/lib/cloudinary/utils.rb
CHANGED
@@ -532,4 +532,20 @@ class Cloudinary::Utils
|
|
532
532
|
end
|
533
533
|
end
|
534
534
|
|
535
|
+
def self.deep_symbolize_keys(object)
|
536
|
+
case object
|
537
|
+
when Hash
|
538
|
+
result = {}
|
539
|
+
object.each do |key, value|
|
540
|
+
key = key.to_sym rescue key
|
541
|
+
result[key] = deep_symbolize_keys(value)
|
542
|
+
end
|
543
|
+
result
|
544
|
+
when Array
|
545
|
+
object.map{|e| deep_symbolize_keys(e)}
|
546
|
+
else
|
547
|
+
object
|
548
|
+
end
|
549
|
+
end
|
550
|
+
|
535
551
|
end
|
data/lib/cloudinary/version.rb
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
unless Hash.respond_to?(:deep_symbolize_keys)
|
2
|
-
# required prior to Rails 4
|
3
|
-
require 'cloudinary/active_support/core_ext/hash/keys'
|
4
|
-
end
|
5
1
|
module CloudinaryHelper
|
6
2
|
include ActionView::Helpers::CaptureHelper
|
7
3
|
DEFAULT_POSTER_OPTIONS = { :format => 'jpg', :resource_type => 'video' }
|
@@ -27,7 +23,7 @@ module CloudinaryHelper
|
|
27
23
|
def cl_video_tag(source, options = {}, &block)
|
28
24
|
source = strip_known_ext(source)
|
29
25
|
video_attributes = [:autoplay,:controls,:loop,:muted,:poster, :preload]
|
30
|
-
options = DEFAULT_VIDEO_OPTIONS.merge(options)
|
26
|
+
options = Cloudinary::Utils.deep_symbolize_keys(DEFAULT_VIDEO_OPTIONS.merge(options))
|
31
27
|
|
32
28
|
options[:source_types] ||= DEFAULT_SOURCE_TYPES
|
33
29
|
video_attributes.keep_if{ |key, _| options.has_key?(key)} # required prior to Rails 4.x
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudinary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.85
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nadav Soferman
|
@@ -10,90 +10,90 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-04-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: aws_cf_signer
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ! '>='
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '0'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: rspec
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - ! '>='
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: '2.11'
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - ! '>='
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '2.11'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rspec-rails
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - ! '>='
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - ! '>='
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: rest-client
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - ! '>='
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ! '>='
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: actionpack
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - ! '>='
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: simplecov
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- -
|
89
|
+
- - ! '>='
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
type: :development
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- -
|
96
|
+
- - ! '>='
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
description: Client library for easily using the Cloudinary service
|
@@ -105,16 +105,14 @@ executables: []
|
|
105
105
|
extensions: []
|
106
106
|
extra_rdoc_files: []
|
107
107
|
files:
|
108
|
-
-
|
109
|
-
-
|
108
|
+
- .gitignore
|
109
|
+
- .rspec
|
110
110
|
- CHANGELOG.md
|
111
111
|
- Gemfile
|
112
112
|
- README.md
|
113
113
|
- Rakefile
|
114
114
|
- cloudinary.gemspec
|
115
115
|
- lib/cloudinary.rb
|
116
|
-
- lib/cloudinary/active_support/core_ext/hash/keys.rb
|
117
|
-
- lib/cloudinary/active_support/core_ext/hash/readme.md
|
118
116
|
- lib/cloudinary/api.rb
|
119
117
|
- lib/cloudinary/blob.rb
|
120
118
|
- lib/cloudinary/carrier_wave.rb
|
@@ -171,17 +169,17 @@ require_paths:
|
|
171
169
|
- lib
|
172
170
|
required_ruby_version: !ruby/object:Gem::Requirement
|
173
171
|
requirements:
|
174
|
-
- -
|
172
|
+
- - ! '>='
|
175
173
|
- !ruby/object:Gem::Version
|
176
174
|
version: '0'
|
177
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
176
|
requirements:
|
179
|
-
- -
|
177
|
+
- - ! '>='
|
180
178
|
- !ruby/object:Gem::Version
|
181
179
|
version: '0'
|
182
180
|
requirements: []
|
183
181
|
rubyforge_project: cloudinary
|
184
|
-
rubygems_version: 2.
|
182
|
+
rubygems_version: 2.4.2
|
185
183
|
signing_key:
|
186
184
|
specification_version: 4
|
187
185
|
summary: Client library for easily using the Cloudinary service
|
@@ -1,166 +0,0 @@
|
|
1
|
-
class Hash
|
2
|
-
# Returns a new hash with all keys converted using the block operation.
|
3
|
-
#
|
4
|
-
# hash = { name: 'Rob', age: '28' }
|
5
|
-
#
|
6
|
-
# hash.transform_keys{ |key| key.to_s.upcase }
|
7
|
-
# # => {"NAME"=>"Rob", "AGE"=>"28"}
|
8
|
-
def transform_keys
|
9
|
-
return enum_for(:transform_keys) unless block_given?
|
10
|
-
result = self.class.new
|
11
|
-
each_key do |key|
|
12
|
-
result[yield(key)] = self[key]
|
13
|
-
end
|
14
|
-
result
|
15
|
-
end
|
16
|
-
|
17
|
-
# Destructively convert all keys using the block operations.
|
18
|
-
# Same as transform_keys but modifies +self+.
|
19
|
-
def transform_keys!
|
20
|
-
return enum_for(:transform_keys!) unless block_given?
|
21
|
-
keys.each do |key|
|
22
|
-
self[yield(key)] = delete(key)
|
23
|
-
end
|
24
|
-
self
|
25
|
-
end
|
26
|
-
|
27
|
-
# Returns a new hash with all keys converted to strings.
|
28
|
-
#
|
29
|
-
# hash = { name: 'Rob', age: '28' }
|
30
|
-
#
|
31
|
-
# hash.stringify_keys
|
32
|
-
# # => {"name"=>"Rob", "age"=>"28"}
|
33
|
-
def stringify_keys
|
34
|
-
transform_keys{ |key| key.to_s }
|
35
|
-
end
|
36
|
-
|
37
|
-
# Destructively convert all keys to strings. Same as
|
38
|
-
# +stringify_keys+, but modifies +self+.
|
39
|
-
def stringify_keys!
|
40
|
-
transform_keys!{ |key| key.to_s }
|
41
|
-
end
|
42
|
-
|
43
|
-
# Returns a new hash with all keys converted to symbols, as long as
|
44
|
-
# they respond to +to_sym+.
|
45
|
-
#
|
46
|
-
# hash = { 'name' => 'Rob', 'age' => '28' }
|
47
|
-
#
|
48
|
-
# hash.symbolize_keys
|
49
|
-
# # => {:name=>"Rob", :age=>"28"}
|
50
|
-
def symbolize_keys
|
51
|
-
transform_keys{ |key| key.to_sym rescue key }
|
52
|
-
end
|
53
|
-
alias_method :to_options, :symbolize_keys
|
54
|
-
|
55
|
-
# Destructively convert all keys to symbols, as long as they respond
|
56
|
-
# to +to_sym+. Same as +symbolize_keys+, but modifies +self+.
|
57
|
-
def symbolize_keys!
|
58
|
-
transform_keys!{ |key| key.to_sym rescue key }
|
59
|
-
end
|
60
|
-
alias_method :to_options!, :symbolize_keys!
|
61
|
-
|
62
|
-
# Validate all keys in a hash match <tt>*valid_keys</tt>, raising
|
63
|
-
# ArgumentError on a mismatch.
|
64
|
-
#
|
65
|
-
# Note that keys are treated differently than HashWithIndifferentAccess,
|
66
|
-
# meaning that string and symbol keys will not match.
|
67
|
-
#
|
68
|
-
# { name: 'Rob', years: '28' }.assert_valid_keys(:name, :age) # => raises "ArgumentError: Unknown key: :years. Valid keys are: :name, :age"
|
69
|
-
# { name: 'Rob', age: '28' }.assert_valid_keys('name', 'age') # => raises "ArgumentError: Unknown key: :name. Valid keys are: 'name', 'age'"
|
70
|
-
# { name: 'Rob', age: '28' }.assert_valid_keys(:name, :age) # => passes, raises nothing
|
71
|
-
def assert_valid_keys(*valid_keys)
|
72
|
-
valid_keys.flatten!
|
73
|
-
each_key do |k|
|
74
|
-
unless valid_keys.include?(k)
|
75
|
-
raise ArgumentError.new("Unknown key: #{k.inspect}. Valid keys are: #{valid_keys.map(&:inspect).join(', ')}")
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
# Returns a new hash with all keys converted by the block operation.
|
81
|
-
# This includes the keys from the root hash and from all
|
82
|
-
# nested hashes and arrays.
|
83
|
-
#
|
84
|
-
# hash = { person: { name: 'Rob', age: '28' } }
|
85
|
-
#
|
86
|
-
# hash.deep_transform_keys{ |key| key.to_s.upcase }
|
87
|
-
# # => {"PERSON"=>{"NAME"=>"Rob", "AGE"=>"28"}}
|
88
|
-
def deep_transform_keys(&block)
|
89
|
-
_deep_transform_keys_in_object(self, &block)
|
90
|
-
end
|
91
|
-
|
92
|
-
# Destructively convert all keys by using the block operation.
|
93
|
-
# This includes the keys from the root hash and from all
|
94
|
-
# nested hashes and arrays.
|
95
|
-
def deep_transform_keys!(&block)
|
96
|
-
_deep_transform_keys_in_object!(self, &block)
|
97
|
-
end
|
98
|
-
|
99
|
-
# Returns a new hash with all keys converted to strings.
|
100
|
-
# This includes the keys from the root hash and from all
|
101
|
-
# nested hashes and arrays.
|
102
|
-
#
|
103
|
-
# hash = { person: { name: 'Rob', age: '28' } }
|
104
|
-
#
|
105
|
-
# hash.deep_stringify_keys
|
106
|
-
# # => {"person"=>{"name"=>"Rob", "age"=>"28"}}
|
107
|
-
def deep_stringify_keys
|
108
|
-
deep_transform_keys{ |key| key.to_s }
|
109
|
-
end
|
110
|
-
|
111
|
-
# Destructively convert all keys to strings.
|
112
|
-
# This includes the keys from the root hash and from all
|
113
|
-
# nested hashes and arrays.
|
114
|
-
def deep_stringify_keys!
|
115
|
-
deep_transform_keys!{ |key| key.to_s }
|
116
|
-
end
|
117
|
-
|
118
|
-
# Returns a new hash with all keys converted to symbols, as long as
|
119
|
-
# they respond to +to_sym+. This includes the keys from the root hash
|
120
|
-
# and from all nested hashes and arrays.
|
121
|
-
#
|
122
|
-
# hash = { 'person' => { 'name' => 'Rob', 'age' => '28' } }
|
123
|
-
#
|
124
|
-
# hash.deep_symbolize_keys
|
125
|
-
# # => {:person=>{:name=>"Rob", :age=>"28"}}
|
126
|
-
def deep_symbolize_keys
|
127
|
-
deep_transform_keys{ |key| key.to_sym rescue key }
|
128
|
-
end
|
129
|
-
|
130
|
-
# Destructively convert all keys to symbols, as long as they respond
|
131
|
-
# to +to_sym+. This includes the keys from the root hash and from all
|
132
|
-
# nested hashes and arrays.
|
133
|
-
def deep_symbolize_keys!
|
134
|
-
deep_transform_keys!{ |key| key.to_sym rescue key }
|
135
|
-
end
|
136
|
-
|
137
|
-
private
|
138
|
-
# support methods for deep transforming nested hashes and arrays
|
139
|
-
def _deep_transform_keys_in_object(object, &block)
|
140
|
-
case object
|
141
|
-
when Hash
|
142
|
-
object.each_with_object({}) do |(key, value), result|
|
143
|
-
result[yield(key)] = _deep_transform_keys_in_object(value, &block)
|
144
|
-
end
|
145
|
-
when Array
|
146
|
-
object.map {|e| _deep_transform_keys_in_object(e, &block) }
|
147
|
-
else
|
148
|
-
object
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
def _deep_transform_keys_in_object!(object, &block)
|
153
|
-
case object
|
154
|
-
when Hash
|
155
|
-
object.keys.each do |key|
|
156
|
-
value = object.delete(key)
|
157
|
-
object[yield(key)] = _deep_transform_keys_in_object!(value, &block)
|
158
|
-
end
|
159
|
-
object
|
160
|
-
when Array
|
161
|
-
object.map! {|e| _deep_transform_keys_in_object!(e, &block)}
|
162
|
-
else
|
163
|
-
object
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
Files in this folder are taken from Rails 4.
|