api-auth 1.3.0 → 1.3.1

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: ee9363c952d199ecc16cd1f3395e5ac5bb6637b5
4
- data.tar.gz: 13ebba43bab52e75146b91ff0d81a3e876a8ac1b
3
+ metadata.gz: 8df4c4b6537d3646e5159fb10b1ff7839455cd96
4
+ data.tar.gz: c50289d2bca57c241f41bbdbf5c9a268505c18ab
5
5
  SHA512:
6
- metadata.gz: fbd418e5584e7b84feb9070efac57c2a4215c011065884ef60e9d2a276f93d2c40b59f4c2eca22e1313aefaa6929726af3517d7f92353212c544f01e58c02770
7
- data.tar.gz: 3052ae92cca8d52d3d40f53ba030266e0273b72679cf568e4ccbdb447efed94020b1b2d33f7a3426a54e825d6c32c4f4c6657af216debaaad18491ce0ccc6955
6
+ metadata.gz: 2d11fd71f2ec739b442c1e87c350cc4ec09dd5f1c5acff642abed86a5162654da541eb73d6a3f2146cea3dd07b265741e778e5cdf48da472e00b5404fa1ef07e
7
+ data.tar.gz: 27cc78257708f8f96f95cf4ef1ceb3070c37b30330a1ba8c22278c0891601166345d3a803add2762f9b8bb6dee2d46aa7bdf87f923c4a59943fba3ddb9c95694
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.3.1 (2015-03-13)
2
+ - Fixed a bug where Faraday requests with no parameters were not signed
3
+ correctly (#65 nathanhoel)
4
+
1
5
  # 1.3.0 (2015-03-12)
2
6
  - Add a Faraday Request Driver (#64 nathanhoel)
3
7
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- api-auth (1.3.0)
4
+ api-auth (1.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0
1
+ 1.3.1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- api-auth (1.3.0)
4
+ api-auth (1.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- api-auth (1.3.0)
4
+ api-auth (1.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- api-auth (1.3.0)
4
+ api-auth (1.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- api-auth (1.3.0)
4
+ api-auth (1.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- api-auth (1.3.0)
4
+ api-auth (1.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- api-auth (1.3.0)
4
+ api-auth (1.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -56,7 +56,9 @@ module ApiAuth
56
56
  end
57
57
 
58
58
  def request_uri
59
- uri = URI::HTTP.new(nil, nil, nil, nil, nil, @request.path, nil, @request.params.to_query, nil)
59
+ query_string = @request.params.to_query
60
+ query_string = nil if query_string.empty?
61
+ uri = URI::HTTP.new(nil, nil, nil, nil, nil, @request.path, nil, query_string, nil)
60
62
  uri.to_s
61
63
  end
62
64
 
@@ -570,6 +570,7 @@ describe "ApiAuth" do
570
570
  before(:each) do
571
571
  stubs = Faraday::Adapter::Test::Stubs.new do |stub|
572
572
  stub.put('/resource.xml?foo=bar&bar=foo') { [200, {}, ''] }
573
+ stub.put('/resource.xml') { [200, {}, ''] }
573
574
  end
574
575
 
575
576
  @faraday_conn = Faraday.new do |builder|
@@ -625,7 +626,7 @@ describe "ApiAuth" do
625
626
  @signed_request.headers['Authorization'].should == "APIAuth 1044:#{hmac(@secret_key, @request)}"
626
627
  end
627
628
 
628
- it "should authenticate a valid request" do
629
+ it "should authenticate a valid request with parameters" do
629
630
  ApiAuth.authentic?(@signed_request, @secret_key).should be_true
630
631
  end
631
632
 
@@ -660,6 +661,26 @@ describe "ApiAuth" do
660
661
  it "should retrieve the access_id" do
661
662
  ApiAuth.access_id(@signed_request).should == "1044"
662
663
  end
664
+
665
+ describe 'request_uri' do
666
+ context 'with parameters' do
667
+ it "should return urls with a query string" do
668
+ req = ::ApiAuth::RequestDrivers::FaradayRequest.new(@request)
669
+ req.request_uri.should == '/resource.xml?bar=foo&foo=bar'
670
+ end
671
+ end
672
+
673
+ context 'without parameters' do
674
+ it "should return urls with no query string" do
675
+ @faraday_conn.put '/resource.xml' do |request|
676
+ request.headers.merge!({'content-type' => 'text/plain',
677
+ 'DATE' => Time.now.utc.httpdate})
678
+ req = ::ApiAuth::RequestDrivers::FaradayRequest.new(request)
679
+ req.request_uri.should == '/resource.xml'
680
+ end
681
+ end
682
+ end
683
+ end
663
684
  end
664
685
  end
665
686
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mauricio Gomes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-12 00:00:00.000000000 Z
11
+ date: 2015-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal