bucket_client 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/lib/bucket_client/aws/aws_client.rb +2 -1
- data/lib/bucket_client/azure/azure_client.rb +2 -1
- data/lib/bucket_client/digital_ocean/digital_ocean_client.rb +4 -3
- data/lib/bucket_client/gcp/gcp_client.rb +2 -1
- data/lib/bucket_client/version.rb +1 -1
- metadata +2 -4
- data/.env +0 -3
- data/.idea/vcs.xml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c75f9ede2d5fdb2091d0077bf6b438a907e30db0f23af72be2c9d59ffb408d06
|
4
|
+
data.tar.gz: '07190bb3319a3939020f777a6bd2c3f57404fa3a5667047a60c81bbea8db1ac9'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dc252cad1f57768b7ba2c8b88caa29b221306b85ae137174b53f50bdd661978568b69ef835163590022456d8771c1f99c183b8e9e4c0eccd2381c00db3d7ee3
|
7
|
+
data.tar.gz: 6e22a33052f35639886d969fdc2ac21fcc89941b663d36a63d138053152021f021381a9721680f975c344d8fe6c1c3196f56b32b6634baa3130c2f1ceff2c583
|
data/.gitignore
CHANGED
@@ -103,7 +103,8 @@ module BucketClient
|
|
103
103
|
|
104
104
|
def put_blob(payload, uri)
|
105
105
|
mime = MimeMagic.by_magic payload
|
106
|
-
|
106
|
+
type = mime.type || "text/plain"
|
107
|
+
resp = @http.query(:put, uri, payload, type, "text/plain")
|
107
108
|
success = resp.code === 200
|
108
109
|
if success
|
109
110
|
OperationResult.new(success, "Blob put", uri, resp.code)
|
@@ -142,7 +142,8 @@ module BucketClient
|
|
142
142
|
mime = MimeMagic.by_magic payload
|
143
143
|
data = break_uri uri
|
144
144
|
begin
|
145
|
-
|
145
|
+
type = mime.type || "text/plain"
|
146
|
+
@client.create_block_blob data[:bucket], data[:blob], payload, {:content_type => type}
|
146
147
|
OperationResult.new(true, "OK", uri, 204)
|
147
148
|
rescue Azure::Core::Http::HTTPError => e
|
148
149
|
OperationResult.new(false, e.description, nil, e.status_code)
|
@@ -127,7 +127,8 @@ module BucketClient
|
|
127
127
|
|
128
128
|
def put_blob(payload, uri)
|
129
129
|
mime = MimeMagic.by_magic payload
|
130
|
-
|
130
|
+
type = mime.type || "text/plain"
|
131
|
+
resp = @http.query :put, uri, payload, type, "application/xml"
|
131
132
|
return OperationResult.new(false, resp.content, nil, 400) unless resp.code === 200
|
132
133
|
url = Addressable::URI.parse uri
|
133
134
|
bucket = url.path.split("/").find {|x| !x.nil? && !x.empty?}
|
@@ -226,8 +227,8 @@ module BucketClient
|
|
226
227
|
resp = @http.query :get, endpoint
|
227
228
|
if resp.code === 200
|
228
229
|
value = Ox.load(resp.content, mode: :hash)[:ListBucketResult]
|
229
|
-
|
230
|
-
|
230
|
+
.select {|k| !k[:Contents].nil?}
|
231
|
+
.map {|k| endpoint + k[:Contents][:Key]}
|
231
232
|
OperationResult.new(true, "OK", value, resp.code)
|
232
233
|
else
|
233
234
|
OperationResult.new(false, resp.content, nil, resp.code)
|
@@ -111,7 +111,8 @@ module BucketClient
|
|
111
111
|
bucket = @client.bucket data[:bucket]
|
112
112
|
f = StringIO.new
|
113
113
|
f << payload
|
114
|
-
|
114
|
+
type = mime.type || "text/plain"
|
115
|
+
file = bucket.create_file f, data[:blob], cache_control: "no-cache", content_type: type
|
115
116
|
OperationResult.new(true, "OK", file.public_url, 200)
|
116
117
|
rescue StandardError => e
|
117
118
|
OperationResult.new(false, e.message, nil, 400)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bucket_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kirinnee
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kirin_http
|
@@ -167,7 +167,6 @@ executables: []
|
|
167
167
|
extensions: []
|
168
168
|
extra_rdoc_files: []
|
169
169
|
files:
|
170
|
-
- ".env"
|
171
170
|
- ".gitignore"
|
172
171
|
- ".gitlab-ci.yml"
|
173
172
|
- ".idea/bucket_client.iml"
|
@@ -176,7 +175,6 @@ files:
|
|
176
175
|
- ".idea/modules.xml"
|
177
176
|
- ".idea/runConfigurations/Integration_Test.xml"
|
178
177
|
- ".idea/runConfigurations/Unit_Test.xml"
|
179
|
-
- ".idea/vcs.xml"
|
180
178
|
- ".rspec"
|
181
179
|
- CODE_OF_CONDUCT.md
|
182
180
|
- Gemfile
|
data/.env
DELETED