Class: WAZ::Blobs::BlobObject

Inherits:
Object
  • Object
show all
Defined in:
lib/waz/blobs/blob_object.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_typeObject

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

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/waz/blobs/blob_object.rb', line 4

def name
  @name
end

#urlObject

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

#metadataObject



12
13
14
# File 'lib/waz/blobs/blob_object.rb', line 12

def 
  @properties ||= service_instance.get_blob_properties(path)
end

#pathObject



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

#valueObject



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