jeff 0.7.0 → 0.7.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: 3f7158c532ec3dae4f1536ea70d1f3db88014dcd
4
- data.tar.gz: 9c85321983f671dbde03310f437bb77e65169a99
3
+ metadata.gz: 4a639f62956efb161e7a7e49ff2e7871c4fe047c
4
+ data.tar.gz: fd8e1451516c459c319994c8abc14322c6cd5d3c
5
5
  SHA512:
6
- metadata.gz: c25346ce0feb21e3d09e5ec1b155b8a6f3bcb0b3cdb5722d384a0ca1065a670f01d5793676ce674ba18425e63ec51bc87a64c0d46a8536176b0eba8bc044ec27
7
- data.tar.gz: 993c1b39c3ce3ffc9b9ef200edb568b8603640d0e68c3d88f0ea63a60cd6033dcec285af8654b2db399a4f910d5e61a639d0880dfd3434e80e851ba8ac341123
6
+ metadata.gz: bd5fef3ff0d648da00600818d716b4c16c666477c7abbc9290b9bf51763bd10ad9fb93e15cbfa7bb869147bd3b6b4ab4229b5963a80fa7d14fceb8656387f9c5
7
+ data.tar.gz: 61e31b449e13ca70ff3df5c85c6ebb3d69e8ebd2c2d49357061593165f4efabd1c50345fde89789db6bf3aba793170399c0da914cbf79c834b89c985052e1679
data/.gitignore CHANGED
@@ -1,3 +1,2 @@
1
1
  Gemfile.lock
2
- amazon.yml
3
2
  pkg
data/lib/jeff/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jeff
2
- VERSION = '0.7.0'
2
+ VERSION = '0.7.1'
3
3
  end
data/lib/jeff.rb CHANGED
@@ -40,12 +40,20 @@ module Jeff
40
40
  end
41
41
 
42
42
  # Calculates an RFC 2104-compliant HMAC signature.
43
- Signature = Struct.new(:secret) do
43
+ class Signature
44
44
  SHA256 = OpenSSL::Digest::SHA256.new
45
45
 
46
+ def initialize(secret)
47
+ @secret = secret
48
+ end
49
+
46
50
  def sign(message)
47
51
  Base64.encode64(OpenSSL::HMAC.digest(SHA256, secret, message)).strip
48
52
  end
53
+
54
+ def secret
55
+ @secret or raise ArgumentError, 'Missing secret'
56
+ end
49
57
  end
50
58
 
51
59
  # Because Ruby's CGI escapes ~, we have to resort to writing our own escape.
data/spec/jeff_spec.rb CHANGED
@@ -23,6 +23,11 @@ describe Jeff do
23
23
  assert @klass.params.has_key?('Foo')
24
24
  end
25
25
 
26
+ it 'requires a signature' do
27
+ sig = Jeff::Signature.new(nil)
28
+ proc { sig.sign('foo') }.must_raise ArgumentError
29
+ end
30
+
26
31
  it 'sorts the request query parameters of the client lexicographically' do
27
32
  query = Jeff::Query.new('A10' => 1, 'A1' => 1)
28
33
  query.to_s.must_equal('A1=1&A10=1')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jeff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hakan Ensari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-05 00:00:00.000000000 Z
11
+ date: 2013-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  requirements: []
90
90
  rubyforge_project:
91
- rubygems_version: 2.0.5
91
+ rubygems_version: 2.0.3
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: An AWS client