rainforest_auth 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/lib/rainforest/auth.rb +14 -14
- metadata +31 -3
- metadata.gz.sig +2 -0
data.tar.gz.sig
ADDED
Binary file
|
data/lib/rainforest/auth.rb
CHANGED
@@ -17,25 +17,25 @@ class RainforestAuth
|
|
17
17
|
self
|
18
18
|
end
|
19
19
|
|
20
|
-
def get_run_callback run_id,
|
21
|
-
digest = sign(
|
22
|
-
"https://www.rainforestqa.com/api/1/callback/run/#{run_id}/#{
|
20
|
+
def get_run_callback run_id, callback_type
|
21
|
+
digest = sign(callback_type, {run_id: run_id})
|
22
|
+
"https://www.rainforestqa.com/api/1/callback/run/#{run_id}/#{callback_type}/#{digest}"
|
23
23
|
end
|
24
24
|
|
25
|
-
# Return a signature for a
|
26
|
-
def sign
|
27
|
-
OpenSSL::HMAC.hexdigest(digest, @key, merge_data(
|
25
|
+
# Return a signature for a callback_type and specified options
|
26
|
+
def sign callback_type, options = nil
|
27
|
+
OpenSSL::HMAC.hexdigest(digest, @key, merge_data(callback_type, options))
|
28
28
|
end
|
29
29
|
|
30
|
-
# Verify a digest vs
|
31
|
-
def verify digest,
|
32
|
-
digest == sign(
|
30
|
+
# Verify a digest vs callback_type and options
|
31
|
+
def verify digest, callback_type, options = nil
|
32
|
+
digest == sign(callback_type, options)
|
33
33
|
end
|
34
34
|
|
35
35
|
# Run a block if valid
|
36
|
-
def run_if_valid digest,
|
37
|
-
if verify digest,
|
38
|
-
block.call
|
36
|
+
def run_if_valid digest, callback_type, options, &block
|
37
|
+
if verify digest, callback_type, options
|
38
|
+
block.call callback_type, options
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -45,8 +45,8 @@ class RainforestAuth
|
|
45
45
|
OpenSSL::Digest::Digest.new 'sha1'
|
46
46
|
end
|
47
47
|
|
48
|
-
def merge_data
|
49
|
-
{
|
48
|
+
def merge_data callback_type, options
|
49
|
+
{callback_type: callback_type, options: options}.to_json
|
50
50
|
end
|
51
51
|
|
52
52
|
end
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rainforest_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Russell Smith
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
|
-
cert_chain:
|
12
|
-
|
11
|
+
cert_chain:
|
12
|
+
- !binary |-
|
13
|
+
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURPRENDQWlDZ0F3SUJB
|
14
|
+
Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREJDTVEwd0N3WURWUVFEREFSeWRY
|
15
|
+
TnoKTVJ3d0dnWUtDWkltaVpQeUxHUUJHUllNY21GcGJtWnZjbVZ6ZEhGaE1S
|
16
|
+
TXdFUVlLQ1pJbWlaUHlMR1FCR1JZRApZMjl0TUI0WERURXpNREV3T0RFeU5E
|
17
|
+
VTBNbG9YRFRFME1ERXdPREV5TkRVME1sb3dRakVOTUFzR0ExVUVBd3dFCmNu
|
18
|
+
VnpjekVjTUJvR0NnbVNKb21UOGl4a0FSa1dESEpoYVc1bWIzSmxjM1J4WVRF
|
19
|
+
VE1CRUdDZ21TSm9tVDhpeGsKQVJrV0EyTnZiVENDQVNJd0RRWUpLb1pJaHZj
|
20
|
+
TkFRRUJCUUFEZ2dFUEFEQ0NBUW9DZ2dFQkFLb3c3U3JHN3pnSwp0UG1QM28r
|
21
|
+
RkNvS3h5UjVwQUdLT3VLVVpVWlFBbnEyeU0vSk9rbW11TDQ2bTE3RGFDdDZ3
|
22
|
+
N2s0Umx2UnpncmQyCkMzcGJWV3lxclhHNS9sS3djaThsdTRtbTl2YlZkZVhB
|
23
|
+
TmJTRnk3eno3YnJSVTErYVUvMWxRblErWXltemFpdTMKYm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