4me-sdk 2.0.0.pre.rc.1 → 2.0.0.pre.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sdk4me/client/attachments.rb +9 -5
- data/lib/sdk4me/client/version.rb +1 -1
- data/spec/lib/sdk4me/attachments_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a47412fa979f19c6133c5fb05a9e3c5979ce8e26b70ab7e970c161bc1650792
|
4
|
+
data.tar.gz: a7caae4a8ccd168b3284506a63405321186cf2d50989e6f08a6910b0f916578a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
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 = {})
|
@@ -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,
|
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:
|
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.
|
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-
|
11
|
+
date: 2020-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|