uploadcare-ruby 2.1.2 → 3.1.0
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 +4 -4
- data/.github/workflows/gem-push.yml +20 -0
- data/.github/workflows/ruby.yml +52 -0
- data/.gitignore +13 -6
- data/.rspec +2 -0
- data/.rubocop.yml +33 -0
- data/.yardopts +4 -0
- data/CHANGELOG.md +29 -47
- data/DEVELOPMENT.md +18 -0
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/README.md +433 -527
- data/Rakefile +5 -5
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/uploadcare/api/api.rb +25 -0
- data/lib/uploadcare/client/conversion/base_conversion_client.rb +59 -0
- data/lib/uploadcare/client/conversion/document_conversion_client.rb +41 -0
- data/lib/uploadcare/client/conversion/video_conversion_client.rb +46 -0
- data/lib/uploadcare/client/file_client.rb +44 -0
- data/lib/uploadcare/client/file_list_client.rb +46 -0
- data/lib/uploadcare/client/group_client.rb +45 -0
- data/lib/uploadcare/client/multipart_upload/chunks_client.rb +57 -0
- data/lib/uploadcare/client/multipart_upload_client.rb +64 -0
- data/lib/uploadcare/client/project_client.rb +18 -0
- data/lib/uploadcare/client/rest_client.rb +74 -0
- data/lib/uploadcare/client/rest_group_client.rb +23 -0
- data/lib/uploadcare/client/upload_client.rb +43 -0
- data/lib/uploadcare/client/uploader_client.rb +101 -0
- data/lib/uploadcare/client/webhook_client.rb +47 -0
- data/lib/uploadcare/concern/error_handler.rb +54 -0
- data/lib/uploadcare/concern/throttle_handler.rb +25 -0
- data/lib/uploadcare/concern/upload_error_handler.rb +32 -0
- data/lib/uploadcare/entity/conversion/base_converter.rb +36 -0
- data/lib/uploadcare/entity/conversion/document_converter.rb +15 -0
- data/lib/uploadcare/entity/conversion/video_converter.rb +15 -0
- data/lib/uploadcare/entity/decorator/paginator.rb +79 -0
- data/lib/uploadcare/entity/entity.rb +18 -0
- data/lib/uploadcare/entity/file.rb +106 -0
- data/lib/uploadcare/entity/file_list.rb +31 -0
- data/lib/uploadcare/entity/group.rb +40 -0
- data/lib/uploadcare/entity/group_list.rb +24 -0
- data/lib/uploadcare/entity/project.rb +13 -0
- data/lib/uploadcare/entity/uploader.rb +81 -0
- data/lib/uploadcare/entity/webhook.rb +14 -0
- data/lib/uploadcare/exception/conversion_error.rb +8 -0
- data/lib/uploadcare/exception/request_error.rb +9 -0
- data/lib/uploadcare/exception/throttle_error.rb +16 -0
- data/lib/uploadcare/param/authentication_header.rb +25 -0
- data/lib/uploadcare/param/conversion/document/processing_job_url_builder.rb +39 -0
- data/lib/uploadcare/param/conversion/video/processing_job_url_builder.rb +64 -0
- data/lib/uploadcare/param/param.rb +10 -0
- data/lib/uploadcare/param/secure_auth_header.rb +37 -0
- data/lib/uploadcare/param/simple_auth_header.rb +14 -0
- data/lib/uploadcare/param/upload/signature_generator.rb +24 -0
- data/lib/uploadcare/param/upload/upload_params_generator.rb +23 -0
- data/lib/uploadcare/param/user_agent.rb +21 -0
- data/lib/uploadcare/ruby/version.rb +5 -0
- data/lib/uploadcare.rb +36 -32
- data/uploadcare-ruby.gemspec +50 -37
- metadata +107 -113
- data/.travis.yml +0 -26
- data/UPGRADE_NOTES.md +0 -36
- data/lib/uploadcare/api/file_api.rb +0 -7
- data/lib/uploadcare/api/file_list_api.rb +0 -19
- data/lib/uploadcare/api/file_storage_api.rb +0 -34
- data/lib/uploadcare/api/group_api.rb +0 -38
- data/lib/uploadcare/api/group_list_api.rb +0 -17
- data/lib/uploadcare/api/project_api.rb +0 -9
- data/lib/uploadcare/api/raw_api.rb +0 -38
- data/lib/uploadcare/api/uploading_api/upload_params.rb +0 -72
- data/lib/uploadcare/api/uploading_api.rb +0 -71
- data/lib/uploadcare/api/validators/file_list_options_validator.rb +0 -73
- data/lib/uploadcare/api/validators/group_list_options_validator.rb +0 -49
- data/lib/uploadcare/api.rb +0 -26
- data/lib/uploadcare/errors/errors.rb +0 -64
- data/lib/uploadcare/resources/file.rb +0 -164
- data/lib/uploadcare/resources/file_list.rb +0 -14
- data/lib/uploadcare/resources/group.rb +0 -115
- data/lib/uploadcare/resources/group_list.rb +0 -14
- data/lib/uploadcare/resources/project.rb +0 -13
- data/lib/uploadcare/resources/resource_list.rb +0 -83
- data/lib/uploadcare/rest/auth/auth.rb +0 -31
- data/lib/uploadcare/rest/auth/secure.rb +0 -43
- data/lib/uploadcare/rest/auth/simple.rb +0 -16
- data/lib/uploadcare/rest/connections/api_connection.rb +0 -53
- data/lib/uploadcare/rest/connections/upload_connection.rb +0 -22
- data/lib/uploadcare/rest/middlewares/auth_middleware.rb +0 -24
- data/lib/uploadcare/rest/middlewares/parse_json_middleware.rb +0 -33
- data/lib/uploadcare/rest/middlewares/raise_error_middleware.rb +0 -21
- data/lib/uploadcare/utils/parser.rb +0 -71
- data/lib/uploadcare/utils/user_agent.rb +0 -44
- data/lib/uploadcare/version.rb +0 -3
- data/spec/api/file_list_api_spec.rb +0 -95
- data/spec/api/file_storage_api_spec.rb +0 -88
- data/spec/api/group_list_api_spec.rb +0 -59
- data/spec/api/raw_api_spec.rb +0 -25
- data/spec/api/uploading_api/upload_params_spec.rb +0 -99
- data/spec/api/uploading_api_spec.rb +0 -59
- data/spec/resources/file_list_spec.rb +0 -25
- data/spec/resources/file_spec.rb +0 -223
- data/spec/resources/group_list_spec.rb +0 -25
- data/spec/resources/group_spec.rb +0 -101
- data/spec/resources/operations_spec.rb +0 -59
- data/spec/resources/project_spec.rb +0 -21
- data/spec/rest/api_connection_spec.rb +0 -68
- data/spec/rest/auth/secure_spec.rb +0 -66
- data/spec/rest/auth/simple_spec.rb +0 -31
- data/spec/rest/errors_spec.rb +0 -75
- data/spec/rest/upload_connection_spec.rb +0 -19
- data/spec/shared/resource_list.rb +0 -188
- data/spec/spec_helper.rb +0 -54
- data/spec/uploadcare_spec.rb +0 -43
- data/spec/utils/parser_spec.rb +0 -85
- data/spec/utils/user_agent_spec.rb +0 -46
- data/spec/view.png +0 -0
- data/spec/view2.jpg +0 -0
metadata
CHANGED
|
@@ -1,48 +1,45 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: uploadcare-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
8
|
-
- "@dimituri (Dimitry Solovyov)"
|
|
9
|
-
- "@romanonthego (Roman Dubinin)"
|
|
10
|
-
- "@vizvamitra (Dmitrii Krasnov)"
|
|
7
|
+
- Stepan Redka
|
|
11
8
|
autorequire:
|
|
12
|
-
bindir:
|
|
9
|
+
bindir: exe
|
|
13
10
|
cert_chain: []
|
|
14
|
-
date:
|
|
11
|
+
date: 2021-09-21 00:00:00.000000000 Z
|
|
15
12
|
dependencies:
|
|
16
13
|
- !ruby/object:Gem::Dependency
|
|
17
|
-
name:
|
|
14
|
+
name: api_struct
|
|
18
15
|
requirement: !ruby/object:Gem::Requirement
|
|
19
16
|
requirements:
|
|
20
17
|
- - "~>"
|
|
21
18
|
- !ruby/object:Gem::Version
|
|
22
|
-
version:
|
|
19
|
+
version: 1.0.1
|
|
23
20
|
type: :runtime
|
|
24
21
|
prerelease: false
|
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
23
|
requirements:
|
|
27
24
|
- - "~>"
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
29
|
-
version:
|
|
26
|
+
version: 1.0.1
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
|
31
|
-
name:
|
|
28
|
+
name: dry-configurable
|
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
|
33
30
|
requirements:
|
|
34
31
|
- - "~>"
|
|
35
32
|
- !ruby/object:Gem::Version
|
|
36
|
-
version:
|
|
33
|
+
version: 0.9.0
|
|
37
34
|
type: :runtime
|
|
38
35
|
prerelease: false
|
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
40
37
|
requirements:
|
|
41
38
|
- - "~>"
|
|
42
39
|
- !ruby/object:Gem::Version
|
|
43
|
-
version:
|
|
40
|
+
version: 0.9.0
|
|
44
41
|
- !ruby/object:Gem::Dependency
|
|
45
|
-
name:
|
|
42
|
+
name: parallel
|
|
46
43
|
requirement: !ruby/object:Gem::Requirement
|
|
47
44
|
requirements:
|
|
48
45
|
- - ">="
|
|
@@ -56,7 +53,7 @@ dependencies:
|
|
|
56
53
|
- !ruby/object:Gem::Version
|
|
57
54
|
version: '0'
|
|
58
55
|
- !ruby/object:Gem::Dependency
|
|
59
|
-
name:
|
|
56
|
+
name: retries
|
|
60
57
|
requirement: !ruby/object:Gem::Requirement
|
|
61
58
|
requirements:
|
|
62
59
|
- - ">="
|
|
@@ -69,22 +66,50 @@ dependencies:
|
|
|
69
66
|
- - ">="
|
|
70
67
|
- !ruby/object:Gem::Version
|
|
71
68
|
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: byebug
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rake
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '13.0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '13.0'
|
|
72
97
|
- !ruby/object:Gem::Dependency
|
|
73
98
|
name: rspec
|
|
74
99
|
requirement: !ruby/object:Gem::Requirement
|
|
75
100
|
requirements:
|
|
76
101
|
- - "~>"
|
|
77
102
|
- !ruby/object:Gem::Version
|
|
78
|
-
version: '3.
|
|
103
|
+
version: '3.0'
|
|
79
104
|
type: :development
|
|
80
105
|
prerelease: false
|
|
81
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
82
107
|
requirements:
|
|
83
108
|
- - "~>"
|
|
84
109
|
- !ruby/object:Gem::Version
|
|
85
|
-
version: '3.
|
|
110
|
+
version: '3.0'
|
|
86
111
|
- !ruby/object:Gem::Dependency
|
|
87
|
-
name:
|
|
112
|
+
name: rubocop
|
|
88
113
|
requirement: !ruby/object:Gem::Requirement
|
|
89
114
|
requirements:
|
|
90
115
|
- - ">="
|
|
@@ -98,7 +123,7 @@ dependencies:
|
|
|
98
123
|
- !ruby/object:Gem::Version
|
|
99
124
|
version: '0'
|
|
100
125
|
- !ruby/object:Gem::Dependency
|
|
101
|
-
name:
|
|
126
|
+
name: vcr
|
|
102
127
|
requirement: !ruby/object:Gem::Requirement
|
|
103
128
|
requirements:
|
|
104
129
|
- - ">="
|
|
@@ -112,7 +137,7 @@ dependencies:
|
|
|
112
137
|
- !ruby/object:Gem::Version
|
|
113
138
|
version: '0'
|
|
114
139
|
- !ruby/object:Gem::Dependency
|
|
115
|
-
name:
|
|
140
|
+
name: webmock
|
|
116
141
|
requirement: !ruby/object:Gem::Requirement
|
|
117
142
|
requirements:
|
|
118
143
|
- - ">="
|
|
@@ -125,92 +150,86 @@ dependencies:
|
|
|
125
150
|
- - ">="
|
|
126
151
|
- !ruby/object:Gem::Version
|
|
127
152
|
version: '0'
|
|
128
|
-
description:
|
|
129
|
-
Ruby wrapper for Uploadcare service API.
|
|
130
|
-
Full documentations on APIs can be found
|
|
131
|
-
at https://uploadcare.com/documentation/rest/
|
|
132
|
-
and https://uploadcare.com/documentation/upload/
|
|
153
|
+
description: Ruby wrapper for uploadcare API
|
|
133
154
|
email:
|
|
134
|
-
-
|
|
155
|
+
- stepan.redka@railsmuffin.com
|
|
135
156
|
executables: []
|
|
136
157
|
extensions: []
|
|
137
158
|
extra_rdoc_files: []
|
|
138
159
|
files:
|
|
160
|
+
- ".github/workflows/gem-push.yml"
|
|
161
|
+
- ".github/workflows/ruby.yml"
|
|
139
162
|
- ".gitignore"
|
|
140
163
|
- ".rspec"
|
|
141
|
-
- ".
|
|
164
|
+
- ".rubocop.yml"
|
|
165
|
+
- ".yardopts"
|
|
142
166
|
- CHANGELOG.md
|
|
167
|
+
- DEVELOPMENT.md
|
|
143
168
|
- Gemfile
|
|
144
169
|
- LICENSE
|
|
145
170
|
- README.md
|
|
146
171
|
- Rakefile
|
|
147
|
-
-
|
|
172
|
+
- bin/console
|
|
173
|
+
- bin/setup
|
|
148
174
|
- lib/uploadcare.rb
|
|
149
|
-
- lib/uploadcare/api.rb
|
|
150
|
-
- lib/uploadcare/
|
|
151
|
-
- lib/uploadcare/
|
|
152
|
-
- lib/uploadcare/
|
|
153
|
-
- lib/uploadcare/
|
|
154
|
-
- lib/uploadcare/
|
|
155
|
-
- lib/uploadcare/
|
|
156
|
-
- lib/uploadcare/
|
|
157
|
-
- lib/uploadcare/
|
|
158
|
-
- lib/uploadcare/
|
|
159
|
-
- lib/uploadcare/
|
|
160
|
-
- lib/uploadcare/
|
|
161
|
-
- lib/uploadcare/
|
|
162
|
-
- lib/uploadcare/
|
|
163
|
-
- lib/uploadcare/
|
|
164
|
-
- lib/uploadcare/
|
|
165
|
-
- lib/uploadcare/
|
|
166
|
-
- lib/uploadcare/
|
|
167
|
-
- lib/uploadcare/
|
|
168
|
-
- lib/uploadcare/
|
|
169
|
-
- lib/uploadcare/
|
|
170
|
-
- lib/uploadcare/
|
|
171
|
-
- lib/uploadcare/
|
|
172
|
-
- lib/uploadcare/
|
|
173
|
-
- lib/uploadcare/
|
|
174
|
-
- lib/uploadcare/
|
|
175
|
-
- lib/uploadcare/
|
|
176
|
-
- lib/uploadcare/
|
|
177
|
-
- lib/uploadcare/
|
|
178
|
-
- lib/uploadcare/
|
|
179
|
-
-
|
|
180
|
-
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
-
|
|
184
|
-
-
|
|
185
|
-
-
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
- spec/rest/auth/secure_spec.rb
|
|
193
|
-
- spec/rest/auth/simple_spec.rb
|
|
194
|
-
- spec/rest/errors_spec.rb
|
|
195
|
-
- spec/rest/upload_connection_spec.rb
|
|
196
|
-
- spec/shared/resource_list.rb
|
|
197
|
-
- spec/spec_helper.rb
|
|
198
|
-
- spec/uploadcare_spec.rb
|
|
199
|
-
- spec/utils/parser_spec.rb
|
|
200
|
-
- spec/utils/user_agent_spec.rb
|
|
201
|
-
- spec/view.png
|
|
202
|
-
- spec/view2.jpg
|
|
175
|
+
- lib/uploadcare/api/api.rb
|
|
176
|
+
- lib/uploadcare/client/conversion/base_conversion_client.rb
|
|
177
|
+
- lib/uploadcare/client/conversion/document_conversion_client.rb
|
|
178
|
+
- lib/uploadcare/client/conversion/video_conversion_client.rb
|
|
179
|
+
- lib/uploadcare/client/file_client.rb
|
|
180
|
+
- lib/uploadcare/client/file_list_client.rb
|
|
181
|
+
- lib/uploadcare/client/group_client.rb
|
|
182
|
+
- lib/uploadcare/client/multipart_upload/chunks_client.rb
|
|
183
|
+
- lib/uploadcare/client/multipart_upload_client.rb
|
|
184
|
+
- lib/uploadcare/client/project_client.rb
|
|
185
|
+
- lib/uploadcare/client/rest_client.rb
|
|
186
|
+
- lib/uploadcare/client/rest_group_client.rb
|
|
187
|
+
- lib/uploadcare/client/upload_client.rb
|
|
188
|
+
- lib/uploadcare/client/uploader_client.rb
|
|
189
|
+
- lib/uploadcare/client/webhook_client.rb
|
|
190
|
+
- lib/uploadcare/concern/error_handler.rb
|
|
191
|
+
- lib/uploadcare/concern/throttle_handler.rb
|
|
192
|
+
- lib/uploadcare/concern/upload_error_handler.rb
|
|
193
|
+
- lib/uploadcare/entity/conversion/base_converter.rb
|
|
194
|
+
- lib/uploadcare/entity/conversion/document_converter.rb
|
|
195
|
+
- lib/uploadcare/entity/conversion/video_converter.rb
|
|
196
|
+
- lib/uploadcare/entity/decorator/paginator.rb
|
|
197
|
+
- lib/uploadcare/entity/entity.rb
|
|
198
|
+
- lib/uploadcare/entity/file.rb
|
|
199
|
+
- lib/uploadcare/entity/file_list.rb
|
|
200
|
+
- lib/uploadcare/entity/group.rb
|
|
201
|
+
- lib/uploadcare/entity/group_list.rb
|
|
202
|
+
- lib/uploadcare/entity/project.rb
|
|
203
|
+
- lib/uploadcare/entity/uploader.rb
|
|
204
|
+
- lib/uploadcare/entity/webhook.rb
|
|
205
|
+
- lib/uploadcare/exception/conversion_error.rb
|
|
206
|
+
- lib/uploadcare/exception/request_error.rb
|
|
207
|
+
- lib/uploadcare/exception/throttle_error.rb
|
|
208
|
+
- lib/uploadcare/param/authentication_header.rb
|
|
209
|
+
- lib/uploadcare/param/conversion/document/processing_job_url_builder.rb
|
|
210
|
+
- lib/uploadcare/param/conversion/video/processing_job_url_builder.rb
|
|
211
|
+
- lib/uploadcare/param/param.rb
|
|
212
|
+
- lib/uploadcare/param/secure_auth_header.rb
|
|
213
|
+
- lib/uploadcare/param/simple_auth_header.rb
|
|
214
|
+
- lib/uploadcare/param/upload/signature_generator.rb
|
|
215
|
+
- lib/uploadcare/param/upload/upload_params_generator.rb
|
|
216
|
+
- lib/uploadcare/param/user_agent.rb
|
|
217
|
+
- lib/uploadcare/ruby/version.rb
|
|
203
218
|
- uploadcare-ruby.gemspec
|
|
204
|
-
homepage: https://
|
|
219
|
+
homepage: https://github.com/uploadcare/uploadcare-ruby
|
|
205
220
|
licenses:
|
|
206
221
|
- MIT
|
|
207
222
|
metadata:
|
|
208
|
-
|
|
209
|
-
|
|
223
|
+
allowed_push_host: https://rubygems.org
|
|
224
|
+
homepage_uri: https://github.com/uploadcare/uploadcare-ruby
|
|
225
|
+
source_code_uri: https://github.com/uploadcare/uploadcare-ruby
|
|
226
|
+
changelog_uri: https://github.com/uploadcare/uploadcare-ruby/CHANGELOG.md
|
|
210
227
|
post_install_message:
|
|
211
228
|
rdoc_options: []
|
|
212
229
|
require_paths:
|
|
213
230
|
- lib
|
|
231
|
+
- lib/uploadcare
|
|
232
|
+
- lib/uploadcare/rest
|
|
214
233
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
215
234
|
requirements:
|
|
216
235
|
- - ">="
|
|
@@ -222,33 +241,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
222
241
|
- !ruby/object:Gem::Version
|
|
223
242
|
version: '0'
|
|
224
243
|
requirements: []
|
|
225
|
-
|
|
226
|
-
rubygems_version: 2.7.7
|
|
244
|
+
rubygems_version: 3.0.1
|
|
227
245
|
signing_key:
|
|
228
246
|
specification_version: 4
|
|
229
|
-
summary: Ruby
|
|
230
|
-
test_files:
|
|
231
|
-
- spec/api/file_list_api_spec.rb
|
|
232
|
-
- spec/api/file_storage_api_spec.rb
|
|
233
|
-
- spec/api/group_list_api_spec.rb
|
|
234
|
-
- spec/api/raw_api_spec.rb
|
|
235
|
-
- spec/api/uploading_api/upload_params_spec.rb
|
|
236
|
-
- spec/api/uploading_api_spec.rb
|
|
237
|
-
- spec/resources/file_list_spec.rb
|
|
238
|
-
- spec/resources/file_spec.rb
|
|
239
|
-
- spec/resources/group_list_spec.rb
|
|
240
|
-
- spec/resources/group_spec.rb
|
|
241
|
-
- spec/resources/operations_spec.rb
|
|
242
|
-
- spec/resources/project_spec.rb
|
|
243
|
-
- spec/rest/api_connection_spec.rb
|
|
244
|
-
- spec/rest/auth/secure_spec.rb
|
|
245
|
-
- spec/rest/auth/simple_spec.rb
|
|
246
|
-
- spec/rest/errors_spec.rb
|
|
247
|
-
- spec/rest/upload_connection_spec.rb
|
|
248
|
-
- spec/shared/resource_list.rb
|
|
249
|
-
- spec/spec_helper.rb
|
|
250
|
-
- spec/uploadcare_spec.rb
|
|
251
|
-
- spec/utils/parser_spec.rb
|
|
252
|
-
- spec/utils/user_agent_spec.rb
|
|
253
|
-
- spec/view.png
|
|
254
|
-
- spec/view2.jpg
|
|
247
|
+
summary: Ruby wrapper for uploadcare API
|
|
248
|
+
test_files: []
|
data/.travis.yml
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# currently supported rubies: https://www.ruby-lang.org/en/downloads/branches/
|
|
2
|
-
|
|
3
|
-
language: ruby
|
|
4
|
-
|
|
5
|
-
rvm:
|
|
6
|
-
- 1.9.3
|
|
7
|
-
- 2.2
|
|
8
|
-
- 2.3
|
|
9
|
-
- 2.4
|
|
10
|
-
- ruby-head
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
include:
|
|
14
|
-
- stage: style checks
|
|
15
|
-
rvm: 2.4
|
|
16
|
-
before_install:
|
|
17
|
-
- gem install rubocop
|
|
18
|
-
script:
|
|
19
|
-
- rubocop
|
|
20
|
-
|
|
21
|
-
allow_failures:
|
|
22
|
-
- stage: style checks
|
|
23
|
-
- rvm: ruby-head
|
|
24
|
-
|
|
25
|
-
before_install:
|
|
26
|
-
- gem update bundler
|
data/UPGRADE_NOTES.md
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Upgrade notes
|
|
2
|
-
|
|
3
|
-
## v1.* -> v2.*
|
|
4
|
-
|
|
5
|
-
In 2.* release we've moved to [REST API v0.5][uploadcare-changelog-rest-api-v05] which introduces a new pagination for `/files/` and `/groups/` endpoints, so `Uploadcare::Api::FileList` and `Uploadcare::Api::GroupList` were completely reimplemented.
|
|
6
|
-
|
|
7
|
-
Previously, the file/group list API was:
|
|
8
|
-
|
|
9
|
-
```ruby
|
|
10
|
-
# creating
|
|
11
|
-
list = api.file_list # => #<Uploadcare::Api::FileList page=1 ...>
|
|
12
|
-
|
|
13
|
-
# accessing files/groups
|
|
14
|
-
list.results # => [#<Uploadcare::Api::File>, ...]
|
|
15
|
-
|
|
16
|
-
# pagination
|
|
17
|
-
list.next_page # => #<Uploadcare::Api::FileList page=2 ...>
|
|
18
|
-
list.previous_page # => #<Uploadcare::Api::FileList page=1 ...>
|
|
19
|
-
list.go_to 5 # => #<Uploadcare::Api::FileList page=5 ...>
|
|
20
|
-
|
|
21
|
-
# metadata
|
|
22
|
-
list.pages # => 15
|
|
23
|
-
list.page # => 5
|
|
24
|
-
list.total # => 308 (files in a project)
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
It **won't work anymore**. For the details on the new file/group lists interface see [readme][readme]
|
|
28
|
-
|
|
29
|
-
The core features of the new file/group list API are:
|
|
30
|
-
|
|
31
|
-
- transparent pagination via enumerable interface
|
|
32
|
-
- loading objects on demand
|
|
33
|
-
- ordering, filtering and slicing
|
|
34
|
-
|
|
35
|
-
[uploadcare-changelog-rest-api-v05]: https://uploadcare.com/changelog/tag/rest-api#rest-api-version-05
|
|
36
|
-
[readme]: https://github.com/uploadcare/uploadcare-ruby#file-lists
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
module Uploadcare
|
|
2
|
-
module FileListApi
|
|
3
|
-
# Available options:
|
|
4
|
-
#
|
|
5
|
-
# limit -- a number of objects retrieved per request. Default: 100
|
|
6
|
-
# ordering -- sorting order of files in a list. Default: datetime_uploaded
|
|
7
|
-
# from -- a starting point for filtering files.
|
|
8
|
-
# stored -- true to include only stored files, false to exclude.
|
|
9
|
-
# removed -- true to include only removed files, false to exclude. Default: false
|
|
10
|
-
#
|
|
11
|
-
# Documentation: http://uploadcare.com/documentation/rest/#file-files
|
|
12
|
-
def file_list options={}
|
|
13
|
-
Validators::FileListOptionsValidator.new(options).validate
|
|
14
|
-
|
|
15
|
-
data = get '/files/', options
|
|
16
|
-
Uploadcare::Api::FileList.new self, data, options
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
module Uploadcare
|
|
2
|
-
module FileStorageApi
|
|
3
|
-
MAX_BATCH_SIZE = 100
|
|
4
|
-
UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/
|
|
5
|
-
|
|
6
|
-
def store_files(objects)
|
|
7
|
-
if objects.size > MAX_BATCH_SIZE
|
|
8
|
-
raise ArgumentError, "Up to #{MAX_BATCH_SIZE} files are supported per request, #{objects.size} given"
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
put "/files/storage/", to_uuids(objects)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def delete_files(objects)
|
|
15
|
-
if objects.size > MAX_BATCH_SIZE
|
|
16
|
-
raise ArgumentError, "Up to #{MAX_BATCH_SIZE} files are supported per request, #{objects.size} given"
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
delete "/files/storage/", to_uuids(objects)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
def to_uuids(objects)
|
|
25
|
-
objects.map do |object|
|
|
26
|
-
case object
|
|
27
|
-
when Uploadcare::Api::File then object.uuid
|
|
28
|
-
when UUID_REGEX then object
|
|
29
|
-
else raise(ArgumentError, "Unable to convert object to uuid: #{object}")
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
module Uploadcare
|
|
2
|
-
module GroupApi
|
|
3
|
-
|
|
4
|
-
def group uuid_or_cdn_url
|
|
5
|
-
group = Uploadcare::Api::Group.new self, uuid_or_cdn_url
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def create_group ary
|
|
10
|
-
unless ary.kind_of?(Array)
|
|
11
|
-
raise ArgumentError.new "You should send and array of files or valid UUIDs"
|
|
12
|
-
else
|
|
13
|
-
if ary.select {|f| !!f.kind_of?(Uploadcare::Api::File) }.any?
|
|
14
|
-
files = Hash.new
|
|
15
|
-
ary.each_with_index do |file, i|
|
|
16
|
-
files["files[#{i}]"] = file.uuid
|
|
17
|
-
end
|
|
18
|
-
elsif ary.select {|f| !!f.kind_of?(String) }.any?
|
|
19
|
-
files = Hash.new
|
|
20
|
-
ary.each_with_index do |uuid, i|
|
|
21
|
-
files["files[#{i}]"] = uuid
|
|
22
|
-
end
|
|
23
|
-
else
|
|
24
|
-
raise ArgumentError.new "You should send and array of files or valid UUIDs"
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
data = {
|
|
30
|
-
pub_key: @options[:public_key],
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
data.merge! files
|
|
34
|
-
post = @upload_connection.send :post, "/group/", data
|
|
35
|
-
group = Uploadcare::Api::Group.new self, post.body["id"], post.body
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
module Uploadcare
|
|
2
|
-
module GroupListApi
|
|
3
|
-
# Available options:
|
|
4
|
-
#
|
|
5
|
-
# limit -- a number of objects retrieved per request. Default: 100
|
|
6
|
-
# ordering -- sorting order of groups in a list. Default: datetime_creataed
|
|
7
|
-
# from -- a starting point for filtering groups.
|
|
8
|
-
#
|
|
9
|
-
# Documentation: http://uploadcare.com/documentation/rest/#group-groups
|
|
10
|
-
def group_list options={}
|
|
11
|
-
Validators::GroupListOptionsValidator.new(options).validate
|
|
12
|
-
|
|
13
|
-
data = get '/groups/', options
|
|
14
|
-
list = Uploadcare::Api::GroupList.new self, data, options
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
|
|
3
|
-
module Uploadcare
|
|
4
|
-
module RawApi
|
|
5
|
-
def initialize(options = {})
|
|
6
|
-
@options = Uploadcare::default_settings.merge(options)
|
|
7
|
-
@api_connection = Uploadcare::Connections::ApiConnection.new(@options)
|
|
8
|
-
@upload_connection = Uploadcare::Connections::UploadConnection.new(@options)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
# basic request method
|
|
12
|
-
def request(method = :get, path = '/files/', params = {})
|
|
13
|
-
response = @api_connection.send method, path, params
|
|
14
|
-
response.body
|
|
15
|
-
end
|
|
16
|
-
alias_method :api_request, :request
|
|
17
|
-
|
|
18
|
-
# request with GET verb
|
|
19
|
-
def get(path = '/files/', params = {})
|
|
20
|
-
request :get, path, params
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# request with POST verb
|
|
24
|
-
def post(path = '/files/', params = {})
|
|
25
|
-
request :post, path, params
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# request with PUT verb
|
|
29
|
-
def put(path = '/files/', params = {})
|
|
30
|
-
request :put, path, params
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# request with DELETE verb
|
|
34
|
-
def delete(path = '/files/', params = {})
|
|
35
|
-
request :delete, path, params
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
require 'uri'
|
|
2
|
-
require 'mime/types'
|
|
3
|
-
|
|
4
|
-
module Uploadcare
|
|
5
|
-
module UploadingApi
|
|
6
|
-
class UploadParams
|
|
7
|
-
def initialize(global_options, request_options)
|
|
8
|
-
@global_options = global_options
|
|
9
|
-
@request_options = request_options
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def for_url_upload(url)
|
|
13
|
-
{
|
|
14
|
-
source_url: parse_url(url),
|
|
15
|
-
pub_key: public_key,
|
|
16
|
-
store: store
|
|
17
|
-
}.reject { |k, v| v.nil? }
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def for_file_upload(files)
|
|
21
|
-
{
|
|
22
|
-
UPLOADCARE_PUB_KEY: public_key,
|
|
23
|
-
UPLOADCARE_STORE: store
|
|
24
|
-
}.reject { |k, v| v.nil? }.merge(file_params(files))
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
private
|
|
28
|
-
|
|
29
|
-
attr_reader :global_options, :request_options
|
|
30
|
-
|
|
31
|
-
def public_key
|
|
32
|
-
global_options[:public_key]
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def store
|
|
36
|
-
mapping = { true => 1, false => 0, auto: 'auto' }
|
|
37
|
-
|
|
38
|
-
global_value = global_options[:autostore]
|
|
39
|
-
per_request_value = request_options[:store]
|
|
40
|
-
|
|
41
|
-
mapping[per_request_value] || mapping[global_value]
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def file_params(files)
|
|
45
|
-
Hash[files.map.with_index { |file, i| ["file[#{i}]", build_upload_io(file)] }]
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def parse_url(url)
|
|
49
|
-
uri = URI.parse(url)
|
|
50
|
-
|
|
51
|
-
unless uri.is_a?(URI::HTTP) # will also be true for https
|
|
52
|
-
raise ArgumentError, 'invalid url was given'
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
uri
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def build_upload_io(file)
|
|
59
|
-
unless file.is_a?(File)
|
|
60
|
-
raise ArgumentError, "expected File object, #{file} given"
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
Faraday::UploadIO.new file.path, extract_mime_type(file)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def extract_mime_type file
|
|
67
|
-
types = MIME::Types.of(file.path)
|
|
68
|
-
types[0].content_type
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|