dna-apimatic-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 (59) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +172 -0
  4. data/bin/console +15 -0
  5. data/lib/dna_payments_partner_reporting_settlement_ap_is/api_helper.rb +10 -0
  6. data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/authentication_api.rb +53 -0
  7. data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/base_api.rb +67 -0
  8. data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/ecommerce_transactions_api.rb +113 -0
  9. data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/merchants_api.rb +79 -0
  10. data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/oauth_authorization_api.rb +44 -0
  11. data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/pos_transactions_api.rb +128 -0
  12. data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/settlements_api.rb +82 -0
  13. data/lib/dna_payments_partner_reporting_settlement_ap_is/client.rb +110 -0
  14. data/lib/dna_payments_partner_reporting_settlement_ap_is/configuration.rb +177 -0
  15. data/lib/dna_payments_partner_reporting_settlement_ap_is/exceptions/api_exception.rb +21 -0
  16. data/lib/dna_payments_partner_reporting_settlement_ap_is/exceptions/error_exception.rb +51 -0
  17. data/lib/dna_payments_partner_reporting_settlement_ap_is/exceptions/oauth_provider_exception.rb +64 -0
  18. data/lib/dna_payments_partner_reporting_settlement_ap_is/http/api_response.rb +19 -0
  19. data/lib/dna_payments_partner_reporting_settlement_ap_is/http/auth/oauth_2.rb +156 -0
  20. data/lib/dna_payments_partner_reporting_settlement_ap_is/http/http_call_back.rb +10 -0
  21. data/lib/dna_payments_partner_reporting_settlement_ap_is/http/http_method_enum.rb +10 -0
  22. data/lib/dna_payments_partner_reporting_settlement_ap_is/http/http_request.rb +10 -0
  23. data/lib/dna_payments_partner_reporting_settlement_ap_is/http/http_response.rb +10 -0
  24. data/lib/dna_payments_partner_reporting_settlement_ap_is/http/proxy_settings.rb +22 -0
  25. data/lib/dna_payments_partner_reporting_settlement_ap_is/logging/configuration/api_logging_configuration.rb +186 -0
  26. data/lib/dna_payments_partner_reporting_settlement_ap_is/logging/sdk_logger.rb +17 -0
  27. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_request.rb +97 -0
  28. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_response.rb +115 -0
  29. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/base_model.rb +110 -0
  30. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/capture_method.rb +72 -0
  31. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/card_type.rb +36 -0
  32. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/ecommerce_transaction.rb +528 -0
  33. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/ecommerce_transactions_response.rb +94 -0
  34. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/grant_type.rb +26 -0
  35. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v1.rb +85 -0
  36. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb +138 -0
  37. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/merchants_v2_response.rb +94 -0
  38. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/oauth_provider_error.rb +62 -0
  39. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/oauth_scope.rb +26 -0
  40. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/oauth_token.rb +96 -0
  41. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/operation.rb +48 -0
  42. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb +298 -0
  43. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transactions_response.rb +105 -0
  44. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/processor.rb +36 -0
  45. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/scope.rb +26 -0
  46. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/search_by.rb +36 -0
  47. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb +314 -0
  48. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/settlements_response.rb +94 -0
  49. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/status.rb +46 -0
  50. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/status1.rb +36 -0
  51. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/status2.rb +36 -0
  52. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/terminal.rb +141 -0
  53. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/token_type.rb +26 -0
  54. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/transaction_type.rb +201 -0
  55. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/type.rb +36 -0
  56. data/lib/dna_payments_partner_reporting_settlement_ap_is/utilities/date_time_helper.rb +11 -0
  57. data/lib/dna_payments_partner_reporting_settlement_ap_is/utilities/file_wrapper.rb +28 -0
  58. data/lib/dna_payments_partner_reporting_settlement_ap_is.rb +125 -0
  59. metadata +142 -0
