jeff 0.7.0 → 0.7.1
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/.gitignore +0 -1
- data/lib/jeff/version.rb +1 -1
- data/lib/jeff.rb +9 -1
- data/spec/jeff_spec.rb +5 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a639f62956efb161e7a7e49ff2e7871c4fe047c
|
4
|
+
data.tar.gz: fd8e1451516c459c319994c8abc14322c6cd5d3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd5fef3ff0d648da00600818d716b4c16c666477c7abbc9290b9bf51763bd10ad9fb93e15cbfa7bb869147bd3b6b4ab4229b5963a80fa7d14fceb8656387f9c5
|
7
|
+
data.tar.gz: 61e31b449e13ca70ff3df5c85c6ebb3d69e8ebd2c2d49357061593165f4efabd1c50345fde89789db6bf3aba793170399c0da914cbf79c834b89c985052e1679
|
data/.gitignore
CHANGED
data/lib/jeff/version.rb
CHANGED
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
|
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.
|
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
|
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.
|
91
|
+
rubygems_version: 2.0.3
|
92
92
|
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: An AWS client
|