Class: PostFinanceCheckout::Configuration
- Inherits:
-
Object
- Object
- PostFinanceCheckout::Configuration
- Defined in:
- lib/postfinancecheckout-ruby-sdk/configuration.rb
Instance Attribute Summary collapse
-
#authentication_key ⇒ String
Defines the authentication_key used for request authentication.
-
#base_path ⇒ Object
Defines url base path.
-
#cert_file ⇒ Object
TLS/SSL setting Client certificate file (for client certificate).
-
#debugging ⇒ true, false
Set this to enable/disable debugging.
-
#default_headers ⇒ Object
Returns the value of attribute default_headers.
-
#force_ending_format ⇒ Object
Returns the value of attribute force_ending_format.
-
#host ⇒ Object
Defines url host.
-
#inject_format ⇒ Object
Returns the value of attribute inject_format.
-
#key_file ⇒ Object
TLS/SSL setting Client private key file (for client certificate).
-
#logger ⇒ #debug
Defines the logger used for debugging.
-
#params_encoding ⇒ Object
Set this to customize parameters encoding of array parameter with multi collectionFormat.
-
#scheme ⇒ Object
Defines url scheme.
-
#ssl_ca_cert ⇒ String
TLS/SSL setting Set this to customize the certificate file to verify the peer.
-
#temp_folder_path ⇒ String
Defines the temporary folder to store downloaded files (for API endpoints that have file response).
-
#timeout ⇒ Object
The time limit for HTTP request in seconds.
-
#user_id ⇒ String
Defines the user_id used for request authentication.
Class Method Summary collapse
-
.default ⇒ Object
The default Configuration object.
Instance Method Summary collapse
- #base_url ⇒ Object
- #configure {|_self| ... } ⇒ Object
-
#initialize(default_headers = {}) {|_self| ... } ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(default_headers = {}) {|_self| ... } ⇒ Configuration
Returns a new instance of Configuration.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 95 def initialize(default_headers = {}) @scheme = 'https' @host = 'checkout.postfinance.ch:443' @base_path = '/api' @timeout = 25 @params_encoding = nil @cert_file = nil @key_file = nil @debugging = false @inject_format = false @force_ending_format = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @default_headers = default_headers yield(self) if block_given? end |
Instance Attribute Details
#authentication_key ⇒ String
Defines the authentication_key used for request authentication.
39 40 41 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 39 def authentication_key @authentication_key end |
#base_path ⇒ Object
Defines url base path
29 30 31 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 29 def base_path @base_path end |
#cert_file ⇒ Object
TLS/SSL setting Client certificate file (for client certificate)
76 77 78 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 76 def cert_file @cert_file end |
#debugging ⇒ true, false
Set this to enable/disable debugging. When enabled (set to true), HTTP request/response details will be logged with ‘logger.debug` (see the `logger` attribute). Default to false.
46 47 48 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 46 def debugging @debugging end |
#default_headers ⇒ Object
Returns the value of attribute default_headers.
93 94 95 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 93 def default_headers @default_headers end |
#force_ending_format ⇒ Object
Returns the value of attribute force_ending_format.
91 92 93 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 91 def force_ending_format @force_ending_format end |
#host ⇒ Object
Defines url host
26 27 28 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 26 def host @host end |
#inject_format ⇒ Object
Returns the value of attribute inject_format.
89 90 91 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 89 def inject_format @inject_format end |
#key_file ⇒ Object
TLS/SSL setting Client private key file (for client certificate)
80 81 82 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 80 def key_file @key_file end |
#logger ⇒ #debug
Defines the logger used for debugging. Default to ‘Rails.logger` (when in Rails) or logging to STDOUT.
52 53 54 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 52 def logger @logger end |
#params_encoding ⇒ Object
Set this to customize parameters encoding of array parameter with multi collectionFormat. Default to nil.
github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
87 88 89 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 87 def params_encoding @params_encoding end |
#scheme ⇒ Object
Defines url scheme
23 24 25 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 23 def scheme @scheme end |
#ssl_ca_cert ⇒ String
TLS/SSL setting Set this to customize the certificate file to verify the peer.
github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
72 73 74 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 72 def ssl_ca_cert @ssl_ca_cert end |
#temp_folder_path ⇒ String
Defines the temporary folder to store downloaded files (for API endpoints that have file response). Default to use ‘Tempfile`.
59 60 61 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 59 def temp_folder_path @temp_folder_path end |
#timeout ⇒ Object
The time limit for HTTP request in seconds. Default to 25.
63 64 65 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 63 def timeout @timeout end |
#user_id ⇒ String
Defines the user_id used for request authentication.
34 35 36 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 34 def user_id @user_id end |
Class Method Details
.default ⇒ Object
The default Configuration object.
113 114 115 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 113 def self.default @@default ||= Configuration.new end |
Instance Method Details
#base_url ⇒ Object
137 138 139 140 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 137 def base_url url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') Addressable::URI.encode(url) end |
#configure {|_self| ... } ⇒ Object
117 118 119 |
# File 'lib/postfinancecheckout-ruby-sdk/configuration.rb', line 117 def configure yield(self) if block_given? end |