Class: DeltacloudVM::Client::Blob

Inherits:
Base
  • Object
show all
Includes:
Methods::Blob, Methods::Bucket
Defined in:
lib/deltacloud_vm/client/models/blob.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#description, #name, #obj_id, #url

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Methods::Bucket

#buckets, #create_bucket, #destroy_bucket

Methods included from Methods::Blob

#blob, #blobs, #create_blob, #destroy_blob

Methods inherited from Base

#client, #connection, convert, #entrypoint, from_collection, #id, #initialize, #original_body, #to_s, #update_instance_variables!, validate_attrs!

Methods included from Helpers::XmlHelper

#extract_xml_body

Methods included from Methods::Api

#api_uri, #current_driver, #current_provider, #feature?, #features, #must_support!, #path, #support?, #supported_collections, #version

Methods included from Helpers::Model

#error, #from_collection, #from_resource, #model

Constructor Details

This class inherits a constructor from DeltacloudVM::Client::Base

Instance Attribute Details

#bucket_idObject (readonly)

Custom attributes:



26
27
28
# File 'lib/deltacloud_vm/client/models/blob.rb', line 26

def bucket_id
  @bucket_id
end

#content_lengthObject (readonly)

Returns the value of attribute content_length.



27
28
29
# File 'lib/deltacloud_vm/client/models/blob.rb', line 27

def content_length
  @content_length
end

#content_typeObject (readonly)

Returns the value of attribute content_type.



28
29
30
# File 'lib/deltacloud_vm/client/models/blob.rb', line 28

def content_type
  @content_type
end

#last_modifiedObject (readonly)

Returns the value of attribute last_modified.



29
30
31
# File 'lib/deltacloud_vm/client/models/blob.rb', line 29

def last_modified
  @last_modified
end

#user_metadataObject (readonly)

Returns the value of attribute user_metadata.



30
31
32
# File 'lib/deltacloud_vm/client/models/blob.rb', line 30

def 
  @user_metadata
end

Class Method Details

.parse(xml_body) ⇒ Object

Parse the Blob entity from XML body

  • xml_body -> DeltacloudVM API XML representation of the blob



43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/deltacloud_vm/client/models/blob.rb', line 43

def self.parse(xml_body)
  {
    :bucket_id => xml_body.text_at(:bucket_id) || xml_body.text_at(:bucket), # FIXME: DC bug
    :content_length => xml_body.text_at(:content_length),
    :content_type => xml_body.text_at(:content_type),
    :last_modified => xml_body.text_at(:last_modified),
    :user_metadata => xml_body.xpath('user_metadata/entry').inject({}) { |r,e|
      r[e['key']] = e.text.strip
      r
    }
  }
end

Instance Method Details

#bucketObject

Blob model methods



35
36
37
# File 'lib/deltacloud_vm/client/models/blob.rb', line 35

def bucket
  super(bucket_id)
end