Class: WAZ::Blobs::BlobObject
- Inherits:
-
Object
- Object
- WAZ::Blobs::BlobObject
- Defined in:
- lib/waz/blobs/blob_object.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #destroy! ⇒ Object
-
#initialize(name, url, content_type) ⇒ BlobObject
constructor
A new instance of BlobObject.
- #metadata ⇒ Object
- #path ⇒ Object
- #put_properties(properties = {}) ⇒ Object
- #value ⇒ Object
- #value=(new_value) ⇒ Object
Constructor Details
#initialize(name, url, content_type) ⇒ BlobObject
Returns a new instance of BlobObject.
6 7 8 9 10 |
# File 'lib/waz/blobs/blob_object.rb', line 6 def initialize(name, url, content_type) self.name = name self.url = url self.content_type = content_type end |
Instance Attribute Details
#content_type ⇒ Object
Returns the value of attribute content_type.
4 5 6 |
# File 'lib/waz/blobs/blob_object.rb', line 4 def content_type @content_type end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/waz/blobs/blob_object.rb', line 4 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/waz/blobs/blob_object.rb', line 4 def url @url end |
Instance Method Details
#destroy! ⇒ Object
30 31 32 |
# File 'lib/waz/blobs/blob_object.rb', line 30 def destroy! service_instance.delete_blob(path) end |
#metadata ⇒ Object
12 13 14 |
# File 'lib/waz/blobs/blob_object.rb', line 12 def @properties ||= service_instance.get_blob_properties(path) end |
#path ⇒ Object
34 35 36 |
# File 'lib/waz/blobs/blob_object.rb', line 34 def path url.gsub(/https?:\/\/[^\/]+\//i, '').scan(/([^&]+)/i).first().first() end |
#put_properties(properties = {}) ⇒ Object
25 26 27 28 |
# File 'lib/waz/blobs/blob_object.rb', line 25 def put_properties(properties = {}) service_instance.set_blob_properties(path, properties) @properties = .merge(properties) end |
#value ⇒ Object
16 17 18 |
# File 'lib/waz/blobs/blob_object.rb', line 16 def value @value ||= service_instance.get_blob(path) end |
#value=(new_value) ⇒ Object
20 21 22 23 |
# File 'lib/waz/blobs/blob_object.rb', line 20 def value=(new_value) service_instance.put_blob(path, new_value, content_type, ) @value = new_value end |