Class: Aeolus::Image::Warehouse::Bucket
- Inherits:
-
Object
- Object
- Aeolus::Image::Warehouse::Bucket
- Defined in:
- lib/aeolus_image/model/warehouse/warehouse_client.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #create_object(key, body, attrs) ⇒ Object
- #include?(key) ⇒ Boolean
-
#initialize(name, connection) ⇒ Bucket
constructor
A new instance of Bucket.
- #object(key) ⇒ Object
- #object_names ⇒ Object
- #objects ⇒ Object
- #to_s ⇒ Object
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
#name ⇒ Object
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
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_names ⇒ Object
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 |
#objects ⇒ Object
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_s ⇒ Object
94 95 96 |
# File 'lib/aeolus_image/model/warehouse/warehouse_client.rb', line 94 def to_s "Bucket: #{@name}" end |