4me-sdk 2.0.0.pre.rc.1 → 2.0.0.pre.rc.2

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: 4c4c1ac14f3525802639a4aa78223d0635533ffee6527fed0a02e9f8b41aca54
4
- data.tar.gz: 5e8b18fa02b940a0883b2ed6349a619cda9048201c87c4d953f53e373e64d88f
3
+ metadata.gz: 4a47412fa979f19c6133c5fb05a9e3c5979ce8e26b70ab7e970c161bc1650792
4
+ data.tar.gz: a7caae4a8ccd168b3284506a63405321186cf2d50989e6f08a6910b0f916578a
5
5
  SHA512:
6
- metadata.gz: 5e0752a3cac273d81a7cafa7d43ca5a69088db6143418a9bb70b6a95f1111db422d8eb03d8f669f5d74efd1f0e05d2004f284f21e173605da0f4f3fcb601d62b
7
- data.tar.gz: 41079af50a9db8a791614849197a5d5aee2049d1b2f9900c345802ff1a6439869f86f9f341309883cfe2c0233c590f352b1ef4c9f5ba81f4cf7506183d95c139
6
+ metadata.gz: 752300c464dfa9d493218aa5f3672ff4fae68f23f131631d057c8e0d073b6f18a0a526dc7fce8f03490d82594e7a2d54aafb4b52b72be0c5cb6a9f6cfde97f13
7
+ data.tar.gz: cd40c5966800ca2e52b790e7d2f57e4fe3f92c2145c472048a3ce6f8c5c83717648cb6805445d5a983f57397807a96f0e08f55a66c264492df81e61479caa3c8
@@ -97,11 +97,11 @@ module Sdk4me
97
97
  key_template = storage[provider][:key]
98
98
  key = key_template.sub(FILENAME_TEMPLATE, File.basename(attachment.path))
99
99
 
100
- if provider == S3_PROVIDER
101
- upload_to_s3(key, attachment)
102
- else
103
- upload_to_4me_local(key, attachment)
104
- end
100
+ key = if provider == S3_PROVIDER
101
+ upload_to_s3(key, attachment)
102
+ else
103
+ upload_to_4me_local(key, attachment)
104
+ end
105
105
 
106
106
  # return the values for the attachments param
107
107
  { key: key, filesize: File.size(attachment.path) }
@@ -118,6 +118,8 @@ module Sdk4me
118
118
  xml = response.body || ''
119
119
  error = xml[%r{<Error>.*<Message>(.*)</Message>.*</Error>}, 1]
120
120
  raise "AWS S3 upload to #{uri} for #{key} failed: #{error}" if error
121
+
122
+ xml[%r{<Key>(.*)</Key>}, 1]
121
123
  end
122
124
 
123
125
  # Upload the file directly to 4me local storage
@@ -125,6 +127,8 @@ module Sdk4me
125
127
  uri = storage[:upload_uri]
126
128
  response = send_file(uri, storage[:local].merge({ file: attachment }), @client.send(:expand_header))
127
129
  raise "4me upload to #{uri} for #{key} failed: #{response.message}" unless response.valid?
130
+
131
+ key
128
132
  end
129
133
 
130
134
  def send_file(uri, params, basic_auth_header = {})
@@ -1,5 +1,5 @@
1
1
  module Sdk4me
2
2
  class Client
3
- VERSION = '2.0.0-rc.1'.freeze
3
+ VERSION = '2.0.0-rc.2'.freeze
4
4
  end
5
5
  end
@@ -260,10 +260,10 @@ describe Sdk4me::Attachments do
260
260
  'User-Agent' => "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/523.10.6 (KHTML, like Gecko) Version/3.0.4 Safari/523.10.6 4me/#{Sdk4me::Client::VERSION}"
261
261
  }
262
262
  )
263
- .to_return(status: 200, body: '', headers: {})
263
+ .to_return(status: 200, headers: {}, body: %(<?xml version="1.0" encoding="UTF-8"?>\n<PostResponse><Location>foo</Location><Bucket>example</Bucket><Key>attachments/5/zxxb4ot60xfd6sjg/s3test.txt</Key><ETag>"bar"</ETag></PostResponse>))
264
264
 
265
265
  expect(a.send(:upload_attachment, file.path)).to eq({
266
- key: "attachments/5/reqs/000/070/451/zxxb4ot60xfd6sjg/#{File.basename(file.path)}",
266
+ key: 'attachments/5/zxxb4ot60xfd6sjg/s3test.txt',
267
267
  filesize: 6
268
268
  })
269
269
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 4me-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.rc.1
4
+ version: 2.0.0.pre.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - 4me
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-14 00:00:00.000000000 Z
11
+ date: 2020-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport