Class: Tokenex::Environment
- Inherits:
-
Object
- Object
- Tokenex::Environment
- Defined in:
- lib/tokenex/environment.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#reference_number ⇒ Object
readonly
Returns the value of attribute reference_number.
Instance Method Summary collapse
- #delete_token(token) ⇒ Object
- #detokenize(token) ⇒ Object
-
#initialize(api_base_url, tokenex_id, api_key, options = {}) ⇒ Environment
constructor
A new instance of Environment.
- #token_from_ccnum(ccnum, token_scheme = TOKEN_SCHEME[:TOKENfour]) ⇒ Object
- #tokenize(data, token_scheme = TOKEN_SCHEME[:GUID]) ⇒ Object
- #tokenize_from_encrypted_value(encrypted_data, token_scheme) ⇒ Object
- #validate_token(token) ⇒ Object
Constructor Details
#initialize(api_base_url, tokenex_id, api_key, options = {}) ⇒ Environment
Returns a new instance of Environment.
9 10 11 12 13 |
# File 'lib/tokenex/environment.rb', line 9 def initialize(api_base_url, tokenex_id, api_key, ={}) @api_base_url = api_base_url @tokenex_id = tokenex_id @api_key = api_key end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
7 8 9 |
# File 'lib/tokenex/environment.rb', line 7 def error @error end |
#reference_number ⇒ Object (readonly)
Returns the value of attribute reference_number.
7 8 9 |
# File 'lib/tokenex/environment.rb', line 7 def reference_number @reference_number end |
Instance Method Details
#delete_token(token) ⇒ Object
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/tokenex/environment.rb', line 68 def delete_token(token) request_parameters = { REQUEST_PARAMS[:Token] => token } catch (:tokenex_invalid_response) do return send_request(TOKEN_ACTION[:DeleteToken], request_parameters) end throw :tokenex_invalid_token end |
#detokenize(token) ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/tokenex/environment.rb', line 46 def detokenize(token) request_parameters = { REQUEST_PARAMS[:Token] => token } catch (:tokenex_invalid_response) do return send_request(TOKEN_ACTION[:Detokenize], request_parameters) end throw :tokenex_invalid_token end |
#token_from_ccnum(ccnum, token_scheme = TOKEN_SCHEME[:TOKENfour]) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/tokenex/environment.rb', line 15 def token_from_ccnum(ccnum, token_scheme = TOKEN_SCHEME[:TOKENfour]) catch (:tokenex_cannot_tokenize_data) do return tokenize(ccnum, token_scheme) end throw :tokenex_invalid_ccnum end |
#tokenize(data, token_scheme = TOKEN_SCHEME[:GUID]) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/tokenex/environment.rb', line 22 def tokenize(data, token_scheme = TOKEN_SCHEME[:GUID]) request_parameters = { REQUEST_PARAMS[:Data] => data, REQUEST_PARAMS[:TokenScheme] => token_scheme } catch (:tokenex_invalid_response) do return send_request(TOKEN_ACTION[:Tokenize], request_parameters) end throw :tokenex_cannot_tokenize_data end |
#tokenize_from_encrypted_value(encrypted_data, token_scheme) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tokenex/environment.rb', line 34 def tokenize_from_encrypted_value(encrypted_data, token_scheme) request_parameters = { REQUEST_PARAMS[:EncryptedData] => encrypted_data, REQUEST_PARAMS[:TokenScheme] => token_scheme } catch (:tokenex_invalid_response) do return send_request(TOKEN_ACTION[:TokenizeFromEncryptedValue], request_parameters) end throw :tokenex_cannot_tokenize_from_encrypted_value end |
#validate_token(token) ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/tokenex/environment.rb', line 57 def validate_token(token) request_parameters = { REQUEST_PARAMS[:Token] => token } catch (:tokenex_invalid_response) do return send_request(TOKEN_ACTION[:ValidateToken], request_parameters) end throw :tokenex_invalid_token end |