Class: AzureBlob::Container
- Inherits:
-
Object
- Object
- AzureBlob::Container
- Defined in:
- lib/azure_blob/container.rb
Overview
AzureBlob::Container holds the metadata for a given Container.
Instance Method Summary collapse
-
#initialize(response) ⇒ Container
constructor
You should not instanciate this object directly, but obtain one when calling relevant methods of AzureBlob::Client.
-
#metadata ⇒ Object
Returns the custom Azure metadata tagged on the container.
- #present? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Container
You should not instanciate this object directly, but obtain one when calling relevant methods of AzureBlob::Client.
Expects a Net::HTTPResponse object from a HEAD or GET request to a container uri.
11 12 13 |
# File 'lib/azure_blob/container.rb', line 11 def initialize(response) @response = response end |
Instance Method Details
#metadata ⇒ Object
Returns the custom Azure metadata tagged on the container.
21 22 23 24 25 26 27 |
# File 'lib/azure_blob/container.rb', line 21 def @metadata || response .to_hash .select { |key, _| key.start_with?("x-ms-meta") } .transform_values(&:first) .transform_keys { |key| key.delete_prefix("x-ms-meta-").to_sym } end |
#present? ⇒ Boolean
16 17 18 |
# File 'lib/azure_blob/container.rb', line 16 def present? response.code == "200" end |