apimatic-polpay-sdk 0.0.1

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.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +173 -0
  4. data/bin/console +15 -0
  5. data/lib/poli_ap_is/api_helper.rb +10 -0
  6. data/lib/poli_ap_is/apis/base_api.rb +67 -0
  7. data/lib/poli_ap_is/apis/payments_api.rb +155 -0
  8. data/lib/poli_ap_is/apis/poli_links_api.rb +135 -0
  9. data/lib/poli_ap_is/client.rb +79 -0
  10. data/lib/poli_ap_is/configuration.rb +179 -0
  11. data/lib/poli_ap_is/exceptions/api_exception.rb +21 -0
  12. data/lib/poli_ap_is/http/api_response.rb +19 -0
  13. data/lib/poli_ap_is/http/auth/basic_auth.rb +62 -0
  14. data/lib/poli_ap_is/http/http_call_back.rb +10 -0
  15. data/lib/poli_ap_is/http/http_method_enum.rb +10 -0
  16. data/lib/poli_ap_is/http/http_request.rb +10 -0
  17. data/lib/poli_ap_is/http/http_response.rb +10 -0
  18. data/lib/poli_ap_is/http/proxy_settings.rb +22 -0
  19. data/lib/poli_ap_is/logging/configuration/api_logging_configuration.rb +186 -0
  20. data/lib/poli_ap_is/logging/sdk_logger.rb +17 -0
  21. data/lib/poli_ap_is/models/bank_details.rb +126 -0
  22. data/lib/poli_ap_is/models/base_model.rb +110 -0
  23. data/lib/poli_ap_is/models/create_poli_link_request.rb +170 -0
  24. data/lib/poli_ap_is/models/create_poli_link_request_body_json.rb +170 -0
  25. data/lib/poli_ap_is/models/daily_transaction.rb +245 -0
  26. data/lib/poli_ap_is/models/fetch_statusof_poli_link_response200_text.rb +48 -0
  27. data/lib/poli_ap_is/models/financial_institution.rb +95 -0
  28. data/lib/poli_ap_is/models/get_transaction_response.rb +109 -0
  29. data/lib/poli_ap_is/models/initiate_transaction_request.rb +201 -0
  30. data/lib/poli_ap_is/models/initiate_transaction_response.rb +118 -0
  31. data/lib/poli_ap_is/models/link_payment.rb +137 -0
  32. data/lib/poli_ap_is/models/merchant_details.rb +100 -0
  33. data/lib/poli_ap_is/models/payer_details.rb +100 -0
  34. data/lib/poli_ap_is/models/poli_link_basic_info.rb +116 -0
  35. data/lib/poli_ap_is/models/poli_link_basic_info_status.rb +48 -0
  36. data/lib/poli_ap_is/models/poli_link_payments_response.rb +116 -0
  37. data/lib/poli_ap_is/models/poli_link_payments_response_status.rb +48 -0
  38. data/lib/poli_ap_is/models/poli_link_payments_response_transactions_items.rb +159 -0
  39. data/lib/poli_ap_is/models/transaction_details.rb +148 -0
  40. data/lib/poli_ap_is/utilities/date_time_helper.rb +11 -0
  41. data/lib/poli_ap_is/utilities/file_wrapper.rb +28 -0
  42. data/lib/poli_ap_is.rb +64 -0
  43. metadata +126 -0
@@ -0,0 +1,179 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # An enum for SDK environments.
8
+ class Environment
9
+ # PRODUCTION: Production environment
10
+ # ENVIRONMENT2: UAT environment
11
+ ENVIRONMENT = [
12
+ PRODUCTION = 'production'.freeze,
13
+ ENVIRONMENT2 = 'environment2'.freeze
14
+ ].freeze
15
+
16
+ # Converts a string or symbol into a valid Environment constant.
17
+ def self.from_value(value, default_value = PRODUCTION)
18
+ return default_value if value.nil?
19
+
20
+ str = value.to_s.strip.downcase
21
+ case str
22
+ when 'production' then PRODUCTION
23
+ when 'environment2' then ENVIRONMENT2
24
+
25
+ else
26
+ warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} "
27
+ default_value
28
+ end
29
+ end
30
+ end
31
+
32
+ # An enum for API servers.
33
+ class Server
34
+ SERVER = [
35
+ DEFAULT = 'default'.freeze
36
+ ].freeze
37
+
38
+ # Converts a string or symbol into a valid Server constant.
39
+ def self.from_value(value, default_value = DEFAULT)
40
+ return default_value if value.nil?
41
+
42
+ default_value
43
+ end
44
+ end
45
+
46
+ # All configuration including auth info and base URI for the API access
47
+ # are configured in this class.
48
+ class Configuration < CoreLibrary::HttpClientConfiguration
49
+ # The attribute readers for properties.
50
+ attr_reader :environment, :basic_auth_credentials
51
+
52
+ class << self
53
+ attr_reader :environments
54
+ end
55
+
56
+ def initialize(
57
+ connection: nil, adapter: :net_http_persistent, timeout: 30,
58
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
59
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
60
+ retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
61
+ logging_configuration: nil, environment: Environment::PRODUCTION,
62
+ basic_auth_credentials: nil
63
+ )
64
+ super connection: connection, adapter: adapter, timeout: timeout,
65
+ max_retries: max_retries, retry_interval: retry_interval,
66
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
67
+ retry_methods: retry_methods, http_callback: http_callback,
68
+ proxy_settings: proxy_settings,
69
+ logging_configuration: logging_configuration
70
+
71
+ # Current API environment
72
+ @environment = String(environment)
73
+
74
+ # The object holding Basic Authentication credentials
75
+ @basic_auth_credentials = basic_auth_credentials
76
+
77
+ # Initializing Basic Authentication credentials with the provided auth parameters
78
+ @basic_auth_credentials = basic_auth_credentials
79
+
80
+ # The Http Client to use for making requests.
81
+ set_http_client CoreLibrary::FaradayClient.new(self)
82
+ end
83
+
84
+ def clone_with(connection: nil, adapter: nil, timeout: nil,
85
+ max_retries: nil, retry_interval: nil, backoff_factor: nil,
86
+ retry_statuses: nil, retry_methods: nil, http_callback: nil,
87
+ proxy_settings: nil, logging_configuration: nil,
88
+ environment: nil, basic_auth_credentials: nil)
89
+ connection ||= self.connection
90
+ adapter ||= self.adapter
91
+ timeout ||= self.timeout
92
+ max_retries ||= self.max_retries
93
+ retry_interval ||= self.retry_interval
94
+ backoff_factor ||= self.backoff_factor
95
+ retry_statuses ||= self.retry_statuses
96
+ retry_methods ||= self.retry_methods
97
+ http_callback ||= self.http_callback
98
+ proxy_settings ||= self.proxy_settings
99
+ logging_configuration ||= self.logging_configuration
100
+ environment ||= self.environment
101
+ basic_auth_credentials ||= self.basic_auth_credentials
102
+
103
+ Configuration.new(connection: connection, adapter: adapter,
104
+ timeout: timeout, max_retries: max_retries,
105
+ retry_interval: retry_interval,
106
+ backoff_factor: backoff_factor,
107
+ retry_statuses: retry_statuses,
108
+ retry_methods: retry_methods,
109
+ http_callback: http_callback,
110
+ proxy_settings: proxy_settings,
111
+ logging_configuration: logging_configuration,
112
+ environment: environment,
113
+ basic_auth_credentials: basic_auth_credentials)
114
+ end
115
+
116
+
117
+ # All the environments the SDK can run in.
118
+ ENVIRONMENTS = {
119
+ Environment::PRODUCTION => {
120
+ Server::DEFAULT => 'https://poliapi.apac.paywithpoli.com/api'
121
+ },
122
+ Environment::ENVIRONMENT2 => {
123
+ Server::DEFAULT => 'https://poliapi.uat3.paywithpoli.com/api'
124
+ }
125
+ }.freeze
126
+
127
+ # Generates the appropriate base URI for the environment and the server.
128
+ # @param [Configuration::Server] server The server enum for which the base URI is
129
+ # required.
130
+ # @return [String] The base URI.
131
+ def get_base_uri(server = Server::DEFAULT)
132
+ ENVIRONMENTS[environment][server].clone
133
+ end
134
+
135
+ # Builds a Configuration instance using environment variables.
136
+ def self.build_default_config_from_env
137
+ # === Core environment ===
138
+ environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'production'))
139
+ timeout = (ENV['TIMEOUT'] || 30).to_f
140
+ max_retries = (ENV['MAX_RETRIES'] || 0).to_i
141
+ retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f
142
+ backoff_factor = (ENV['BACKOFF_FACTOR'] || 2).to_f
143
+ retry_statuses = ENV.fetch('RETRY_STATUSES',
144
+ '[408, 413, 429, 500, 502, 503, 504, 521, 522, 524]').gsub(/[\[\]]/, '')
145
+ .split(',')
146
+ .map(&:strip)
147
+ .map do |item|
148
+ item.match?(/\A\d+\z/) ? item.to_i : item.downcase
149
+ end
150
+ retry_methods = ENV.fetch('RETRY_METHODS', '%i[get put]').gsub(/[\[\]]/, '')
151
+ .split(',')
152
+ .map(&:strip)
153
+ .map do |item|
154
+ item.match?(/\A\d+\z/) ? item.to_i : item.downcase
155
+ end
156
+
157
+ # === Authentication credentials ===
158
+ basic_auth_credentials = BasicAuthCredentials.from_env
159
+
160
+ # === Proxy settings ===
161
+ proxy_settings = ProxySettings.from_env
162
+ # === Logging Configuration ===
163
+ logging_configuration = LoggingConfiguration.from_env if LoggingConfiguration.any_logging_configured?
164
+
165
+ Configuration.new(
166
+ environment: environment,
167
+ timeout: timeout,
168
+ max_retries: max_retries,
169
+ retry_interval: retry_interval,
170
+ backoff_factor: backoff_factor,
171
+ retry_statuses: retry_statuses,
172
+ retry_methods: retry_methods,
173
+ basic_auth_credentials: basic_auth_credentials,
174
+ proxy_settings: proxy_settings,
175
+ logging_configuration: logging_configuration
176
+ )
177
+ end
178
+ end
179
+ end
@@ -0,0 +1,21 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # Class for exceptions when there is a network error, status code error, etc.
8
+ class APIException < CoreLibrary::ApiException
9
+ # Provides a human-readable string representation of the object.
10
+ def to_s
11
+ class_name = self.class.name.split('::').last
12
+ "<#{class_name} status_code: #{@response_code}, reason: #{@reason}>"
13
+ end
14
+
15
+ # Provides a debugging-friendly string with detailed object information.
16
+ def inspect
17
+ class_name = self.class.name.split('::').last
18
+ "<#{class_name} status_code: #{@response_code.inspect}, reason: #{@reason.inspect}>"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # Http response received.
8
+ class ApiResponse < CoreLibrary::ApiResponse
9
+ # The constructor
10
+ # @param [HttpResponse] http_response The original, raw response from the api.
11
+ # @param [Object] data The data field specified for the response.
12
+ # @param [Array<String>] errors Any errors returned by the server.
13
+ def initialize(http_response,
14
+ data: nil,
15
+ errors: nil)
16
+ super
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,62 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # Utility class for basic authorization.
8
+ class BasicAuth < CoreLibrary::HeaderAuth
9
+ include CoreLibrary
10
+ # Display error message on occurrence of authentication failure.
11
+ # @returns [String] The oAuth error message.
12
+ def error_message
13
+ 'BasicAuth: basic_auth_user_name or basic_auth_password is undefined.'
14
+ end
15
+
16
+ # Initialization constructor.
17
+ def initialize(basic_auth_credentials)
18
+ auth_params = {}
19
+ unless basic_auth_credentials.nil? ||
20
+ basic_auth_credentials.username.nil? ||
21
+ basic_auth_credentials.password.nil?
22
+ auth_params['Authorization'] =
23
+ "Basic #{AuthHelper.get_base64_encoded_value(basic_auth_credentials.username,
24
+ basic_auth_credentials.password)}"
25
+ end
26
+
27
+ super auth_params
28
+ end
29
+ end
30
+
31
+ # Data class for BasicAuthCredentials.
32
+ class BasicAuthCredentials
33
+ attr_reader :username, :password
34
+
35
+ def initialize(username:, password:)
36
+ raise ArgumentError, 'username cannot be nil' if username.nil?
37
+ raise ArgumentError, 'password cannot be nil' if password.nil?
38
+
39
+ @username = username
40
+ @password = password
41
+ end
42
+
43
+ def self.from_env
44
+ username = ENV['USERNAME']
45
+ password = ENV['PASSWORD']
46
+ all_nil = [
47
+ username,
48
+ password
49
+ ].all?(&:nil?)
50
+ return nil if all_nil
51
+
52
+ new(username: username, password: password)
53
+ end
54
+
55
+ def clone_with(username: nil, password: nil)
56
+ username ||= self.username
57
+ password ||= self.password
58
+
59
+ BasicAuthCredentials.new(username: username, password: password)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,10 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # HttpCallBack allows defining callables for pre and post API calls.
8
+ class HttpCallBack < CoreLibrary::HttpCallback
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # HTTP Methods Enumeration.
8
+ class HttpMethodEnum < CoreLibrary::HttpMethod
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # Represents a single Http Request.
8
+ class HttpRequest < CoreLibrary::HttpRequest
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # Http response received.
8
+ class HttpResponse < CoreLibrary::HttpResponse
9
+ end
10
+ end
@@ -0,0 +1,22 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ ##
8
+ # ProxySettings encapsulates HTTP proxy configuration for Faraday,
9
+ # including optional basic authentication.
10
+ #
11
+ class ProxySettings < CoreLibrary::ProxySettings
12
+ def self.from_env
13
+ address = ENV['PROXY_ADDRESS']
14
+ port = ENV['PROXY_PORT']
15
+ username = ENV['PROXY_USERNAME']
16
+ password = ENV['PROXY_PASSWORD']
17
+ return nil if address.nil? || address.strip.empty?
18
+
19
+ new(address: address, port: port, username: username, password: password)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,186 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # Initializes a new instance of RequestLoggingConfiguration.
8
+ class RequestLoggingConfiguration < CoreLibrary::ApiRequestLoggingConfiguration
9
+ # @param log_body [Boolean] Indicates whether the message body should be logged. Default is false.
10
+ # @param log_headers [Boolean] Indicates whether the message headers should be logged. Default is false.
11
+ # @param headers_to_exclude [Array<String>] Array of headers not displayed in logging. Default is an empty array.
12
+ # @param headers_to_include [Array<String>] Array of headers to be displayed in logging. Default is an empty array.
13
+ # @param headers_to_unmask [Array<String>] Array of headers which values are non-sensitive to display in logging.
14
+ # Default is an empty array.
15
+ def initialize(log_body: false, log_headers: false, headers_to_include: nil,
16
+ headers_to_exclude: nil, headers_to_unmask: nil,
17
+ include_query_in_path: false)
18
+ super(
19
+ log_body,
20
+ log_headers,
21
+ headers_to_exclude,
22
+ headers_to_include,
23
+ headers_to_unmask,
24
+ include_query_in_path
25
+ )
26
+ end
27
+
28
+ def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
29
+ headers_to_exclude: nil, headers_to_unmask: nil, include_query_in_path: nil)
30
+ log_body ||= self.log_body
31
+ log_headers ||= self.log_headers
32
+ headers_to_include ||= self.headers_to_include
33
+ headers_to_exclude ||= self.headers_to_exclude
34
+ headers_to_unmask ||= self.headers_to_unmask
35
+ include_query_in_path ||= self.include_query_in_path
36
+
37
+ RequestLoggingConfiguration.new(
38
+ log_body: log_body,
39
+ log_headers: log_headers,
40
+ headers_to_include: headers_to_include,
41
+ headers_to_exclude: headers_to_exclude,
42
+ headers_to_unmask: headers_to_unmask,
43
+ include_query_in_path: include_query_in_path
44
+ )
45
+ end
46
+
47
+ def self.from_env
48
+ log_body = ENV['REQUEST_LOG_BODY']
49
+ log_headers = ENV['REQUEST_LOG_HEADERS']
50
+ headers_to_include = ENV['REQUEST_HEADERS_TO_INCLUDE']
51
+ headers_to_exclude = ENV['REQUEST_HEADERS_TO_EXCLUDE']
52
+ headers_to_unmask = ENV['REQUEST_HEADERS_TO_UNMASK']
53
+ include_query_in_path = ENV['REQUEST_INCLUDE_QUERY_IN_PATH']
54
+
55
+ new(
56
+ log_body: log_body,
57
+ log_headers: log_headers,
58
+ headers_to_include: headers_to_include,
59
+ headers_to_exclude: headers_to_exclude,
60
+ headers_to_unmask: headers_to_unmask,
61
+ include_query_in_path: include_query_in_path
62
+ )
63
+ end
64
+
65
+ def self.any_logging_configured?
66
+ %w[
67
+ REQUEST_LOG_BODY
68
+ REQUEST_LOG_HEADERS
69
+ REQUEST_HEADERS_TO_INCLUDE
70
+ REQUEST_HEADERS_TO_EXCLUDE
71
+ REQUEST_HEADERS_TO_UNMASK
72
+ REQUEST_INCLUDE_QUERY_IN_PATH
73
+ ].any? { |key| ENV.key?(key) && !ENV[key].nil? && !ENV[key].empty? }
74
+ end
75
+ end
76
+
77
+ # Initializes a new instance of ResponseLoggingConfiguration.
78
+ class ResponseLoggingConfiguration < CoreLibrary::ApiResponseLoggingConfiguration
79
+ def initialize(log_body: false, log_headers: false, headers_to_include: nil,
80
+ headers_to_exclude: nil, headers_to_unmask: nil)
81
+ super(
82
+ log_body,
83
+ log_headers,
84
+ headers_to_exclude,
85
+ headers_to_include,
86
+ headers_to_unmask
87
+ )
88
+ end
89
+
90
+ def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
91
+ headers_to_exclude: nil, headers_to_unmask: nil)
92
+ log_body ||= self.log_body
93
+ log_headers ||= self.log_headers
94
+ headers_to_include ||= self.headers_to_include
95
+ headers_to_exclude ||= self.headers_to_exclude
96
+ headers_to_unmask ||= self.headers_to_unmask
97
+
98
+ ResponseLoggingConfiguration.new(
99
+ log_body: log_body,
100
+ log_headers: log_headers,
101
+ headers_to_include: headers_to_include,
102
+ headers_to_exclude: headers_to_exclude,
103
+ headers_to_unmask: headers_to_unmask
104
+ )
105
+ end
106
+
107
+ def self.from_env
108
+ log_body = ENV['RESPONSE_LOG_BODY']
109
+ log_headers = ENV['RESPONSE_LOG_HEADERS']
110
+ headers_to_include = ENV['RESPONSE_HEADERS_TO_INCLUDE']
111
+ headers_to_exclude = ENV['RESPONSE_HEADERS_TO_EXCLUDE']
112
+ headers_to_unmask = ENV['RESPONSE_HEADERS_TO_UNMASK']
113
+
114
+ new(
115
+ log_body: log_body,
116
+ log_headers: log_headers,
117
+ headers_to_include: headers_to_include,
118
+ headers_to_exclude: headers_to_exclude,
119
+ headers_to_unmask: headers_to_unmask
120
+ )
121
+ end
122
+
123
+ def self.any_logging_configured?
124
+ %w[
125
+ RESPONSE_LOG_BODY
126
+ RESPONSE_LOG_HEADERS
127
+ RESPONSE_HEADERS_TO_INCLUDE
128
+ RESPONSE_HEADERS_TO_EXCLUDE
129
+ RESPONSE_HEADERS_TO_UNMASK
130
+ ].any? { |key| ENV.key?(key) && !ENV[key].nil? && !ENV[key].empty? }
131
+ end
132
+ end
133
+
134
+ # Initializes a new instance of LoggingConfiguration.
135
+ class LoggingConfiguration < CoreLibrary::ApiLoggingConfiguration
136
+ def initialize(logger: nil, log_level: nil, mask_sensitive_headers: true,
137
+ request_logging_config: nil,
138
+ response_logging_config: nil)
139
+ request_logging_config ||= RequestLoggingConfiguration.new
140
+ response_logging_config ||= ResponseLoggingConfiguration.new
141
+ super(
142
+ logger,
143
+ log_level,
144
+ request_logging_config,
145
+ response_logging_config,
146
+ mask_sensitive_headers
147
+ )
148
+ end
149
+
150
+ def clone_with(logger: nil, log_level: nil, mask_sensitive_headers: nil,
151
+ request_logging_config: nil, response_logging_config: nil)
152
+ logger ||= self.logger
153
+ log_level ||= self.log_level
154
+ mask_sensitive_headers ||= self.mask_sensitive_headers
155
+ request_logging_config ||= self.request_logging_config.clone
156
+ response_logging_config ||= self.response_logging_config.clone
157
+
158
+ LoggingConfiguration.new(
159
+ logger: logger,
160
+ log_level: log_level,
161
+ mask_sensitive_headers: mask_sensitive_headers,
162
+ request_logging_config: request_logging_config,
163
+ response_logging_config: response_logging_config
164
+ )
165
+ end
166
+
167
+ def self.from_env
168
+ log_level = ENV['LOG_LEVEL']
169
+ mask_sensitive_headers = ENV['MASK_SENSITIVE_HEADERS']
170
+
171
+ new(
172
+ log_level: log_level,
173
+ mask_sensitive_headers: mask_sensitive_headers,
174
+ request_logging_config: RequestLoggingConfiguration.from_env,
175
+ response_logging_config: ResponseLoggingConfiguration.from_env
176
+ )
177
+ end
178
+
179
+ def self.any_logging_configured?
180
+ RequestLoggingConfiguration.any_logging_configured? ||
181
+ ResponseLoggingConfiguration.any_logging_configured? ||
182
+ ENV.key?('LOG_LEVEL') ||
183
+ ENV.key?('MASK_SENSITIVE_HEADERS')
184
+ end
185
+ end
186
+ end
@@ -0,0 +1,17 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # Represents the generic logger facade
8
+ class AbstractLogger < Logger
9
+ # Logs a message with a specified log level and additional parameters.
10
+ # @param level [Symbol] The log level of the message.
11
+ # @param message [String] The message to log.
12
+ # @param params [Hash] Additional parameters to include in the log message.
13
+ def log(level, message, params)
14
+ raise NotImplementedError, 'This method needs to be implemented in a child class.'
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,126 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module PoliApIs
8
+ # BankDetails Model.
9
+ class BankDetails < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # The Internet banking receipt number
14
+ # @return [String]
15
+ attr_accessor :bank_receipt
16
+
17
+ # The date and time of the bank receipt
18
+ # @return [DateTime]
19
+ attr_accessor :bank_receipt_date_time
20
+
21
+ # The code of the financial institution
22
+ # @return [String]
23
+ attr_accessor :financial_institution_code
24
+
25
+ # The name of the financial institution
26
+ # @return [String]
27
+ attr_accessor :financial_institution_name
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['bank_receipt'] = 'BankReceipt'
33
+ @_hash['bank_receipt_date_time'] = 'BankReceiptDateTime'
34
+ @_hash['financial_institution_code'] = 'FinancialInstitutionCode'
35
+ @_hash['financial_institution_name'] = 'FinancialInstitutionName'
36
+ @_hash
37
+ end
38
+
39
+ # An array for optional fields
40
+ def self.optionals
41
+ %w[
42
+ bank_receipt
43
+ bank_receipt_date_time
44
+ financial_institution_code
45
+ financial_institution_name
46
+ ]
47
+ end
48
+
49
+ # An array for nullable fields
50
+ def self.nullables
51
+ []
52
+ end
53
+
54
+ def initialize(bank_receipt: SKIP, bank_receipt_date_time: SKIP,
55
+ financial_institution_code: SKIP,
56
+ financial_institution_name: SKIP, additional_properties: nil)
57
+ # Add additional model properties to the instance
58
+ additional_properties = {} if additional_properties.nil?
59
+
60
+ @bank_receipt = bank_receipt unless bank_receipt == SKIP
61
+ @bank_receipt_date_time = bank_receipt_date_time unless bank_receipt_date_time == SKIP
62
+ unless financial_institution_code == SKIP
63
+ @financial_institution_code =
64
+ financial_institution_code
65
+ end
66
+ unless financial_institution_name == SKIP
67
+ @financial_institution_name =
68
+ financial_institution_name
69
+ end
70
+ @additional_properties = additional_properties
71
+ end
72
+
73
+ # Creates an instance of the object from a hash.
74
+ def self.from_hash(hash)
75
+ return nil unless hash
76
+
77
+ # Extract variables from the hash.
78
+ bank_receipt = hash.key?('BankReceipt') ? hash['BankReceipt'] : SKIP
79
+ bank_receipt_date_time = if hash.key?('BankReceiptDateTime')
80
+ (DateTimeHelper.from_rfc3339(hash['BankReceiptDateTime']) if hash['BankReceiptDateTime'])
81
+ else
82
+ SKIP
83
+ end
84
+ financial_institution_code =
85
+ hash.key?('FinancialInstitutionCode') ? hash['FinancialInstitutionCode'] : SKIP
86
+ financial_institution_name =
87
+ hash.key?('FinancialInstitutionName') ? hash['FinancialInstitutionName'] : SKIP
88
+
89
+ # Create a new hash for additional properties, removing known properties.
90
+ new_hash = hash.reject { |k, _| names.value?(k) }
91
+
92
+ additional_properties = APIHelper.get_additional_properties(
93
+ new_hash, proc { |value| value }
94
+ )
95
+
96
+ # Create object from extracted values.
97
+ BankDetails.new(bank_receipt: bank_receipt,
98
+ bank_receipt_date_time: bank_receipt_date_time,
99
+ financial_institution_code: financial_institution_code,
100
+ financial_institution_name: financial_institution_name,
101
+ additional_properties: additional_properties)
102
+ end
103
+
104
+ def to_custom_bank_receipt_date_time
105
+ DateTimeHelper.to_rfc3339(bank_receipt_date_time)
106
+ end
107
+
108
+ # Provides a human-readable string representation of the object.
109
+ def to_s
110
+ class_name = self.class.name.split('::').last
111
+ "<#{class_name} bank_receipt: #{@bank_receipt}, bank_receipt_date_time:"\
112
+ " #{@bank_receipt_date_time}, financial_institution_code: #{@financial_institution_code},"\
113
+ " financial_institution_name: #{@financial_institution_name}, additional_properties:"\
114
+ " #{@additional_properties}>"
115
+ end
116
+
117
+ # Provides a debugging-friendly string with detailed object information.
118
+ def inspect
119
+ class_name = self.class.name.split('::').last
120
+ "<#{class_name} bank_receipt: #{@bank_receipt.inspect}, bank_receipt_date_time:"\
121
+ " #{@bank_receipt_date_time.inspect}, financial_institution_code:"\
122
+ " #{@financial_institution_code.inspect}, financial_institution_name:"\
123
+ " #{@financial_institution_name.inspect}, additional_properties: #{@additional_properties}>"
124
+ end
125
+ end
126
+ end