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 +4 -4
- data/README.md +9 -4
- data/lib/tokenex/environment.rb +11 -4
- data/lib/tokenex/version.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: b9818be9e9f5cc4c62ab9883eecdc95854f445b8
|
4
|
+
data.tar.gz: f582ae1b7aaeee7c0142bc7dfb7b8e2c78b7123b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
29
|
-
token =
|
30
|
-
ccnum =
|
31
|
-
|
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
|
data/lib/tokenex/environment.rb
CHANGED
@@ -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" =>
|
18
|
-
"TokenScheme" =>
|
24
|
+
"Data" => data_to_tokenize,
|
25
|
+
"TokenScheme" => token_scheme
|
19
26
|
}
|
20
27
|
|
21
28
|
response = send_request(action, data)
|
22
|
-
throw :
|
23
|
-
|
29
|
+
throw :tokenex_cannot_tokenize_data unless is_valid_response(response)
|
30
|
+
|
24
31
|
return response['Token']
|
25
32
|
end
|
26
33
|
|
data/lib/tokenex/version.rb
CHANGED