trust_me 0.1.1 → 0.2.0

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: b27c6d276f92c43d1c327c45d95b3508639ef0fa
4
- data.tar.gz: be8f2eb7a3910b92adeb1fbb3fab9403776357b6
3
+ metadata.gz: b31baf4c7c826776f07b777be25fc639f77ab7ea
4
+ data.tar.gz: 4c399fbf6e01b6b04e55a44a188b37ee1a772188
5
5
  SHA512:
6
- metadata.gz: 08eb5e47d9fd3b79c0b644a018250fa46d6bd6e4070ce14b680e75a0b2217b714f09fe013104adab143b44e94e15813e5fcac38937e7883241731a66764aef8e
7
- data.tar.gz: b02fa2bb5f7572097f3ce55a75daa365422b634c6a8fedae4508833a40e25b5962efa1d3a3dca4617669e179bc6eb244a4349d02abc5852665c4f48fe39c8f89
6
+ metadata.gz: 030a01f1a87bdf85257dc18deea797e545585882daa6158a219bab47b8d9c0c6d137ccfb1e9f035bb8cb1532d3f9f1bf9fcdcde0a6e182ef073eee7320ba639b
7
+ data.tar.gz: 099378d2900dfc5a7f01c4cf6886e586f3eec7077cbb81c062dd6aff3d792184da03bd1c7b175c4dda04a555ade35bb4e9a61912ed141cc0bca640cedc022002
@@ -1,3 +1,3 @@
1
1
  class TrustMe
2
- VERSION = Version = "0.1.1"
2
+ VERSION = Version = "0.2.0"
3
3
  end
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 = `uuidgen`.chomp
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
@@ -19,7 +19,7 @@ describe TrustMe do
19
19
 
20
20
  before do
21
21
  allow(Time).to receive(:now) { now }
22
- allow(trust_me).to receive(:`).with("uuidgen") { uuid }
22
+ allow(SecureRandom).to receive(:uuid) { uuid }
23
23
  end
24
24
 
25
25
  shared_examples_for "api_call" do |method, extra_request_params = {}|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trust_me
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Priddle