uploadcare-ruby 2.1.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- 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 +20 -0
- data/.yardopts +4 -0
- data/CHANGELOG.md +24 -51
- data/DEVELOPMENT.md +18 -0
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/README.md +164 -578
- data/Rakefile +5 -5
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/uploadcare.rb +36 -32
- data/lib/uploadcare/api/api.rb +25 -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 +46 -0
- data/lib/uploadcare/client/multipart_upload_client.rb +62 -0
- data/lib/uploadcare/client/project_client.rb +18 -0
- data/lib/uploadcare/client/rest_client.rb +73 -0
- data/lib/uploadcare/client/rest_group_client.rb +23 -0
- data/lib/uploadcare/client/upload_client.rb +35 -0
- data/lib/uploadcare/client/uploader_client.rb +93 -0
- data/lib/uploadcare/client/webhook_client.rb +43 -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/decorator/paginator.rb +81 -0
- data/lib/uploadcare/entity/entity.rb +18 -0
- data/lib/uploadcare/entity/file.rb +81 -0
- data/lib/uploadcare/entity/file_list.rb +30 -0
- data/lib/uploadcare/entity/group.rb +41 -0
- data/lib/uploadcare/entity/group_list.rb +24 -0
- data/lib/uploadcare/entity/project.rb +13 -0
- data/lib/uploadcare/entity/uploader.rb +73 -0
- data/lib/uploadcare/entity/webhook.rb +14 -0
- data/lib/uploadcare/exception/request_error.rb +9 -0
- data/lib/uploadcare/exception/throttle_error.rb +14 -0
- data/lib/uploadcare/param/authentication_header.rb +25 -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/uploadcare-ruby.gemspec +50 -37
- metadata +98 -113
- data/.travis.yml +0 -26
- data/UPGRADE_NOTES.md +0 -36
- data/lib/uploadcare/api.rb +0 -26
- 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.rb +0 -71
- data/lib/uploadcare/api/uploading_api/upload_params.rb +0 -72
- 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/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.0.3
|
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-04-15 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,77 @@ 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
|
-
- spec/api/uploading_api/upload_params_spec.rb
|
184
|
-
- spec/api/uploading_api_spec.rb
|
185
|
-
- spec/resources/file_list_spec.rb
|
186
|
-
- spec/resources/file_spec.rb
|
187
|
-
- spec/resources/group_list_spec.rb
|
188
|
-
- spec/resources/group_spec.rb
|
189
|
-
- spec/resources/operations_spec.rb
|
190
|
-
- spec/resources/project_spec.rb
|
191
|
-
- spec/rest/api_connection_spec.rb
|
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/file_client.rb
|
177
|
+
- lib/uploadcare/client/file_list_client.rb
|
178
|
+
- lib/uploadcare/client/group_client.rb
|
179
|
+
- lib/uploadcare/client/multipart_upload/chunks_client.rb
|
180
|
+
- lib/uploadcare/client/multipart_upload_client.rb
|
181
|
+
- lib/uploadcare/client/project_client.rb
|
182
|
+
- lib/uploadcare/client/rest_client.rb
|
183
|
+
- lib/uploadcare/client/rest_group_client.rb
|
184
|
+
- lib/uploadcare/client/upload_client.rb
|
185
|
+
- lib/uploadcare/client/uploader_client.rb
|
186
|
+
- lib/uploadcare/client/webhook_client.rb
|
187
|
+
- lib/uploadcare/concern/error_handler.rb
|
188
|
+
- lib/uploadcare/concern/throttle_handler.rb
|
189
|
+
- lib/uploadcare/concern/upload_error_handler.rb
|
190
|
+
- lib/uploadcare/entity/decorator/paginator.rb
|
191
|
+
- lib/uploadcare/entity/entity.rb
|
192
|
+
- lib/uploadcare/entity/file.rb
|
193
|
+
- lib/uploadcare/entity/file_list.rb
|
194
|
+
- lib/uploadcare/entity/group.rb
|
195
|
+
- lib/uploadcare/entity/group_list.rb
|
196
|
+
- lib/uploadcare/entity/project.rb
|
197
|
+
- lib/uploadcare/entity/uploader.rb
|
198
|
+
- lib/uploadcare/entity/webhook.rb
|
199
|
+
- lib/uploadcare/exception/request_error.rb
|
200
|
+
- lib/uploadcare/exception/throttle_error.rb
|
201
|
+
- lib/uploadcare/param/authentication_header.rb
|
202
|
+
- lib/uploadcare/param/param.rb
|
203
|
+
- lib/uploadcare/param/secure_auth_header.rb
|
204
|
+
- lib/uploadcare/param/simple_auth_header.rb
|
205
|
+
- lib/uploadcare/param/upload/signature_generator.rb
|
206
|
+
- lib/uploadcare/param/upload/upload_params_generator.rb
|
207
|
+
- lib/uploadcare/param/user_agent.rb
|
208
|
+
- lib/uploadcare/ruby/version.rb
|
203
209
|
- uploadcare-ruby.gemspec
|
204
|
-
homepage: https://
|
210
|
+
homepage: https://github.com/uploadcare/uploadcare-ruby
|
205
211
|
licenses:
|
206
212
|
- MIT
|
207
213
|
metadata:
|
208
|
-
|
209
|
-
|
214
|
+
allowed_push_host: https://rubygems.org
|
215
|
+
homepage_uri: https://github.com/uploadcare/uploadcare-ruby
|
216
|
+
source_code_uri: https://github.com/uploadcare/uploadcare-ruby
|
217
|
+
changelog_uri: https://github.com/uploadcare/uploadcare-ruby/CHANGELOG.md
|
210
218
|
post_install_message:
|
211
219
|
rdoc_options: []
|
212
220
|
require_paths:
|
213
221
|
- lib
|
222
|
+
- lib/uploadcare
|
223
|
+
- lib/uploadcare/rest
|
214
224
|
required_ruby_version: !ruby/object:Gem::Requirement
|
215
225
|
requirements:
|
216
226
|
- - ">="
|
@@ -222,33 +232,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
232
|
- !ruby/object:Gem::Version
|
223
233
|
version: '0'
|
224
234
|
requirements: []
|
225
|
-
|
226
|
-
rubygems_version: 2.7.7
|
235
|
+
rubygems_version: 3.0.1
|
227
236
|
signing_key:
|
228
237
|
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
|
238
|
+
summary: Ruby wrapper for uploadcare API
|
239
|
+
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
|
data/lib/uploadcare/api.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'ostruct'
|
3
|
-
Dir[File.dirname(__FILE__) + '/utils/*.rb'].each {|file| require file }
|
4
|
-
Dir[File.dirname(__FILE__) + '/errors/*.rb'].each {|file| require file }
|
5
|
-
Dir[File.dirname(__FILE__) + '/rest/middlewares/*.rb'].each {|file| require file }
|
6
|
-
Dir[File.dirname(__FILE__) + '/rest/connections/*.rb'].each {|file| require file }
|
7
|
-
Dir[File.dirname(__FILE__) + '/rest/auth/*.rb'].sort.each {|file| require file }
|
8
|
-
Dir[File.dirname(__FILE__) + '/api/validators/*.rb'].each {|file| require file }
|
9
|
-
Dir[File.dirname(__FILE__) + '/api/*.rb'].each {|file| require file }
|
10
|
-
Dir[File.dirname(__FILE__) + '/resources/*.rb'].each {|file| require file }
|
11
|
-
|
12
|
-
|
13
|
-
module Uploadcare
|
14
|
-
class Api
|
15
|
-
attr_reader :options
|
16
|
-
|
17
|
-
include Uploadcare::RawApi
|
18
|
-
include Uploadcare::UploadingApi
|
19
|
-
include Uploadcare::FileApi
|
20
|
-
include Uploadcare::ProjectApi
|
21
|
-
include Uploadcare::FileListApi
|
22
|
-
include Uploadcare::GroupApi
|
23
|
-
include Uploadcare::GroupListApi
|
24
|
-
include Uploadcare::FileStorageApi
|
25
|
-
end
|
26
|
-
end
|
@@ -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
|