trust_me 0.1.1 → 0.2.0
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/lib/trust_me/version.rb +1 -1
- data/lib/trust_me.rb +9 -1
- data/spec/trust_me_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b31baf4c7c826776f07b777be25fc639f77ab7ea
|
4
|
+
data.tar.gz: 4c399fbf6e01b6b04e55a44a188b37ee1a772188
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 030a01f1a87bdf85257dc18deea797e545585882daa6158a219bab47b8d9c0c6d137ccfb1e9f035bb8cb1532d3f9f1bf9fcdcde0a6e182ef073eee7320ba639b
|
7
|
+
data.tar.gz: 099378d2900dfc5a7f01c4cf6886e586f3eec7077cbb81c062dd6aff3d792184da03bd1c7b175c4dda04a555ade35bb4e9a61912ed141cc0bca640cedc022002
|
data/lib/trust_me/version.rb
CHANGED
data/lib/trust_me.rb
CHANGED
@@ -4,6 +4,7 @@ require "uri"
|
|
4
4
|
require "net/http"
|
5
5
|
require "base64"
|
6
6
|
require "openssl"
|
7
|
+
require "securerandom"
|
7
8
|
|
8
9
|
class TrustMe
|
9
10
|
# Public: URL to the TeleSign REST API.
|
@@ -119,7 +120,7 @@ class TrustMe
|
|
119
120
|
def generate_headers(options = {})
|
120
121
|
content_type = "application/x-www-form-urlencoded"
|
121
122
|
date = Time.now.gmtime.strftime("%a, %d %b %Y %H:%M:%S GMT")
|
122
|
-
nonce =
|
123
|
+
nonce = generate_uuid
|
123
124
|
|
124
125
|
content = [
|
125
126
|
"POST",
|
@@ -181,6 +182,13 @@ class TrustMe
|
|
181
182
|
JSON.parse string
|
182
183
|
end
|
183
184
|
|
185
|
+
# Private: Generates a UUID.
|
186
|
+
#
|
187
|
+
# Returns a String.
|
188
|
+
def generate_uuid
|
189
|
+
SecureRandom.uuid
|
190
|
+
end
|
191
|
+
|
184
192
|
# Private: Submits an API request via POST.
|
185
193
|
#
|
186
194
|
# options - Hash of options
|
data/spec/trust_me_spec.rb
CHANGED
@@ -19,7 +19,7 @@ describe TrustMe do
|
|
19
19
|
|
20
20
|
before do
|
21
21
|
allow(Time).to receive(:now) { now }
|
22
|
-
allow(
|
22
|
+
allow(SecureRandom).to receive(:uuid) { uuid }
|
23
23
|
end
|
24
24
|
|
25
25
|
shared_examples_for "api_call" do |method, extra_request_params = {}|
|