@@ -0,0 +1,156 @@
1
+ # dna_payments_partner_reporting_settlement_ap_is
2
+ #
3
+ # This file was
4
+ # automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module DnaPaymentsPartnerReportingSettlementApIs
7
+ # Utility class for OAuth 2 authorization and token management.
8
+ class Oauth2 < 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
+ 'ClientCredentialsAuth: OAuthToken is undefined or expired.'
14
+ end
15
+
16
+ # Initialization constructor.
17
+ def initialize(client_credentials_auth_credentials, config)
18
+ @_oauth_client_id = client_credentials_auth_credentials.oauth_client_id unless
19
+ client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.oauth_client_id.nil?
20
+ @_oauth_client_secret = client_credentials_auth_credentials.oauth_client_secret unless
21
+ client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.oauth_client_secret.nil?
22
+ @_oauth_token = client_credentials_auth_credentials.oauth_token unless
23
+ client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.oauth_token.nil?
24
+ @_oauth_scopes = client_credentials_auth_credentials.oauth_scopes unless
25
+ client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.oauth_scopes.nil?
26
+ @_oauth_clock_skew = client_credentials_auth_credentials.oauth_clock_skew unless
27
+ client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.oauth_clock_skew.nil?
28
+ @_oauth_token_provider = client_credentials_auth_credentials.oauth_token_provider unless
29
+ client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.oauth_token_provider.nil?
30
+ @_oauth_on_token_update = client_credentials_auth_credentials.oauth_on_token_update unless
31
+ client_credentials_auth_credentials.nil? || client_credentials_auth_credentials.oauth_on_token_update.nil?
32
+ @_o_auth_api = OauthAuthorizationApi.new(config)
33
+ super({})
34
+ end
35
+
36
+ # Validates the oAuth token.
37
+ # @return [Boolean] true if the token is present and not expired.
38
+ def valid
39
+ @_oauth_token = get_token_from_provider
40
+ @_oauth_token.is_a?(OAuthToken) && !token_expired?(@_oauth_token)
41
+ end
42
+
43
+ # Builds the basic auth header for endpoints in the OAuth Authorization Controller.
44
+ # @return [String] The value of the Authentication header.
45
+ def build_basic_auth_header
46
+ "Basic #{AuthHelper.get_base64_encoded_value(@_oauth_client_id, @_oauth_client_secret)}"
47
+ end
48
+
49
+ # Fetches the token.
50
+ # @param [Hash] additional_params Any additional form parameters.
51
+ # @return [OAuthToken] The oAuth token instance.
52
+ def fetch_token(additional_params: nil)
53
+ token = @_o_auth_api.request_token(
54
+ build_basic_auth_header,
55
+ scope: !@_oauth_scopes.nil? ? Array(@_oauth_scopes).compact.join(' ') : @_oauth_scopes,
56
+ _field_parameters: additional_params
57
+ ).data
58
+ if token.respond_to?('expires_in') && !token.expires_in.nil?
59
+ token.expiry = AuthHelper.get_token_expiry(token.expires_in, Time.now.utc.to_i)
60
+ end
61
+ token
62
+ end
63
+
64
+ # Checks if OAuth token has expired.
65
+ # @param [OAuthToken] token The oAuth token instance.
66
+ # @return [Boolean] true if the token's expiry exist and also the token is expired, false otherwise.
67
+ def token_expired?(token)
68
+ token.respond_to?('expiry') && AuthHelper.token_expired?(token.expiry, @_oauth_clock_skew)
69
+ end
70
+
71
+ def apply(http_request)
72
+ auth_params = { 'Authorization' => "Bearer #{@_oauth_token.access_token}" }
73
+ AuthHelper.apply(auth_params, http_request.method(:add_header))
74
+ end
75
+
76
+ private
77
+
78
+ # This provides the OAuth Token from either the user configured callbacks or from default provider.
79
+ # @return [OAuthToken] The fetched oauth token.
80
+ def get_token_from_provider
81
+ return @_oauth_token if @_oauth_token && !token_expired?(@_oauth_token)
82
+
83
+ if @_o_auth_token_provider
84
+ o_auth_token = @_o_auth_token_provider.call(@_oauth_token, self)
85
+ @_o_auth_on_token_update&.call(o_auth_token)
86
+ return o_auth_token
87
+ end
88
+ begin
89
+ o_auth_token = fetch_token
90
+ @_o_auth_on_token_update&.call(o_auth_token)
91
+ o_auth_token
92
+ rescue ApiException
93
+ @_o_auth_token
94
+ end
95
+ end
96
+ end
97
+
98
+ # Data class for ClientCredentialsAuthCredentials.
99
+ class ClientCredentialsAuthCredentials
100
+ attr_reader :oauth_client_id, :oauth_client_secret, :oauth_token,
101
+ :oauth_scopes, :oauth_token_provider, :oauth_on_token_update,
102
+ :oauth_clock_skew
103
+
104
+ def initialize(oauth_client_id:, oauth_client_secret:, oauth_token: nil,
105
+ oauth_scopes: nil, oauth_token_provider: nil,
106
+ oauth_on_token_update: nil, oauth_clock_skew: 0)
107
+ raise ArgumentError, 'oauth_client_id cannot be nil' if oauth_client_id.nil?
108
+ raise ArgumentError, 'oauth_client_secret cannot be nil' if oauth_client_secret.nil?
109
+
110
+ @oauth_client_id = oauth_client_id
111
+ @oauth_client_secret = oauth_client_secret
112
+ @oauth_token = oauth_token
113
+ @oauth_scopes = oauth_scopes
114
+ @oauth_token_provider = oauth_token_provider
115
+ @oauth_on_token_update = oauth_on_token_update
116
+ @oauth_clock_skew = oauth_clock_skew
117
+ end
118
+
119
+ def self.from_env
120
+ oauth_client_id = ENV['OAUTH_CLIENT_ID']
121
+ oauth_client_secret = ENV['OAUTH_CLIENT_SECRET']
122
+ oauth_scopes = ENV['OAUTH_SCOPES']
123
+ oauth_clock_skew = ENV['OAUTH_CLOCK_SKEW']
124
+ all_nil = [
125
+ oauth_client_id,
126
+ oauth_client_secret
127
+ ].all?(&:nil?)
128
+ return nil if all_nil
129
+
130
+ new(oauth_client_id: oauth_client_id,
131
+ oauth_client_secret: oauth_client_secret, oauth_scopes: oauth_scopes,
132
+ oauth_clock_skew: oauth_clock_skew)
133
+ end
134
+
135
+ def clone_with(oauth_client_id: nil, oauth_client_secret: nil,
136
+ oauth_token: nil, oauth_scopes: nil,
137
+ oauth_token_provider: nil, oauth_on_token_update: nil,
138
+ oauth_clock_skew: nil)
139
+ oauth_client_id ||= self.oauth_client_id
140
+ oauth_client_secret ||= self.oauth_client_secret
141
+ oauth_token ||= self.oauth_token
142
+ oauth_scopes ||= self.oauth_scopes
143
+ oauth_token_provider ||= self.oauth_token_provider
144
+ oauth_on_token_update ||= self.oauth_on_token_update
145
+ oauth_clock_skew ||= self.oauth_clock_skew
146
+
147
+ ClientCredentialsAuthCredentials.new(
148
+ oauth_client_id: oauth_client_id,
149
+ oauth_client_secret: oauth_client_secret, oauth_token: oauth_token,
150
+ oauth_scopes: oauth_scopes, oauth_token_provider: oauth_token_provider,
151
+ oauth_on_token_update: oauth_on_token_update,
152
+ oauth_clock_skew: oauth_clock_skew
153
+ )
154
+ end
155
+ end
156
+ end
@@ -0,0 +1,10 @@
1
+ # dna_payments_partner_reporting_settlement_ap_is
2
+ #
3
+ # This file was
4
+ # automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module DnaPaymentsPartnerReportingSettlementApIs
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
+ # dna_payments_partner_reporting_settlement_ap_is
2
+ #
3
+ # This file was
4
+ # automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module DnaPaymentsPartnerReportingSettlementApIs
7
+ # HTTP Methods Enumeration.
8
+ class HttpMethodEnum < CoreLibrary::HttpMethod
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # dna_payments_partner_reporting_settlement_ap_is
2
+ #
3
+ # This file was
4
+ # automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module DnaPaymentsPartnerReportingSettlementApIs
7
+ # Represents a single Http Request.
8
+ class HttpRequest < CoreLibrary::HttpRequest
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # dna_payments_partner_reporting_settlement_ap_is
2
+ #
3
+ # This file was
4
+ # automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module DnaPaymentsPartnerReportingSettlementApIs
7
+ # Http response received.
8
+ class HttpResponse < CoreLibrary::HttpResponse
9
+ end
10
+ end
@@ -0,0 +1,22 @@
1
+ # dna_payments_partner_reporting_settlement_ap_is
2
+ #
3
+ # This file was
4
+ # automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module DnaPaymentsPartnerReportingSettlementApIs
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
+ # dna_payments_partner_reporting_settlement_ap_is
2
+ #
3
+ # This file was
4
+ # automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module DnaPaymentsPartnerReportingSettlementApIs
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
+ # dna_payments_partner_reporting_settlement_ap_is
2
+ #
3
+ # This file was
4
+ # automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module DnaPaymentsPartnerReportingSettlementApIs
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,97 @@
1
+ # dna_payments_partner_reporting_settlement_ap_is
2
+ #
3
+ # This file was
4
+ # automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module DnaPaymentsPartnerReportingSettlementApIs
7
+ # AuthTokenRequest Model.
8
+ class AuthTokenRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Authorisation type required to confirm the action required.
13
+ # @return [String]
14
+ attr_reader :grant_type
15
+
16
+ # Scope of the action to be performed with the credentials.
17
+ # @return [String]
18
+ attr_reader :scope
19
+
20
+ # Provided to the integrator following successful creation of a test
21
+ # account.
22
+ # @return [String]
23
+ attr_accessor :client_id
24
+
25
+ # Provided to the integrator following successful creation of a test
26
+ # account.
27
+ # @return [String]
28
+ attr_accessor :client_secret
29
+
30
+ # A mapping from model property names to API property names.
31
+ def self.names
32
+ @_hash = {} if @_hash.nil?
33
+ @_hash['grant_type'] = 'grant_type'
34
+ @_hash['scope'] = 'scope'
35
+ @_hash['client_id'] = 'client_id'
36
+ @_hash['client_secret'] = 'client_secret'
37
+ @_hash
38
+ end
39
+
40
+ # An array for optional fields
41
+ def self.optionals
42
+ []
43
+ end
44
+
45
+ # An array for nullable fields
46
+ def self.nullables
47
+ []
48
+ end
49
+
50
+ def initialize(client_id:, client_secret:, additional_properties: nil)
51
+ # Add additional model properties to the instance
52
+ additional_properties = {} if additional_properties.nil?
53
+
54
+ @grant_type = 'client_credentials'
55
+ @scope = 'partners_reporting'
56
+ @client_id = client_id
57
+ @client_secret = client_secret
58
+ @additional_properties = additional_properties
59
+ end
60
+
61
+ # Creates an instance of the object from a hash.
62
+ def self.from_hash(hash)
63
+ return nil unless hash
64
+
65
+ # Extract variables from the hash.
66
+ client_id = hash.key?('client_id') ? hash['client_id'] : nil
67
+ client_secret = hash.key?('client_secret') ? hash['client_secret'] : nil
68
+
69
+ # Create a new hash for additional properties, removing known properties.
70
+ new_hash = hash.reject { |k, _| names.value?(k) }
71
+
72
+ additional_properties = APIHelper.get_additional_properties(
73
+ new_hash, proc { |value| value }
74
+ )
75
+
76
+ # Create object from extracted values.
77
+ AuthTokenRequest.new(client_id: client_id,
78
+ client_secret: client_secret,
79
+ additional_properties: additional_properties)
80
+ end
81
+
82
+ # Provides a human-readable string representation of the object.
83
+ def to_s
84
+ class_name = self.class.name.split('::').last
85
+ "<#{class_name} grant_type: #{@grant_type}, scope: #{@scope}, client_id: #{@client_id},"\
86
+ " client_secret: #{@client_secret}, additional_properties: #{@additional_properties}>"
87
+ end
88
+
89
+ # Provides a debugging-friendly string with detailed object information.
90
+ def inspect
91
+ class_name = self.class.name.split('::').last
92
+ "<#{class_name} grant_type: #{@grant_type.inspect}, scope: #{@scope.inspect}, client_id:"\
93
+ " #{@client_id.inspect}, client_secret: #{@client_secret.inspect}, additional_properties:"\
94
+ " #{@additional_properties}>"
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,115 @@
1
+ # dna_payments_partner_reporting_settlement_ap_is
2
+ #
3
+ # This file was
4
+ # automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
5
+
6
+ module DnaPaymentsPartnerReportingSettlementApIs
7
+ # AuthTokenResponse Model.
8
+ class AuthTokenResponse < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Access token to be used in subsequent API calls.
13
+ # @return [String]
14
+ attr_accessor :access_token
15
+
16
+ # Number of seconds until the access_token expires.
17
+ # @return [Integer]
18
+ attr_accessor :expires_in
19
+
20
+ # Reserved for future use.
21
+ # @return [String]
22
+ attr_accessor :refresh_token
23
+
24
+ # Reserved for future use.
25
+ # @return [String]
26
+ attr_accessor :scope
27
+
28
+ # Reserved for future use.
29
+ # @return [TokenType]
30
+ attr_accessor :token_type
31
+
32
+ # A mapping from model property names to API property names.
33
+ def self.names
34
+ @_hash = {} if @_hash.nil?
35
+ @_hash['access_token'] = 'access_token'
36
+ @_hash['expires_in'] = 'expires_in'
37
+ @_hash['refresh_token'] = 'refresh_token'
38
+ @_hash['scope'] = 'scope'
39
+ @_hash['token_type'] = 'token_type'
40
+ @_hash
41
+ end
42
+
43
+ # An array for optional fields
44
+ def self.optionals
45
+ %w[
46
+ access_token
47
+ expires_in
48
+ refresh_token
49
+ scope
50
+ token_type
51
+ ]
52
+ end
53
+
54
+ # An array for nullable fields
55
+ def self.nullables
56
+ []
57
+ end
58
+
59
+ def initialize(access_token: SKIP, expires_in: SKIP, refresh_token: SKIP,
60
+ scope: SKIP, token_type: SKIP, additional_properties: nil)
61
+ # Add additional model properties to the instance
62
+ additional_properties = {} if additional_properties.nil?
63
+
64
+ @access_token = access_token unless access_token == SKIP
65
+ @expires_in = expires_in unless expires_in == SKIP
66
+ @refresh_token = refresh_token unless refresh_token == SKIP
67
+ @scope = scope unless scope == SKIP
68
+ @token_type = token_type unless token_type == SKIP
69
+ @additional_properties = additional_properties
70
+ end
71
+
72
+ # Creates an instance of the object from a hash.
73
+ def self.from_hash(hash)
74
+ return nil unless hash
75
+
76
+ # Extract variables from the hash.
77
+ access_token = hash.key?('access_token') ? hash['access_token'] : SKIP
78
+ expires_in = hash.key?('expires_in') ? hash['expires_in'] : SKIP
79
+ refresh_token = hash.key?('refresh_token') ? hash['refresh_token'] : SKIP
80
+ scope = hash.key?('scope') ? hash['scope'] : SKIP
81
+ token_type = hash.key?('token_type') ? hash['token_type'] : SKIP
82
+
83
+ # Create a new hash for additional properties, removing known properties.
84
+ new_hash = hash.reject { |k, _| names.value?(k) }
85
+
86
+ additional_properties = APIHelper.get_additional_properties(
87
+ new_hash, proc { |value| value }
88
+ )
89
+
90
+ # Create object from extracted values.
91
+ AuthTokenResponse.new(access_token: access_token,
92
+ expires_in: expires_in,
93
+ refresh_token: refresh_token,
94
+ scope: scope,
95
+ token_type: token_type,
96
+ additional_properties: additional_properties)
97
+ end
98
+
99
+ # Provides a human-readable string representation of the object.
100
+ def to_s
101
+ class_name = self.class.name.split('::').last
102
+ "<#{class_name} access_token: #{@access_token}, expires_in: #{@expires_in}, refresh_token:"\
103
+ " #{@refresh_token}, scope: #{@scope}, token_type: #{@token_type}, additional_properties:"\
104
+ " #{@additional_properties}>"
105
+ end
106
+
107
+ # Provides a debugging-friendly string with detailed object information.
108
+ def inspect
109
+ class_name = self.class.name.split('::').last
110
+ "<#{class_name} access_token: #{@access_token.inspect}, expires_in: #{@expires_in.inspect},"\
111
+ " refresh_token: #{@refresh_token.inspect}, scope: #{@scope.inspect}, token_type:"\
112
+ " #{@token_type.inspect}, additional_properties: #{@additional_properties}>"
113
+ end
114
+ end
115
+ end