canistor 0.3.1 → 0.3.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: 9aaf5cf5c03bbff13b6dfa068ca6c2940ac5f56c0c5bf29e8eab24f734645b43
4
- data.tar.gz: 70b8dca807ddbbcf8899cd7d70d0aaa8f3b87a17a27049d729ee80dccaf3b69d
3
+ metadata.gz: 2621d73e017b7bbfb296384b7bceb87699d7f71942fa9b85c346d824103f8fc0
4
+ data.tar.gz: ff98d15d36834943e177a66c4db1c7fee64f96b4cb7398ad4f4c4a179bbfc2c9
5
5
  SHA512:
6
- metadata.gz: cb0b7076e65bc20b29fff8d34ca513a25a7a645d47b50595637a9354b689b193a767b1400d0b7bd0cdbc9d1de70392b16ce39da0867ca8a8eea64aaad8af499c
7
- data.tar.gz: 37baed4901f96624eed812223270c5bfa0f827b023ee14fd9e2193336e9575a4b8806ca222133c6fde55d150b359e60206fb684afd76166c17bba7b09046ba24
6
+ metadata.gz: 1b92e5cbae6bb7d863b3e437df73cd0a23fda1ce3b6533a00499f26ad4eef07c2bd305d263ff68930efc5ab77aeb763c91ba561c0a8dc8aadd608488779e7bf7
7
+ data.tar.gz: 3460dd2aad6248bddd71cd1cd8595da3b80a871a5568edd47b8455307e552e9e2b3228e5cb4cd45f8e4d28b41b07c68519f155704dd7748463d670101dca4d24
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Canistor
4
+ module Storage
5
+ class Upload
6
+ attr_accessor :id
7
+ attr_accessor :region
8
+ attr_accessor :bucket
9
+ attr_accessor :key
10
+
11
+ def initialize(**attributes)
12
+ @id = SecureRandom.hex(64)
13
+ attributes.each do |name, value|
14
+ send("#{name}=", value)
15
+ end
16
+ end
17
+
18
+ def get(context, subject)
19
+ show_upload(context)
20
+ end
21
+
22
+ private
23
+
24
+ def show_upload(context)
25
+ context.http_response.signal_headers(
26
+ 200,
27
+ 'date' => Time.now.httpdate,
28
+ 'x-amz-request-id' => SecureRandom.hex(8).upcase
29
+ )
30
+ unless context.http_request.http_method == 'HEAD'
31
+ context.http_response.signal_data(to_xml(context))
32
+ end
33
+ end
34
+
35
+ def to_xml(context)
36
+ Nokogiri::XML::Builder.new do |xml|
37
+ xml.InitiateMultipartUploadResult(
38
+ xmlns: 'http://s3.amazonaws.com/doc/2006-03-01/'
39
+ ) do
40
+ xml.Bucket bucket
41
+ xml.Key key
42
+ xml.UploadId id
43
+ end
44
+ end.to_xml
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Canistor
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canistor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manfred Stienstra
@@ -99,6 +99,7 @@ files:
99
99
  - lib/canistor/storage.rb
100
100
  - lib/canistor/storage/bucket.rb
101
101
  - lib/canistor/storage/object.rb
102
+ - lib/canistor/storage/upload.rb
102
103
  - lib/canistor/subject.rb
103
104
  - lib/canistor/version.rb
104
105
  homepage: https://erm.im/canistor