uploadcare-ruby 3.1.0 → 3.1.1

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
  SHA256:
3
- metadata.gz: '08303dd0379957a7780c58d562c2ddbf9ae42e02d8069e19404defb9d7455292'
4
- data.tar.gz: d661a6c49bdcb5b5789b3e22dac0a0a439012f0a1bfc5a55b3cdc0c64094ef8b
3
+ metadata.gz: 50f31851c1ededcc13b14099d5451a2cae8ad1a1c36ce45bbe47447fc536dc3a
4
+ data.tar.gz: 0c5eecb5f2583645455230fb5679c65612e322a4dcae82cae97e5b9fc702dab4
5
5
  SHA512:
6
- metadata.gz: b4b2c4f5342f48908731446e7ca2fa5aabef6568d99dede4ca46f3ed3df13993a156f70f84ac6a87d36799b2d589bc465814c7efeefcbfd6a3e459d3e378814f
7
- data.tar.gz: 0ffba57715c58eeeabc2d2b44884e67d09a5ee41b916fd10248e46822d5b35d3dd5c24c450ec4961a03b5a6f01903a5867007248bd347b88ac3568d89104c592
6
+ metadata.gz: 0a1c5aef9d35b915e2a691ecaed88a1687bba7c7692e6c5066999e1348c5ba0bc9fe76e4afd3eea08da72b57f9a58379a7fc287385a316c6a12e795005e9b66e
7
+ data.tar.gz: 44a5eb8c106bd7b803428d4d8c7ad056b723dfc014baa4e94fd390c0924732a14b3d7ad9e262fa6e7de02a75bca073ee19b8476eda64c86b6fee1817380124c5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.1.1 2021-10-13
4
+
5
+ - Fix Uploadcare::File#store
6
+ - Fix Uploadcare::File#delete
7
+
3
8
  ## 3.1.0 2021-09-21
4
9
 
5
10
  - Added documents and videos conversion
data/README.md CHANGED
@@ -91,7 +91,7 @@ Using Uploadcare is simple, and here are the basics of handling files.
91
91
  # => "dc99200d-9bd6-4b43-bfa9-aa7bfaefca40"
92
92
 
93
93
  # URL for the file, can be used with your website or app right away
94
- @uc_file.cdn_url
94
+ @uc_file.url
95
95
  # => "https://ucarecdn.com/dc99200d-9bd6-4b43-bfa9-aa7bfaefca40/"
96
96
  ```
97
97
 
@@ -184,11 +184,6 @@ You can override global [`:autostore`](#initialization) option for each upload r
184
184
  ```
185
185
 
186
186
  ### File management
187
- Most methods are also available through `Uploadcare::Api` object:
188
- ```ruby
189
- # Same as Uploadcare::Uploader.upload
190
- Uploadcare::Api.upload("https://placekitten.com/96/139")
191
- ```
192
187
 
193
188
  Entities are representations of objects in Uploadcare cloud.
194
189
 
@@ -273,13 +268,13 @@ Metadata of deleted files is stored permanently.
273
268
 
274
269
  #### FileList
275
270
 
276
- `Uploadcare::Entity::FileList` represents the whole collection of files (or it's
271
+ `Uploadcare::FileList` represents the whole collection of files (or it's
277
272
  subset) and provides a way to iterate through it, making pagination transparent.
278
- FileList objects can be created using `Uploadcare::Entity.file_list` method.
273
+ FileList objects can be created using `Uploadcare::FileList.file_list` method.
279
274
 
280
275
  ```ruby
281
- @list = Uploadcare::Entity.file_list
282
- # Returns instance of Uploadcare::Api::FileList
276
+ @list = Uploadcare::FileList.file_list
277
+ # Returns instance of Uploadcare::Entity::FileList
283
278
  <Hashie::Mash
284
279
  next=nil
285
280
  per_page=100
@@ -294,7 +289,7 @@ FileList objects can be created using `Uploadcare::Entity.file_list` method.
294
289
  @all_files = @list.load
295
290
  ```
296
291
 
297
- This method accepts some options to controll which files should be fetched and
292
+ This method accepts some options to control which files should be fetched and
298
293
  how they should be fetched:
299
294
 
300
295
  - **:limit** — Controls page size. Accepts values from 1 to 1000, defaults to 100.
@@ -326,11 +321,11 @@ To simply get all associated objects:
326
321
 
327
322
  Initially, `FileList` is a paginated collection. It can be navigated using following methods:
328
323
  ```ruby
329
- @file_list = Uploadcare::Entity::FileList.file_list
324
+ @file_list = Uploadcare::FileList.file_list
330
325
  # Let's assume there are 250 files in cloud. By default, UC loads 100 files. To get next 100 files, do:
331
326
  @next_page = @file_list.next_page
332
327
  # To get previous page:
333
- @previous_page = @next_page.previous_page
328
+ @previous_page = @file_list.previous_page
334
329
  ```
335
330
 
336
331
  Alternatively, it's possible to iterate through full list of groups or files with `each`:
@@ -351,7 +346,6 @@ That's a requirement of our API.
351
346
  @file = "134dc30c-093e-4f48-a5b9-966fe9cb1d01"
352
347
  @file2 = "134dc30c-093e-4f48-a5b9-966fe9cb1d02"
353
348
  @files_ary = [@file, @file2]
354
- @files = Uploadcare::Uploader.upload @files_ary
355
349
  @group = Uploadcare::Group.create @files
356
350
 
357
351
  # group can be stored by group ID. It means that all files of a group will be stored on Uploadcare servers permanently
@@ -6,7 +6,7 @@ module Uploadcare
6
6
  # @see https://uploadcare.com/docs/api_reference/rest/handling_projects/
7
7
  class ProjectClient < RestClient
8
8
  # get information about current project
9
- # current project is determined by public and private key combination
9
+ # current project is determined by public and secret key combination
10
10
  # @see https://uploadcare.com/api-refs/rest-api/v0.5.0/#tag/Project
11
11
  def show
12
12
  get(uri: '/project/')
@@ -44,7 +44,7 @@ module Uploadcare
44
44
  #
45
45
  # It's possible to avoid loading objects on previous pages by offsetting them first
46
46
  def load
47
- return if @entity[:next].nil? || @entity[:results].length == @entity[:total]
47
+ return self if @entity[:next].nil? || @entity[:results].length == @entity[:total]
48
48
 
49
49
  np = self
50
50
  until np.next.nil?
@@ -91,6 +91,17 @@ module Uploadcare
91
91
  File.copy(uuid, target: target, **args)
92
92
  end
93
93
 
94
+ # Store a single file, preventing it from being deleted in 2 weeks
95
+ # @see https://uploadcare.com/api-refs/rest-api/v0.5.0/#operation/storeFile
96
+ def store
97
+ File.store(uuid)
98
+ end
99
+
100
+ # @see https://uploadcare.com/api-refs/rest-api/v0.5.0/#operation/deleteFile
101
+ def delete
102
+ File.delete(uuid)
103
+ end
104
+
94
105
  private
95
106
 
96
107
  def convert_file(params, converter, options = {})
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uploadcare
4
- VERSION = '3.1.0'
4
+ VERSION = '3.1.1'
5
5
  end
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
38
38
  spec.require_paths = ['lib', 'lib/uploadcare', 'lib/uploadcare/rest']
39
39
 
40
40
  spec.add_dependency 'api_struct', '~> 1.0.1'
41
- spec.add_dependency 'dry-configurable', '~> 0.9.0'
41
+ spec.add_dependency 'dry-configurable', '~> 0.9'
42
42
  spec.add_dependency 'parallel'
43
43
  spec.add_dependency 'retries'
44
44
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uploadcare-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stepan Redka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-21 00:00:00.000000000 Z
11
+ date: 2021-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: api_struct
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.9.0
33
+ version: '0.9'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.9.0
40
+ version: '0.9'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: parallel
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -241,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
241
  - !ruby/object:Gem::Version
242
242
  version: '0'
243
243
  requirements: []
244
- rubygems_version: 3.0.1
244
+ rubygems_version: 3.2.22
245
245
  signing_key:
246
246
  specification_version: 4
247
247
  summary: Ruby wrapper for uploadcare API