Class: Canistor::Storage::Part
- Inherits:
-
Object
- Object
- Canistor::Storage::Part
- Defined in:
- lib/canistor/storage/part.rb
Instance Attribute Summary collapse
-
#bucket ⇒ Object
Returns the value of attribute bucket.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#key ⇒ Object
Returns the value of attribute key.
-
#number ⇒ Object
Returns the value of attribute number.
-
#region ⇒ Object
Returns the value of attribute region.
-
#upload_id ⇒ Object
Returns the value of attribute upload_id.
Instance Method Summary collapse
- #attributes ⇒ Object
- #etag ⇒ Object
-
#initialize(**attributes) ⇒ Part
constructor
A new instance of Part.
- #put(context, subject) ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(**attributes) ⇒ Part
Returns a new instance of Part.
14 15 16 17 18 |
# File 'lib/canistor/storage/part.rb', line 14 def initialize(**attributes) attributes.each do |name, value| send("#{name}=", value) end end |
Instance Attribute Details
#bucket ⇒ Object
Returns the value of attribute bucket.
7 8 9 |
# File 'lib/canistor/storage/part.rb', line 7 def bucket @bucket end |
#data ⇒ Object
Returns the value of attribute data.
12 13 14 |
# File 'lib/canistor/storage/part.rb', line 12 def data @data end |
#key ⇒ Object
Returns the value of attribute key.
8 9 10 |
# File 'lib/canistor/storage/part.rb', line 8 def key @key end |
#number ⇒ Object
Returns the value of attribute number.
10 11 12 |
# File 'lib/canistor/storage/part.rb', line 10 def number @number end |
#region ⇒ Object
Returns the value of attribute region.
6 7 8 |
# File 'lib/canistor/storage/part.rb', line 6 def region @region end |
#upload_id ⇒ Object
Returns the value of attribute upload_id.
9 10 11 |
# File 'lib/canistor/storage/part.rb', line 9 def upload_id @upload_id end |
Instance Method Details
#attributes ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/canistor/storage/part.rb', line 33 def attributes { region: region, bucket: bucket, key: key, upload_id: upload_id, number: number, digest: digest, etag: etag } end |
#etag ⇒ Object
25 26 27 |
# File 'lib/canistor/storage/part.rb', line 25 def etag '"' + digest + '"' end |
#put(context, subject) ⇒ Object
20 21 22 23 |
# File 'lib/canistor/storage/part.rb', line 20 def put(context, subject) write(context.http_request.body.read) context.http_response.signal_headers(200, identity_headers) end |
#size ⇒ Object
29 30 31 |
# File 'lib/canistor/storage/part.rb', line 29 def size data&.size end |