Class: Tikkie::Api::V1::Configuration
- Inherits:
-
Object
- Object
- Tikkie::Api::V1::Configuration
- Defined in:
- lib/tikkie/api/v1/configuration.rb
Overview
Tikkie API Configuration. An API Key and private key are mandatory. see developer.abnamro.com/get-started
Constant Summary collapse
- SANDBOX_API_URL =
"https://api-sandbox.abnamro.com/v1/"
- PRODUCTION_API_URL =
"https://api.abnamro.com/v1/"
- SANDBOX_OAUTH_TOKEN_URL =
"https://auth-sandbox.abnamro.com/oauth/token"
- PRODUCTION_OAUTH_TOKEN_URL =
"https://auth.abnamro.com/oauth/token"
- DEFAULT_HASHING_ALGORITHM =
"RS256"
- VALID_HASHING_ALGORITHMS =
%w[RS256 RS384 RS512].freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#private_key ⇒ Object
readonly
Returns the value of attribute private_key.
Instance Method Summary collapse
- #api_url ⇒ Object
-
#initialize(api_key, private_key, options = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #jwt_hashing_algorithm ⇒ Object
- #oauth_token_url ⇒ Object
- #private_data ⇒ Object
Constructor Details
#initialize(api_key, private_key, options = {}) ⇒ Configuration
Returns a new instance of Configuration.
20 21 22 23 24 |
# File 'lib/tikkie/api/v1/configuration.rb', line 20 def initialize(api_key, private_key, = {}) @api_key = api_key @private_key = private_key @options = end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
18 19 20 |
# File 'lib/tikkie/api/v1/configuration.rb', line 18 def api_key @api_key end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
18 19 20 |
# File 'lib/tikkie/api/v1/configuration.rb', line 18 def @options end |
#private_key ⇒ Object (readonly)
Returns the value of attribute private_key.
18 19 20 |
# File 'lib/tikkie/api/v1/configuration.rb', line 18 def private_key @private_key end |
Instance Method Details
#api_url ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/tikkie/api/v1/configuration.rb', line 46 def api_url if @options[:test] SANDBOX_API_URL else PRODUCTION_API_URL end end |
#jwt_hashing_algorithm ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tikkie/api/v1/configuration.rb', line 34 def jwt_hashing_algorithm if @options[:hashing_algorithm] unless VALID_HASHING_ALGORITHMS.include?(@options[:hashing_algorithm]) raise Tikkie::Api::V1::Exception, "Invalid hashing algorithm provided: #{@options[:hashing_algorithm]} (expected: #{VALID_HASHING_ALGORITHMS.join(', ')})" end @options[:hashing_algorithm] else DEFAULT_HASHING_ALGORITHM end end |
#oauth_token_url ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/tikkie/api/v1/configuration.rb', line 54 def oauth_token_url if @options[:test] SANDBOX_OAUTH_TOKEN_URL else PRODUCTION_OAUTH_TOKEN_URL end end |