Class: OpenstackBridge::Container
- Inherits:
-
Struct
- Object
- Struct
- OpenstackBridge::Container
- Defined in:
- lib/openstack_bridge/container.rb
Instance Attribute Summary collapse
-
#container ⇒ Object
Returns the value of attribute container.
-
#swift ⇒ Object
Returns the value of attribute swift.
Instance Method Summary collapse
- #create(name, content) ⇒ Object
- #delete(name) ⇒ Object
- #exists?(name) ⇒ Boolean
- #objects ⇒ Object
- #read(name) ⇒ Object
Instance Attribute Details
#container ⇒ Object
Returns the value of attribute container
2 3 4 |
# File 'lib/openstack_bridge/container.rb', line 2 def container @container end |
#swift ⇒ Object
Returns the value of attribute swift
2 3 4 |
# File 'lib/openstack_bridge/container.rb', line 2 def swift @swift end |
Instance Method Details
#create(name, content) ⇒ Object
19 20 21 |
# File 'lib/openstack_bridge/container.rb', line 19 def create(name, content) swift.request(:put, file_path(name), content) end |
#delete(name) ⇒ Object
23 24 25 |
# File 'lib/openstack_bridge/container.rb', line 23 def delete(name) swift.request(:delete, file_path(name)) end |
#exists?(name) ⇒ Boolean
3 4 5 6 7 8 9 |
# File 'lib/openstack_bridge/container.rb', line 3 def exists?(name) begin swift.request(:head, file_path(name)).code == 200 rescue OpenstackBridge::Error false end end |
#objects ⇒ Object
11 12 13 |
# File 'lib/openstack_bridge/container.rb', line 11 def objects swift.request(:get, container_path).raw_body.split("\n") end |
#read(name) ⇒ Object
15 16 17 |
# File 'lib/openstack_bridge/container.rb', line 15 def read(name) swift.request(:get, file_path(name)).raw_body end |