Class: Hubic::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/hubic/openstack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hubic, name) ⇒ Container

Returns a new instance of Container.



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/hubic/openstack.rb', line 13

def initialize(hubic, name)
    @hubic    = hubic
    @name     = name.dup.freeze
    j, h      = @hubic.api_openstack(:head, @name)
    @count    = h['x-container-object-count'].to_i
    @bytes    = h['x-container-bytes-used'  ].to_i
    @etag     = h['etag'                    ]
     = Hash[h.map {|k,v|
                      if k =~ /^x-container-meta-(.*)/
                          [ $1, v ]
                      end
                     }.compact].freeze
end

Instance Attribute Details

#bytesObject (readonly)

Returns the value of attribute bytes.



12
13
14
# File 'lib/hubic/openstack.rb', line 12

def bytes
  @bytes
end

#countObject (readonly)

Returns the value of attribute count.



12
13
14
# File 'lib/hubic/openstack.rb', line 12

def count
  @count
end

#metadataObject (readonly)

Returns the value of attribute metadata.



12
13
14
# File 'lib/hubic/openstack.rb', line 12

def 
  
end

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/hubic/openstack.rb', line 12

def name
  @name
end

Instance Method Details

#[](key) ⇒ Object



27
28
29
# File 'lib/hubic/openstack.rb', line 27

def [](key)
    [key]
end

#destroy!Object



35
36
37
38
# File 'lib/hubic/openstack.rb', line 35

def destroy!
    j, h = @hubic.api_openstack(:delete, @name)
    j
end

#empty?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/hubic/openstack.rb', line 31

def empty?
    @count == 0
end

#object(path) ⇒ Object



40
41
# File 'lib/hubic/openstack.rb', line 40

def object(path)
end

#objectsObject



43
44
# File 'lib/hubic/openstack.rb', line 43

def objects()
end