filestack 2.9.2 → 2.9.6

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: 77cdeeaa1226f25d1c5eba7ac7afe6d378dd9186ca312d04702fc4f840afa77b
4
- data.tar.gz: 0ea80120de3f54a0e2ee5d6c0ed1d2a6fb7d720259c1ac5447e80d98c374768d
3
+ metadata.gz: a6257a989f754721ccea17bb8ba9ec05e3b919e224599239e6c4b07596be95db
4
+ data.tar.gz: 203b1b4d9cb0627115e13b2af655edba664ae8743c7e9772fdb5641ceadeb0e6
5
5
  SHA512:
6
- metadata.gz: 41aaf72567d547bce5dbdfff016558a736f91f26ad6b52e70f242c9dc3d6a9d98aec65ed1532e0378c55e892eed465b8a3bba9a42ff92de387291cc854e54840
7
- data.tar.gz: 83081bee7119eed5d65d3d2f55aa54d8a61f81621002ff9a74de974ad794992a49db51266a544a95d2807083995af742d55b77c130f09684ed6b228f6f7b5e81
6
+ metadata.gz: 796f587b6695c730e884aee7731673b98ac9f9b22d5ba33473d7236ceae4222ad8f8f1fe51b4362f50b137743be308b6096e827cc9ea634fb4352f40aa421cd3
7
+ data.tar.gz: 9fe556c481445e41fe51e4d8d1a15bae7bf8f9ffc2753282a91b350221c70705727fe4f67499a887416087eda98c6238959e5c3e3eb34aa3afe97d8215150f52
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Filestack-Ruby Changelog
2
2
 
3
+ ## 2.9.6 (Oct 29, 2021)
4
+ - Return response body on upload complete to get workflows jobid
5
+
6
+ ## 2.9.5 (Oct 19, 2021)
7
+ - Add url encoding - fix the issue with transformation crop dim
8
+
9
+ ## 2.9.4 (July 26, 2021)
10
+ - Change the version of mini_mime
11
+
12
+ ## 2.9.3 (June 7, 2021)
13
+ - Handle nil mimetype of file
14
+
3
15
  ## 2.9.2 (May 5, 2021)
4
16
  - Replace mimemagic with mini_magic
5
17
 
data/README.md CHANGED
@@ -60,6 +60,13 @@ filelink = client.upload(external_url: 'http://domain.com/image.png')
60
60
 
61
61
  file = StringIO.new
62
62
  filelink = client.upload(io: file)
63
+
64
+
65
+ # Return response body on upload complete
66
+ puts filelink.upload_response
67
+
68
+ # Return uploaded filelink handle
69
+ puts filelink.handle
63
70
  ```
64
71
 
65
72
  To upload a local, an IO object and an external file with following optional options:
@@ -101,6 +108,9 @@ filelink = client.upload(filepath: '/path/to/file', options: { workflows: ["work
101
108
  #OR
102
109
 
103
110
  filelink = client.upload(external_url: 'http://someurl.com/image.png', options: { workflows: ["workflow_id_1"] })
111
+
112
+ # Return workflows jobids on upload complete
113
+ puts filelink.upload_response["workflows"]
104
114
  ```
105
115
 
106
116
  ### Security
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.9.2
1
+ 2.9.6
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.add_dependency "typhoeus", "~> 1.1"
26
26
  spec.add_dependency "parallel", "~> 1.11", ">= 1.11.2"
27
- spec.add_dependency "mini_mime", "~> 1.0.2"
27
+ spec.add_dependency "mini_mime", "~> 1.0"
28
28
  spec.add_dependency "progress_bar"
29
29
 
30
30
  spec.add_development_dependency "bundler", "~> 1.7"
@@ -10,7 +10,7 @@ require 'filestack/mixins/filestack_common'
10
10
  class FilestackFilelink
11
11
  include FilestackCommon
12
12
  include UploadUtils
13
- attr_reader :handle, :apikey, :security
13
+ attr_reader :handle, :apikey, :security, :upload_response
14
14
 
15
15
  # Initialize FilestackFilelink
16
16
  #
@@ -18,10 +18,11 @@ class FilestackFilelink
18
18
  # @param [String] apikey Your Filestack API Key (optional)
19
19
  # @param [FilestackSecurity] security Filestack security object, if
20
20
  # security is enabled.
21
- def initialize(handle, apikey: nil, security: nil)
21
+ def initialize(handle, apikey: nil, security: nil, upload_response: nil)
22
22
  @handle = handle
23
23
  @apikey = apikey
24
24
  @security = security
25
+ @upload_response = upload_response
25
26
  end
26
27
 
27
28
  # Get content of filelink
@@ -42,7 +42,7 @@ class FilestackClient
42
42
  multipart_upload(@apikey, filepath, io, @security, options, timeout, storage, intelligent)
43
43
  end
44
44
 
45
- FilestackFilelink.new(response['handle'], security: @security, apikey: @apikey)
45
+ FilestackFilelink.new(response['handle'], security: @security, apikey: @apikey, upload_response: response)
46
46
  end
47
47
  # Transform an external URL
48
48
  #
@@ -1,5 +1,5 @@
1
1
  module Filestack
2
2
  module Ruby
3
- VERSION = '2.9.2'.freeze
3
+ VERSION = '2.9.6'.freeze
4
4
  end
5
5
  end
@@ -16,7 +16,7 @@ module MultipartUploadUtils
16
16
 
17
17
  def get_file_attributes(file, options = {})
18
18
  filename = options[:filename] || File.basename(file)
19
- mimetype = options[:mimetype] || MiniMime.lookup_by_filename(File.open(file)).content_type || FilestackConfig::DEFAULT_UPLOAD_MIMETYPE
19
+ mimetype = options[:mimetype] || get_mimetype_from_file(file) || FilestackConfig::DEFAULT_UPLOAD_MIMETYPE
20
20
  filesize = File.size(file)
21
21
 
22
22
  [filename, filesize, mimetype.to_s]
@@ -280,4 +280,12 @@ module MultipartUploadUtils
280
280
  end
281
281
  JSON.parse(response_complete.body)
282
282
  end
283
+
284
+ private
285
+
286
+ def get_mimetype_from_file(file)
287
+ file_info = MiniMime.lookup_by_filename(File.open(file))
288
+
289
+ file_info ? file_info.content_type : nil
290
+ end
283
291
  end
@@ -58,7 +58,7 @@ module UploadUtils
58
58
  FilestackConfig::HEADERS
59
59
  end
60
60
  Typhoeus.public_send(
61
- action, url, params: parameters, headers: headers
61
+ action, URI.encode(url), params: parameters, headers: headers
62
62
  )
63
63
  end
64
64
 
@@ -102,8 +102,7 @@ module UploadUtils
102
102
  if response.code == 200
103
103
  begin
104
104
  response_body = JSON.parse(response.body)
105
- handle = response_body['url'].split('/').last
106
- return { 'handle' => handle }
105
+ return response_body
107
106
  rescue
108
107
  raise response.body
109
108
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filestack
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.2
4
+ version: 2.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Filestack
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-05 00:00:00.000000000 Z
11
+ date: 2021-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -50,14 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: 1.0.2
53
+ version: '1.0'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 1.0.2
60
+ version: '1.0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: progress_bar
63
63
  requirement: !ruby/object:Gem::Requirement