Class: Aeolus::Image::Warehouse::Bucket

Inherits:
Object
  • Object
show all
Defined in:
lib/aeolus_image/model/warehouse/warehouse_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, connection) ⇒ Bucket

Returns a new instance of Bucket.



89
90
91
92
# File 'lib/aeolus_image/model/warehouse/warehouse_client.rb', line 89

def initialize(name, connection)
  @name = name
  @connection = connection
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



87
88
89
# File 'lib/aeolus_image/model/warehouse/warehouse_client.rb', line 87

def name
  @name
end

Instance Method Details

#create_object(key, body, attrs) ⇒ Object



115
116
117
# File 'lib/aeolus_image/model/warehouse/warehouse_client.rb', line 115

def create_object(key, body, attrs)
  BucketObject.create(@connection, key, self, body, attrs)
end

#include?(key) ⇒ Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/aeolus_image/model/warehouse/warehouse_client.rb', line 119

def include?(key)
  object_names.include?(key)
end

#object(key) ⇒ Object



111
112
113
# File 'lib/aeolus_image/model/warehouse/warehouse_client.rb', line 111

def object(key)
  BucketObject.new @connection, key, self
end

#object_namesObject



98
99
100
101
102
103
# File 'lib/aeolus_image/model/warehouse/warehouse_client.rb', line 98

def object_names
  result = @connection.do_request "/#{@name}"
  result.xpath('/objects/object').map do |obj|
    obj.at_xpath('./key/text()').to_s
  end
end

#objectsObject



105
106
107
108
109
# File 'lib/aeolus_image/model/warehouse/warehouse_client.rb', line 105

def objects
  object_names.map do |name|
    object(name)
  end
end

#to_sObject



94
95
96
# File 'lib/aeolus_image/model/warehouse/warehouse_client.rb', line 94

def to_s
  "Bucket: #{@name}"
end