azure-signature 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2b9821d2e2078112680c0017088a156da5f9b18
4
- data.tar.gz: 940872135f5844cba32a6ab29762395b0dd1b0d5
3
+ metadata.gz: 67998efc651f21fe011dff305c335e58ab630ce3
4
+ data.tar.gz: 34f0ff58db45b64f69f577a6c4aa2edb13a5c836
5
5
  SHA512:
6
- metadata.gz: e918d84bf6ba3a5e327fcca481a2000071272a00a045aa9a5442356e6ec5f064ecc500d8865bbbf2f0f6fd98fc82a3066d463b17c202108fcc444fd266c62cf0
7
- data.tar.gz: cde329223ea83f02979003857394f4d4bd9f7ef8cdde566ceea95fd05937d5a43fd5efe2d0d432a6d0c0ba236cd4401317fa3cea2f3a4902f116ccea3aff9141
6
+ metadata.gz: 1b6d5fb5159bdc93a5e1f1555fad7548cac8eb49d4139ea714cee0b6d12c26ddd6f3586cf8f2cb96fc22ad822a1a652ce2375dbd0f2a552206e83b5625c5a3e1
7
+ data.tar.gz: 046b15029d5559079502cf1f4c50eeb19c88c897d080f6c5afec2350cb00953dd471abe83b01f4fdf98c834f4eebc486e3c41d88c723274c6b8d1b57041b09e7
data/CHANGES CHANGED
@@ -1,3 +1,6 @@
1
+ = 0.2.3 - 19-Jul-2016
2
+ * Removed the cgi dependency.
3
+
1
4
  = 0.2.2 - 17-Jun-2016
2
5
  * The resource argument to the constructor is now automatically escaped.
3
6
 
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'azure-signature'
5
- gem.version = '0.2.2'
5
+ gem.version = '0.2.3'
6
6
  gem.author = 'Daniel J. Berger'
7
7
  gem.license = 'Apache 2.0'
8
8
  gem.email = 'djberg96@gmail.com'
@@ -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.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
- params = CGI.parse(uri.query.to_s).map { |k,v| [k.downcase, v] }
241
- params.sort_by! { |k,v| k }
242
- params.map! { |k,v| '%s:%s' % [k, v.map(&:strip).sort.join(',')] }
243
- [resource, *params].join("\n")
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.
@@ -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.2", Azure::Signature::VERSION)
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.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-06-17 00:00:00.000000000 Z
11
+ date: 2016-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable