cloudinary 1.4.0 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/CHANGELOG.md +31 -0
- data/cloudinary.gemspec +6 -3
- data/lib/cloudinary.rb +67 -39
- data/lib/cloudinary/api.rb +46 -0
- data/lib/cloudinary/auth_token.rb +68 -0
- data/lib/cloudinary/carrier_wave/remote.rb +3 -3
- data/lib/cloudinary/ostruct2.rb +284 -0
- data/lib/cloudinary/uploader.rb +1 -0
- data/lib/cloudinary/utils.rb +35 -15
- data/lib/cloudinary/version.rb +1 -1
- data/spec/api_spec.rb +63 -21
- data/spec/archive_spec.rb +1 -1
- data/spec/auth_token_spec.rb +82 -0
- data/spec/cloudinary_helper_spec.rb +16 -0
- data/spec/cloudinary_spec.rb +15 -0
- data/spec/utils_methods_spec.rb +0 -33
- metadata +65 -34
- data/lib/cloudinary/akamai.rb +0 -50
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.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nadav Soferman
|
@@ -10,106 +10,134 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-02-22 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
|
-
version: '3.
|
35
|
+
version: '3.5'
|
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
|
-
version: '3.
|
42
|
+
version: '3.5'
|
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
|
-
name:
|
58
|
+
name: rest-client
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - <
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: '0'
|
64
|
-
type: :
|
63
|
+
version: '2.0'
|
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
|
-
version: '0'
|
70
|
+
version: '2.0'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
72
|
+
name: json
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
77
|
+
version: '1.8'
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - ~>
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: '
|
84
|
+
version: '1.8'
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: actionpack
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- -
|
89
|
+
- - <
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version: '0'
|
91
|
+
version: '5.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
|
-
version: '0'
|
98
|
+
version: '5.0'
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: simplecov
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- -
|
103
|
+
- - ! '>='
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: '0'
|
106
106
|
type: :development
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- -
|
110
|
+
- - ! '>='
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: nokogiri
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - <
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 1.7.0
|
120
|
+
type: :development
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - <
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 1.7.0
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: rubyzip
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - <
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 1.2.1
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - <
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: 1.2.1
|
113
141
|
description: Client library for easily using the Cloudinary service
|
114
142
|
email:
|
115
143
|
- nadav.soferman@cloudinary.com
|
@@ -119,9 +147,9 @@ executables: []
|
|
119
147
|
extensions: []
|
120
148
|
extra_rdoc_files: []
|
121
149
|
files:
|
122
|
-
-
|
123
|
-
-
|
124
|
-
-
|
150
|
+
- .gitignore
|
151
|
+
- .rspec
|
152
|
+
- .travis.yml
|
125
153
|
- CHANGELOG.md
|
126
154
|
- CONTRIBUTING.md
|
127
155
|
- Gemfile
|
@@ -129,8 +157,8 @@ files:
|
|
129
157
|
- Rakefile
|
130
158
|
- cloudinary.gemspec
|
131
159
|
- lib/cloudinary.rb
|
132
|
-
- lib/cloudinary/akamai.rb
|
133
160
|
- lib/cloudinary/api.rb
|
161
|
+
- lib/cloudinary/auth_token.rb
|
134
162
|
- lib/cloudinary/blob.rb
|
135
163
|
- lib/cloudinary/carrier_wave.rb
|
136
164
|
- lib/cloudinary/carrier_wave/error.rb
|
@@ -145,6 +173,7 @@ files:
|
|
145
173
|
- lib/cloudinary/helper.rb
|
146
174
|
- lib/cloudinary/migrator.rb
|
147
175
|
- lib/cloudinary/missing.rb
|
176
|
+
- lib/cloudinary/ostruct2.rb
|
148
177
|
- lib/cloudinary/preloaded_file.rb
|
149
178
|
- lib/cloudinary/railtie.rb
|
150
179
|
- lib/cloudinary/static.rb
|
@@ -155,6 +184,7 @@ files:
|
|
155
184
|
- lib/tasks/cloudinary.rake
|
156
185
|
- spec/api_spec.rb
|
157
186
|
- spec/archive_spec.rb
|
187
|
+
- spec/auth_token_spec.rb
|
158
188
|
- spec/cloudinary_helper_spec.rb
|
159
189
|
- spec/cloudinary_spec.rb
|
160
190
|
- spec/docx.docx
|
@@ -189,23 +219,24 @@ require_paths:
|
|
189
219
|
- lib
|
190
220
|
required_ruby_version: !ruby/object:Gem::Requirement
|
191
221
|
requirements:
|
192
|
-
- -
|
222
|
+
- - ! '>='
|
193
223
|
- !ruby/object:Gem::Version
|
194
224
|
version: '0'
|
195
225
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
226
|
requirements:
|
197
|
-
- -
|
227
|
+
- - ! '>='
|
198
228
|
- !ruby/object:Gem::Version
|
199
229
|
version: '0'
|
200
230
|
requirements: []
|
201
231
|
rubyforge_project: cloudinary
|
202
|
-
rubygems_version: 2.4.
|
232
|
+
rubygems_version: 2.4.8
|
203
233
|
signing_key:
|
204
234
|
specification_version: 4
|
205
235
|
summary: Client library for easily using the Cloudinary service
|
206
236
|
test_files:
|
207
237
|
- spec/api_spec.rb
|
208
238
|
- spec/archive_spec.rb
|
239
|
+
- spec/auth_token_spec.rb
|
209
240
|
- spec/cloudinary_helper_spec.rb
|
210
241
|
- spec/cloudinary_spec.rb
|
211
242
|
- spec/docx.docx
|
data/lib/cloudinary/akamai.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'openssl'
|
2
|
-
|
3
|
-
module Cloudinary
|
4
|
-
module Akamai
|
5
|
-
SEPARATOR = '~'
|
6
|
-
|
7
|
-
def self.included(base)
|
8
|
-
base.extend(ClassMethods)
|
9
|
-
end
|
10
|
-
|
11
|
-
module ClassMethods
|
12
|
-
def generate_token(options)
|
13
|
-
key = options[:key] || Cloudinary.config.akamai_key
|
14
|
-
throw "Missing akamai_key configuration" unless key
|
15
|
-
name = options[:token_name] || "__cld_token__"
|
16
|
-
start = options[:start_time]
|
17
|
-
expiration = options[:end_time]
|
18
|
-
ip = options[:ip]
|
19
|
-
acl = options[:acl]
|
20
|
-
window = options[:window]
|
21
|
-
|
22
|
-
start = Time.new.getgm.to_i if start == 'now'
|
23
|
-
unless expiration
|
24
|
-
if window
|
25
|
-
expiration = (start || Time.new.getgm.to_i) + window
|
26
|
-
else
|
27
|
-
throw 'Must provide either end_time or window'
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
token = []
|
32
|
-
token << "ip=#{ip}" if ip
|
33
|
-
token << "st=#{start}" if start
|
34
|
-
token << "exp=#{expiration}"
|
35
|
-
token << "acl=#{acl}"
|
36
|
-
auth = digest(token.join(SEPARATOR), key)
|
37
|
-
token << "hmac=#{auth}"
|
38
|
-
"#{name}=#{token.join(SEPARATOR)}"
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def digest(message, key = Cloudinary.config.akamai_key)
|
44
|
-
bin_key = Array(key).pack("H*")
|
45
|
-
digest = OpenSSL::Digest::SHA256.new
|
46
|
-
OpenSSL::HMAC.hexdigest(digest, bin_key, message)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|