tokenex 0.3.0 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0876095eaf84ab5fab6c2287ea20562be89add3
4
- data.tar.gz: db6c639798126650347a840c429ff468144fe96c
3
+ metadata.gz: b9818be9e9f5cc4c62ab9883eecdc95854f445b8
4
+ data.tar.gz: f582ae1b7aaeee7c0142bc7dfb7b8e2c78b7123b
5
5
  SHA512:
6
- metadata.gz: cf95c4ddde89888a465b7d2032bf8c7fee34673b17237c876ff3b31871840e7164675f026aa2e8bf4eb345af647f57569f9018bd86575256e378befd9b187bca
7
- data.tar.gz: 27d866587f69302442753c6e914f588b1150b01b631401cbfb5f8891f9bc472e5cc02217d755a4b42248e9c77cf42ab206fc8d26c0ada14ba65e485578fd3eab
6
+ metadata.gz: 4ee0b62ad233bb693151736ab160c1f359a080341c91dc8c26cf78e6f0f5892c57cba9f534654604a31aa4ed80769786a241ab3e3ab7aa3d1dda460390cc45d9
7
+ data.tar.gz: 10c18ff221cc252b8ec5e89812067c42024e16364ac3f8a053939a4fe9b6a28adabce4828cc4696948fb1b144c5507bee7282a3bd40f77b2dc9dff6f614d4956
data/README.md CHANGED
@@ -25,10 +25,15 @@ Or install it yourself as:
25
25
  Let's start with a simple tokenization and detokenization of a credit card record:
26
26
 
27
27
  ```ruby
28
- env = Tokenex::Environment.new(api_base_url, token_ex_id, api_key)
29
- token = env.token_from_ccnum(4242424242424242)
30
- ccnum = env.ccnum_from_token(token)
31
- # ccnum === "4242424242424242"
28
+ tokenex = Tokenex::Environment.new(api_base_url, token_ex_id, api_key)
29
+ token = tokenex.token_from_ccnum(4242424242424242)
30
+ ccnum = tokenex.detokenize(token)
31
+ is_valid_token = tokenex.validate_token(token)
32
+ tokenex.delete_token(token)
33
+ arbitrary_data = "This is my string with 3 numbers less than 10"
34
+ token = tokenex.tokenize(arbitrary_data)
35
+ arbitrary_data = tokenex.detokenize(token)
36
+ tokenex.delete_token(token)
32
37
  ```
33
38
 
34
39
  ## Development
@@ -12,15 +12,22 @@ module Tokenex
12
12
  end
13
13
 
14
14
  def token_from_ccnum(ccNum)
15
+ catch (:tokenex_cannot_tokenize_data) do
16
+ return tokenize(ccNum, 3)
17
+ end
18
+ throw :tokenex_invalid_ccnum
19
+ end
20
+
21
+ def tokenize(data_to_tokenize, token_scheme = 4)
15
22
  action = "Tokenize"
16
23
  data = {
17
- "Data" => ccNum,
18
- "TokenScheme" => 3
24
+ "Data" => data_to_tokenize,
25
+ "TokenScheme" => token_scheme
19
26
  }
20
27
 
21
28
  response = send_request(action, data)
22
- throw :tokenex_invalid_ccnum unless is_valid_response(response)
23
-
29
+ throw :tokenex_cannot_tokenize_data unless is_valid_response(response)
30
+
24
31
  return response['Token']
25
32
  end
26
33
 
@@ -1,3 +1,3 @@
1
1
  module Tokenex
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tokenex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Clifford