-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from d-a-v-e/adds-get-blob-tags
adds `get_blob_tags` to client
- Loading branch information
Showing
6 changed files
with
71 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
## [Unreleased] | ||
|
||
- Add support for setting tags when uploading a blob | ||
- Add get_blob_tags | ||
|
||
## [0.5.2] 2024-09-12 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require "rexml/document" | ||
|
||
module AzureBlob | ||
class Tags # :nodoc: | ||
def self.from_response(response) | ||
document = REXML::Document.new(response) | ||
tags = {} | ||
document.elements.each("Tags/TagSet/Tag") do |tag| | ||
key = tag.elements["Key"].text | ||
value = tag.elements["Value"].text | ||
tags[key] = value | ||
end | ||
new(tags) | ||
end | ||
|
||
def initialize(tags = nil) | ||
@tags = tags || {} | ||
end | ||
|
||
def headers | ||
return {} if @tags.empty? | ||
|
||
{ | ||
"x-ms-tags": | ||
@tags.map do |key, value| | ||
%(#{key}=#{value}) | ||
end.join("&"), | ||
} | ||
end | ||
|
||
def to_h | ||
@tags | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters