azure-signature 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES +3 -0
- data/azure-signature.gemspec +1 -1
- data/lib/azure/signature.rb +8 -6
- data/test/test_signature.rb +1 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67998efc651f21fe011dff305c335e58ab630ce3
|
4
|
+
data.tar.gz: 34f0ff58db45b64f69f577a6c4aa2edb13a5c836
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b6d5fb5159bdc93a5e1f1555fad7548cac8eb49d4139ea714cee0b6d12c26ddd6f3586cf8f2cb96fc22ad822a1a652ce2375dbd0f2a552206e83b5625c5a3e1
|
7
|
+
data.tar.gz: 046b15029d5559079502cf1f4c50eeb19c88c897d080f6c5afec2350cb00953dd471abe83b01f4fdf98c834f4eebc486e3c41d88c723274c6b8d1b57041b09e7
|
data/CHANGES
CHANGED
data/azure-signature.gemspec
CHANGED
data/lib/azure/signature.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'addressable'
|
2
2
|
require 'openssl'
|
3
3
|
require 'base64'
|
4
|
-
require 'cgi'
|
5
4
|
require 'time'
|
6
5
|
|
7
6
|
# The Azure module serves as a namespace.
|
@@ -9,7 +8,7 @@ module Azure
|
|
9
8
|
# The Signature class encapsulates an canonicalized resource string.
|
10
9
|
class Signature
|
11
10
|
# The version of the azure-signature library.
|
12
|
-
VERSION = '0.2.
|
11
|
+
VERSION = '0.2.3'
|
13
12
|
|
14
13
|
# The resource (URL) passed to the constructor.
|
15
14
|
attr_reader :resource
|
@@ -237,10 +236,13 @@ module Azure
|
|
237
236
|
#
|
238
237
|
def canonicalize_resource(uri)
|
239
238
|
resource = '/' + account_name + (uri.path.empty? ? '/' : uri.path)
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
239
|
+
|
240
|
+
nested = (uri.query_values(Array) || []).sort
|
241
|
+
memo = Hash.new { |h, k| h[k] = [] }
|
242
|
+
hash = nested.inject(memo){ |h, a| h[a.first] << a.last; h }
|
243
|
+
string = hash.inject('') { |s, a| s << "\n#{a.first}:#{a.last.join(',')}"; s }
|
244
|
+
|
245
|
+
resource + string
|
244
246
|
end
|
245
247
|
|
246
248
|
# Generate canonical headers.
|
data/test/test_signature.rb
CHANGED
@@ -9,7 +9,7 @@ class TC_Azure_Signature < Test::Unit::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
test "version constant is set to expected value" do
|
12
|
-
assert_equal("0.2.
|
12
|
+
assert_equal("0.2.3", Azure::Signature::VERSION)
|
13
13
|
end
|
14
14
|
|
15
15
|
test "key method basic functionality" do
|
@@ -80,7 +80,6 @@ class TC_Azure_Signature < Test::Unit::TestCase
|
|
80
80
|
test "constructor automatically escapes resource argument" do
|
81
81
|
@url = "https://myaccount-secondary.blob.core.windows.net/mycontainer/myblob-{12345}"
|
82
82
|
@sig = Azure::Signature.new(@url, @key)
|
83
|
-
expected = "/myaccount/mycontainer/myblob-%7B12345%7D"
|
84
83
|
assert_equal("/myaccount/mycontainer/myblob-%7B12345%7D", @sig.canonical_resource)
|
85
84
|
assert_equal("https://myaccount-secondary.blob.core.windows.net/mycontainer/myblob-%7B12345%7D", @sig.resource)
|
86
85
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: azure-signature
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|