uploadcare-ruby 4.3.2 → 4.3.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8676f15043bd23347f7ad31f86969d496244e920d4d081c2a60a67ae2e391cc8
4
- data.tar.gz: 412775f12bbcf6fa6d6b0d522461847dfad18a30d69ce3d5a1a0dfaeac2b792e
3
+ metadata.gz: 1e5c598d6772c849c127dd37c679264f9a4d898c53d3b2fa7272d3c43b7dc550
4
+ data.tar.gz: 9731b2e4576361e677549071cbc7c99cfb4f2203359a14554968a5acfcdba5b8
5
5
  SHA512:
6
- metadata.gz: de5165a48a01ed970bea7d4f61e90db62b8d482fdce4faa775e750969485f81910594fdd4529992e411e67cad50d89dca9d11a4bb1e0ec11cba834b0b33275f3
7
- data.tar.gz: a5b977c740b4ec59400379c6d6540614e96beb3b0e4f48b2449f247a381a460942b8e6390edd9dfa5c47bff9abcf20b94abcd3f98671b1c8a8198bca69ae634a
6
+ metadata.gz: e026bc3bda0b65d92b8315825b58bcabf596d8aab4a6ae7c0c75f24a4472c2bc088ab74befb426d702f4c48777b82aa5b885cce37acdc0db57aeb117084f541c
7
+ data.tar.gz: 61a4d2a80ca99fc6a7b70eee7d0bee7737e3f5c35a88a04d98a84ef0d6490e365c3cea2572e8773bcbb28915685b37a0a5e9a4bfd5a4c5f70a5055143ed1012e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.3.3 — 2023-04-14
4
+
5
+ ### Changed
6
+
7
+ * Use `file_info` request after a file upload if the secret key is not provided.
8
+
9
+ ### Added
10
+
11
+ * Add a new `file_info` method to retreive file information without the secret key.
12
+
3
13
  ## 4.3.2 — 2023-03-28
4
14
 
5
15
  ### Changed
@@ -53,6 +53,18 @@ module Uploadcare
53
53
  get(path: 'from_url/status/', params: query_params)
54
54
  end
55
55
 
56
+ # Get information about an uploaded file
57
+ # Secret key not needed
58
+ #
59
+ # https://uploadcare.com/api-refs/upload-api/#tag/Upload/operation/fileUploadInfo
60
+ def file_info(uuid)
61
+ query_params = {
62
+ file_id: uuid,
63
+ pub_key: Uploadcare.config.public_key
64
+ }
65
+ get(path: 'info/', params: query_params)
66
+ end
67
+
56
68
  private
57
69
 
58
70
  alias api_struct_post post
@@ -33,7 +33,13 @@ module Uploadcare
33
33
  # upload single file
34
34
  def self.upload_file(file, options = {})
35
35
  response = UploaderClient.new.upload_many([file], options)
36
- Uploadcare::Entity::File.info(response.success.to_a.flatten[-1])
36
+ uuid = response.success.values.first
37
+ if Uploadcare.config.secret_key.nil?
38
+ Uploadcare::Entity::File.new(file_info(uuid).success)
39
+ else
40
+ # we can get more info about the uploaded file
41
+ Uploadcare::Entity::File.info(uuid)
42
+ end
37
43
  end
38
44
 
39
45
  # upload multiple files
@@ -63,6 +69,12 @@ module Uploadcare
63
69
  UploaderClient.new.get_upload_from_url_status(token)
64
70
  end
65
71
 
72
+ # Get information about an uploaded file (without the secret key)
73
+ # @param uuid [String]
74
+ def self.file_info(uuid)
75
+ UploaderClient.new.file_info(uuid)
76
+ end
77
+
66
78
  class << self
67
79
  private
68
80
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uploadcare
4
- VERSION = '4.3.2'
4
+ VERSION = '4.3.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uploadcare-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.2
4
+ version: 4.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - "@dmitrijivanchenko (Dmitrij Ivanchenko), @T0mbery (Andrey Aksenov)"
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-03-28 00:00:00.000000000 Z
12
+ date: 2023-04-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mimemagic
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
259
  - !ruby/object:Gem::Version
260
260
  version: '0'
261
261
  requirements: []
262
- rubygems_version: 3.4.6
262
+ rubygems_version: 3.4.10
263
263
  signing_key:
264
264
  specification_version: 4
265
265
  summary: Ruby wrapper for uploadcare API