apimatic-gp-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 (97) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +155 -0
  4. data/bin/console +15 -0
  5. data/lib/batches/api_helper.rb +10 -0
  6. data/lib/batches/apis/base_api.rb +67 -0
  7. data/lib/batches/apis/close_a_batch_api.rb +111 -0
  8. data/lib/batches/apis/get_a_batch_api.rb +70 -0
  9. data/lib/batches/apis/get_transactions_within_a_batch_api.rb +69 -0
  10. data/lib/batches/client.rb +72 -0
  11. data/lib/batches/configuration.rb +166 -0
  12. data/lib/batches/exceptions/api_exception.rb +21 -0
  13. data/lib/batches/exceptions/batches400_error_exception.rb +61 -0
  14. data/lib/batches/exceptions/batches401_error_exception.rb +61 -0
  15. data/lib/batches/exceptions/batches403_error_exception.rb +61 -0
  16. data/lib/batches/exceptions/batches500_error_exception.rb +61 -0
  17. data/lib/batches/exceptions/batches501_error_exception.rb +61 -0
  18. data/lib/batches/exceptions/batches502_error_exception.rb +62 -0
  19. data/lib/batches/exceptions/batches504_error_exception.rb +61 -0
  20. data/lib/batches/exceptions/batches_transactions400_error_exception.rb +61 -0
  21. data/lib/batches/exceptions/batches_transactions401_error_exception.rb +61 -0
  22. data/lib/batches/exceptions/batches_transactions403_error_exception.rb +61 -0
  23. data/lib/batches/exceptions/batches_transactions500_error_exception.rb +61 -0
  24. data/lib/batches/exceptions/batches_transactions501_error_exception.rb +61 -0
  25. data/lib/batches/exceptions/batches_transactions502_error_exception.rb +62 -0
  26. data/lib/batches/exceptions/batches_transactions504_error_exception.rb +61 -0
  27. data/lib/batches/http/api_response.rb +19 -0
  28. data/lib/batches/http/http_call_back.rb +10 -0
  29. data/lib/batches/http/http_method_enum.rb +10 -0
  30. data/lib/batches/http/http_request.rb +10 -0
  31. data/lib/batches/http/http_response.rb +10 -0
  32. data/lib/batches/http/proxy_settings.rb +22 -0
  33. data/lib/batches/logging/configuration/api_logging_configuration.rb +186 -0
  34. data/lib/batches/logging/sdk_logger.rb +17 -0
  35. data/lib/batches/models/action.rb +125 -0
  36. data/lib/batches/models/authentication_invalid401.rb +102 -0
  37. data/lib/batches/models/avs_address_result_batches_transactions_payment_method_card_avs_address_result.rb +40 -0
  38. data/lib/batches/models/avs_postal_code_result_batches_transactions_payment_method_card_avs_postal_code_result.rb +40 -0
  39. data/lib/batches/models/base_model.rb +110 -0
  40. data/lib/batches/models/batches_request.rb +142 -0
  41. data/lib/batches/models/brand_batches_brand_breakdown_brand.rb +56 -0
  42. data/lib/batches/models/brand_batches_transactions_payment_method_card_brand.rb +56 -0
  43. data/lib/batches/models/brand_breakdown_item.rb +159 -0
  44. data/lib/batches/models/card.rb +170 -0
  45. data/lib/batches/models/channel_batches_channel.rb +44 -0
  46. data/lib/batches/models/close_response.rb +356 -0
  47. data/lib/batches/models/currency_batches_transactions_currency.rb +60 -0
  48. data/lib/batches/models/cvv_result_batches_transactions_payment_method_card_cvv_result.rb +40 -0
  49. data/lib/batches/models/detailed_error_code.rb +26 -0
  50. data/lib/batches/models/detailed_error_code1.rb +36 -0
  51. data/lib/batches/models/detailed_error_code2.rb +36 -0
  52. data/lib/batches/models/detailed_error_code3.rb +26 -0
  53. data/lib/batches/models/detailed_error_code4.rb +26 -0
  54. data/lib/batches/models/detailed_error_code5.rb +26 -0
  55. data/lib/batches/models/detailed_error_code6.rb +26 -0
  56. data/lib/batches/models/entry_mode_batches_transactions_payment_method_entry_mode.rb +104 -0
  57. data/lib/batches/models/error_code.rb +52 -0
  58. data/lib/batches/models/error_code1.rb +26 -0
  59. data/lib/batches/models/error_code2.rb +26 -0
  60. data/lib/batches/models/error_code3.rb +26 -0
  61. data/lib/batches/models/error_code4.rb +26 -0
  62. data/lib/batches/models/error_code5.rb +27 -0
  63. data/lib/batches/models/error_code6.rb +26 -0
  64. data/lib/batches/models/filter.rb +76 -0
  65. data/lib/batches/models/funding_batches_transactions_payment_method_card_funding.rb +59 -0
  66. data/lib/batches/models/funding_credit.rb +85 -0
  67. data/lib/batches/models/funding_credit1.rb +85 -0
  68. data/lib/batches/models/funding_credit5.rb +85 -0
  69. data/lib/batches/models/funding_debit.rb +85 -0
  70. data/lib/batches/models/funding_debit1.rb +85 -0
  71. data/lib/batches/models/funding_debit5.rb +85 -0
  72. data/lib/batches/models/get_response.rb +331 -0
  73. data/lib/batches/models/host_breakdown_item.rb +128 -0
  74. data/lib/batches/models/not_authorized403.rb +102 -0
  75. data/lib/batches/models/obj_request_invalid400.rb +102 -0
  76. data/lib/batches/models/payment_method.rb +167 -0
  77. data/lib/batches/models/payment_method2.rb +52 -0
  78. data/lib/batches/models/payment_methods_batches_payment_method.rb +52 -0
  79. data/lib/batches/models/refunds.rb +85 -0
  80. data/lib/batches/models/refunds1.rb +85 -0
  81. data/lib/batches/models/result_code_batches_action_result_code.rb +26 -0
  82. data/lib/batches/models/sales.rb +85 -0
  83. data/lib/batches/models/sales1.rb +85 -0
  84. data/lib/batches/models/server_error500.rb +102 -0
  85. data/lib/batches/models/server_timeout504.rb +102 -0
  86. data/lib/batches/models/status_batches_status.rb +38 -0
  87. data/lib/batches/models/status_batches_transactions_status.rb +39 -0
  88. data/lib/batches/models/transaction.rb +205 -0
  89. data/lib/batches/models/transaction_batch_response.rb +198 -0
  90. data/lib/batches/models/type_batches_action_type.rb +40 -0
  91. data/lib/batches/models/type_batches_transactions_type.rb +40 -0
  92. data/lib/batches/models/unknown_platform_error502.rb +103 -0
  93. data/lib/batches/models/unknown_server_error501.rb +102 -0
  94. data/lib/batches/utilities/date_time_helper.rb +11 -0
  95. data/lib/batches/utilities/file_wrapper.rb +28 -0
  96. data/lib/batches.rb +128 -0
  97. metadata +180 -0
@@ -0,0 +1,166 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # An enum for SDK environments.
8
+ class Environment
9
+ # PRODUCTION: Sandbox Environment
10
+ # ENVIRONMENT2: Production 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
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
+ )
63
+ super connection: connection, adapter: adapter, timeout: timeout,
64
+ max_retries: max_retries, retry_interval: retry_interval,
65
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
66
+ retry_methods: retry_methods, http_callback: http_callback,
67
+ proxy_settings: proxy_settings,
68
+ logging_configuration: logging_configuration
69
+
70
+ # Current API environment
71
+ @environment = String(environment)
72
+
73
+ # The Http Client to use for making requests.
74
+ set_http_client CoreLibrary::FaradayClient.new(self)
75
+ end
76
+
77
+ def clone_with(connection: nil, adapter: nil, timeout: nil,
78
+ max_retries: nil, retry_interval: nil, backoff_factor: nil,
79
+ retry_statuses: nil, retry_methods: nil, http_callback: nil,
80
+ proxy_settings: nil, logging_configuration: nil,
81
+ environment: nil)
82
+ connection ||= self.connection
83
+ adapter ||= self.adapter
84
+ timeout ||= self.timeout
85
+ max_retries ||= self.max_retries
86
+ retry_interval ||= self.retry_interval
87
+ backoff_factor ||= self.backoff_factor
88
+ retry_statuses ||= self.retry_statuses
89
+ retry_methods ||= self.retry_methods
90
+ http_callback ||= self.http_callback
91
+ proxy_settings ||= self.proxy_settings
92
+ logging_configuration ||= self.logging_configuration
93
+ environment ||= self.environment
94
+
95
+ Configuration.new(connection: connection, adapter: adapter,
96
+ timeout: timeout, max_retries: max_retries,
97
+ retry_interval: retry_interval,
98
+ backoff_factor: backoff_factor,
99
+ retry_statuses: retry_statuses,
100
+ retry_methods: retry_methods,
101
+ http_callback: http_callback,
102
+ proxy_settings: proxy_settings,
103
+ logging_configuration: logging_configuration,
104
+ environment: environment)
105
+ end
106
+
107
+
108
+ # All the environments the SDK can run in.
109
+ ENVIRONMENTS = {
110
+ Environment::PRODUCTION => {
111
+ Server::DEFAULT => 'https://apis.sandbox.globalpay.com/ucp'
112
+ },
113
+ Environment::ENVIRONMENT2 => {
114
+ Server::DEFAULT => 'https://apis.globalpay.com/ucp'
115
+ }
116
+ }.freeze
117
+
118
+ # Generates the appropriate base URI for the environment and the server.
119
+ # @param [Configuration::Server] server The server enum for which the base URI is
120
+ # required.
121
+ # @return [String] The base URI.
122
+ def get_base_uri(server = Server::DEFAULT)
123
+ ENVIRONMENTS[environment][server].clone
124
+ end
125
+
126
+ # Builds a Configuration instance using environment variables.
127
+ def self.build_default_config_from_env
128
+ # === Core environment ===
129
+ environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'production'))
130
+ timeout = (ENV['TIMEOUT'] || 30).to_f
131
+ max_retries = (ENV['MAX_RETRIES'] || 0).to_i
132
+ retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f
133
+ backoff_factor = (ENV['BACKOFF_FACTOR'] || 2).to_f
134
+ retry_statuses = ENV.fetch('RETRY_STATUSES',
135
+ '[408, 413, 429, 500, 502, 503, 504, 521, 522, 524]').gsub(/[\[\]]/, '')
136
+ .split(',')
137
+ .map(&:strip)
138
+ .map do |item|
139
+ item.match?(/\A\d+\z/) ? item.to_i : item.downcase
140
+ end
141
+ retry_methods = ENV.fetch('RETRY_METHODS', '%i[get put]').gsub(/[\[\]]/, '')
142
+ .split(',')
143
+ .map(&:strip)
144
+ .map do |item|
145
+ item.match?(/\A\d+\z/) ? item.to_i : item.downcase
146
+ end
147
+
148
+ # === Proxy settings ===
149
+ proxy_settings = ProxySettings.from_env
150
+ # === Logging Configuration ===
151
+ logging_configuration = LoggingConfiguration.from_env if LoggingConfiguration.any_logging_configured?
152
+
153
+ Configuration.new(
154
+ environment: environment,
155
+ timeout: timeout,
156
+ max_retries: max_retries,
157
+ retry_interval: retry_interval,
158
+ backoff_factor: backoff_factor,
159
+ retry_statuses: retry_statuses,
160
+ retry_methods: retry_methods,
161
+ proxy_settings: proxy_settings,
162
+ logging_configuration: logging_configuration
163
+ )
164
+ end
165
+ end
166
+ end
@@ -0,0 +1,21 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
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,61 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # Bad Request
8
+ class Batches400ErrorException < APIException
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # This indicates an issue with the API request.
13
+ # @return [ErrorCode]
14
+ attr_accessor :error_code
15
+
16
+ # Unique reference to identify the error.
17
+ # @return [DetailedErrorCode]
18
+ attr_accessor :detailed_error_code
19
+
20
+ # Unique Text describing the specific error.
21
+ # @return [String]
22
+ attr_accessor :detailed_error_description
23
+
24
+ # The constructor.
25
+ # @param [String] reason The reason for raising an exception.
26
+ # @param [HttpResponse] response The HttpReponse of the API call.
27
+ def initialize(reason, response)
28
+ super(reason, response)
29
+ hash = APIHelper.json_deserialize(@response.raw_body)
30
+ unbox(hash)
31
+ end
32
+
33
+ # Populates this object by extracting properties from a hash.
34
+ # @param [Hash] hash The deserialized response sent by the server in the
35
+ # response body.
36
+ def unbox(hash)
37
+ return nil unless hash
38
+
39
+ @error_code = hash.key?('error_code') ? hash['error_code'] : SKIP
40
+ @detailed_error_code =
41
+ hash.key?('detailed_error_code') ? hash['detailed_error_code'] : SKIP
42
+ @detailed_error_description =
43
+ hash.key?('detailed_error_description') ? hash['detailed_error_description'] : SKIP
44
+ end
45
+
46
+ # Provides a human-readable string representation of the object.
47
+ def to_s
48
+ class_name = self.class.name.split('::').last
49
+ "<#{class_name} error_code: #{@error_code}, detailed_error_code: #{@detailed_error_code},"\
50
+ " detailed_error_description: #{@detailed_error_description}>"
51
+ end
52
+
53
+ # Provides a debugging-friendly string with detailed object information.
54
+ def inspect
55
+ class_name = self.class.name.split('::').last
56
+ "<#{class_name} error_code: #{@error_code.inspect}, detailed_error_code:"\
57
+ " #{@detailed_error_code.inspect}, detailed_error_description:"\
58
+ " #{@detailed_error_description.inspect}>"
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,61 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # Not Authenticated
8
+ class Batches401ErrorException < APIException
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # This action failed as token in the request is not valid.
13
+ # @return [ErrorCode1]
14
+ attr_accessor :error_code
15
+
16
+ # Unique reference to identify the error.
17
+ # @return [DetailedErrorCode1]
18
+ attr_accessor :detailed_error_code
19
+
20
+ # Unique Text describing the specific error.
21
+ # @return [String]
22
+ attr_accessor :detailed_error_description
23
+
24
+ # The constructor.
25
+ # @param [String] reason The reason for raising an exception.
26
+ # @param [HttpResponse] response The HttpReponse of the API call.
27
+ def initialize(reason, response)
28
+ super(reason, response)
29
+ hash = APIHelper.json_deserialize(@response.raw_body)
30
+ unbox(hash)
31
+ end
32
+
33
+ # Populates this object by extracting properties from a hash.
34
+ # @param [Hash] hash The deserialized response sent by the server in the
35
+ # response body.
36
+ def unbox(hash)
37
+ return nil unless hash
38
+
39
+ @error_code = hash.key?('error_code') ? hash['error_code'] : SKIP
40
+ @detailed_error_code =
41
+ hash.key?('detailed_error_code') ? hash['detailed_error_code'] : SKIP
42
+ @detailed_error_description =
43
+ hash.key?('detailed_error_description') ? hash['detailed_error_description'] : SKIP
44
+ end
45
+
46
+ # Provides a human-readable string representation of the object.
47
+ def to_s
48
+ class_name = self.class.name.split('::').last
49
+ "<#{class_name} error_code: #{@error_code}, detailed_error_code: #{@detailed_error_code},"\
50
+ " detailed_error_description: #{@detailed_error_description}>"
51
+ end
52
+
53
+ # Provides a debugging-friendly string with detailed object information.
54
+ def inspect
55
+ class_name = self.class.name.split('::').last
56
+ "<#{class_name} error_code: #{@error_code.inspect}, detailed_error_code:"\
57
+ " #{@detailed_error_code.inspect}, detailed_error_description:"\
58
+ " #{@detailed_error_description.inspect}>"
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,61 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # Forbidden
8
+ class Batches403ErrorException < APIException
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # This action is not authorized with the credentials being used.
13
+ # @return [ErrorCode2]
14
+ attr_accessor :error_code
15
+
16
+ # Unique reference to identify the error.
17
+ # @return [DetailedErrorCode2]
18
+ attr_accessor :detailed_error_code
19
+
20
+ # Unique Text describing the specific error.
21
+ # @return [String]
22
+ attr_accessor :detailed_error_description
23
+
24
+ # The constructor.
25
+ # @param [String] reason The reason for raising an exception.
26
+ # @param [HttpResponse] response The HttpReponse of the API call.
27
+ def initialize(reason, response)
28
+ super(reason, response)
29
+ hash = APIHelper.json_deserialize(@response.raw_body)
30
+ unbox(hash)
31
+ end
32
+
33
+ # Populates this object by extracting properties from a hash.
34
+ # @param [Hash] hash The deserialized response sent by the server in the
35
+ # response body.
36
+ def unbox(hash)
37
+ return nil unless hash
38
+
39
+ @error_code = hash.key?('error_code') ? hash['error_code'] : SKIP
40
+ @detailed_error_code =
41
+ hash.key?('detailed_error_code') ? hash['detailed_error_code'] : SKIP
42
+ @detailed_error_description =
43
+ hash.key?('detailed_error_description') ? hash['detailed_error_description'] : SKIP
44
+ end
45
+
46
+ # Provides a human-readable string representation of the object.
47
+ def to_s
48
+ class_name = self.class.name.split('::').last
49
+ "<#{class_name} error_code: #{@error_code}, detailed_error_code: #{@detailed_error_code},"\
50
+ " detailed_error_description: #{@detailed_error_description}>"
51
+ end
52
+
53
+ # Provides a debugging-friendly string with detailed object information.
54
+ def inspect
55
+ class_name = self.class.name.split('::').last
56
+ "<#{class_name} error_code: #{@error_code.inspect}, detailed_error_code:"\
57
+ " #{@detailed_error_code.inspect}, detailed_error_description:"\
58
+ " #{@detailed_error_description.inspect}>"
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,61 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # Internal Server Error
8
+ class Batches500ErrorException < APIException
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # This indicates an unexpected issue occurred on the Global Payments system.
13
+ # @return [ErrorCode3]
14
+ attr_accessor :error_code
15
+
16
+ # Unique reference to identify the error.
17
+ # @return [DetailedErrorCode3]
18
+ attr_accessor :detailed_error_code
19
+
20
+ # Unique Text describing the specific error.
21
+ # @return [String]
22
+ attr_accessor :detailed_error_description
23
+
24
+ # The constructor.
25
+ # @param [String] reason The reason for raising an exception.
26
+ # @param [HttpResponse] response The HttpReponse of the API call.
27
+ def initialize(reason, response)
28
+ super(reason, response)
29
+ hash = APIHelper.json_deserialize(@response.raw_body)
30
+ unbox(hash)
31
+ end
32
+
33
+ # Populates this object by extracting properties from a hash.
34
+ # @param [Hash] hash The deserialized response sent by the server in the
35
+ # response body.
36
+ def unbox(hash)
37
+ return nil unless hash
38
+
39
+ @error_code = hash.key?('error_code') ? hash['error_code'] : SKIP
40
+ @detailed_error_code =
41
+ hash.key?('detailed_error_code') ? hash['detailed_error_code'] : SKIP
42
+ @detailed_error_description =
43
+ hash.key?('detailed_error_description') ? hash['detailed_error_description'] : SKIP
44
+ end
45
+
46
+ # Provides a human-readable string representation of the object.
47
+ def to_s
48
+ class_name = self.class.name.split('::').last
49
+ "<#{class_name} error_code: #{@error_code}, detailed_error_code: #{@detailed_error_code},"\
50
+ " detailed_error_description: #{@detailed_error_description}>"
51
+ end
52
+
53
+ # Provides a debugging-friendly string with detailed object information.
54
+ def inspect
55
+ class_name = self.class.name.split('::').last
56
+ "<#{class_name} error_code: #{@error_code.inspect}, detailed_error_code:"\
57
+ " #{@detailed_error_code.inspect}, detailed_error_description:"\
58
+ " #{@detailed_error_description.inspect}>"
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,61 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # Not implemented
8
+ class Batches501ErrorException < APIException
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # This is an error not yet handled or mapped properly.
13
+ # @return [ErrorCode4]
14
+ attr_accessor :error_code
15
+
16
+ # Unique reference to identify the error.
17
+ # @return [DetailedErrorCode4]
18
+ attr_accessor :detailed_error_code
19
+
20
+ # Unique Text describing the specific error not yet handled.
21
+ # @return [String]
22
+ attr_accessor :detailed_error_description
23
+
24
+ # The constructor.
25
+ # @param [String] reason The reason for raising an exception.
26
+ # @param [HttpResponse] response The HttpReponse of the API call.
27
+ def initialize(reason, response)
28
+ super(reason, response)
29
+ hash = APIHelper.json_deserialize(@response.raw_body)
30
+ unbox(hash)
31
+ end
32
+
33
+ # Populates this object by extracting properties from a hash.
34
+ # @param [Hash] hash The deserialized response sent by the server in the
35
+ # response body.
36
+ def unbox(hash)
37
+ return nil unless hash
38
+
39
+ @error_code = hash.key?('error_code') ? hash['error_code'] : SKIP
40
+ @detailed_error_code =
41
+ hash.key?('detailed_error_code') ? hash['detailed_error_code'] : SKIP
42
+ @detailed_error_description =
43
+ hash.key?('detailed_error_description') ? hash['detailed_error_description'] : SKIP
44
+ end
45
+
46
+ # Provides a human-readable string representation of the object.
47
+ def to_s
48
+ class_name = self.class.name.split('::').last
49
+ "<#{class_name} error_code: #{@error_code}, detailed_error_code: #{@detailed_error_code},"\
50
+ " detailed_error_description: #{@detailed_error_description}>"
51
+ end
52
+
53
+ # Provides a debugging-friendly string with detailed object information.
54
+ def inspect
55
+ class_name = self.class.name.split('::').last
56
+ "<#{class_name} error_code: #{@error_code.inspect}, detailed_error_code:"\
57
+ " #{@detailed_error_code.inspect}, detailed_error_description:"\
58
+ " #{@detailed_error_description.inspect}>"
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,62 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # Bad Gateway
8
+ class Batches502ErrorException < APIException
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # This is an error indicating there was an issue connecting to a partner
13
+ # system..
14
+ # @return [ErrorCode5]
15
+ attr_accessor :error_code
16
+
17
+ # Unique reference to identify the error.
18
+ # @return [DetailedErrorCode5]
19
+ attr_accessor :detailed_error_code
20
+
21
+ # Authentication error—Verify and correct credentials.
22
+ # @return [String]
23
+ attr_accessor :detailed_error_description
24
+
25
+ # The constructor.
26
+ # @param [String] reason The reason for raising an exception.
27
+ # @param [HttpResponse] response The HttpReponse of the API call.
28
+ def initialize(reason, response)
29
+ super(reason, response)
30
+ hash = APIHelper.json_deserialize(@response.raw_body)
31
+ unbox(hash)
32
+ end
33
+
34
+ # Populates this object by extracting properties from a hash.
35
+ # @param [Hash] hash The deserialized response sent by the server in the
36
+ # response body.
37
+ def unbox(hash)
38
+ return nil unless hash
39
+
40
+ @error_code = hash.key?('error_code') ? hash['error_code'] : SKIP
41
+ @detailed_error_code =
42
+ hash.key?('detailed_error_code') ? hash['detailed_error_code'] : SKIP
43
+ @detailed_error_description =
44
+ hash.key?('detailed_error_description') ? hash['detailed_error_description'] : SKIP
45
+ end
46
+
47
+ # Provides a human-readable string representation of the object.
48
+ def to_s
49
+ class_name = self.class.name.split('::').last
50
+ "<#{class_name} error_code: #{@error_code}, detailed_error_code: #{@detailed_error_code},"\
51
+ " detailed_error_description: #{@detailed_error_description}>"
52
+ end
53
+
54
+ # Provides a debugging-friendly string with detailed object information.
55
+ def inspect
56
+ class_name = self.class.name.split('::').last
57
+ "<#{class_name} error_code: #{@error_code.inspect}, detailed_error_code:"\
58
+ " #{@detailed_error_code.inspect}, detailed_error_description:"\
59
+ " #{@detailed_error_description.inspect}>"
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,61 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # Timeout
8
+ class Batches504ErrorException < APIException
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # This is an error indicating there was a timeout issue to another system.
13
+ # @return [ErrorCode6]
14
+ attr_accessor :error_code
15
+
16
+ # Unique reference to identify the error.
17
+ # @return [DetailedErrorCode6]
18
+ attr_accessor :detailed_error_code
19
+
20
+ # No response from payment method provider.
21
+ # @return [String]
22
+ attr_accessor :detailed_error_description
23
+
24
+ # The constructor.
25
+ # @param [String] reason The reason for raising an exception.
26
+ # @param [HttpResponse] response The HttpReponse of the API call.
27
+ def initialize(reason, response)
28
+ super(reason, response)
29
+ hash = APIHelper.json_deserialize(@response.raw_body)
30
+ unbox(hash)
31
+ end
32
+
33
+ # Populates this object by extracting properties from a hash.
34
+ # @param [Hash] hash The deserialized response sent by the server in the
35
+ # response body.
36
+ def unbox(hash)
37
+ return nil unless hash
38
+
39
+ @error_code = hash.key?('error_code') ? hash['error_code'] : SKIP
40
+ @detailed_error_code =
41
+ hash.key?('detailed_error_code') ? hash['detailed_error_code'] : SKIP
42
+ @detailed_error_description =
43
+ hash.key?('detailed_error_description') ? hash['detailed_error_description'] : SKIP
44
+ end
45
+
46
+ # Provides a human-readable string representation of the object.
47
+ def to_s
48
+ class_name = self.class.name.split('::').last
49
+ "<#{class_name} error_code: #{@error_code}, detailed_error_code: #{@detailed_error_code},"\
50
+ " detailed_error_description: #{@detailed_error_description}>"
51
+ end
52
+
53
+ # Provides a debugging-friendly string with detailed object information.
54
+ def inspect
55
+ class_name = self.class.name.split('::').last
56
+ "<#{class_name} error_code: #{@error_code.inspect}, detailed_error_code:"\
57
+ " #{@detailed_error_code.inspect}, detailed_error_description:"\
58
+ " #{@detailed_error_description.inspect}>"
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,61 @@
1
+ # batches
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module Batches
7
+ # Bad Request
8
+ class BatchesTransactions400ErrorException < APIException
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # This indicates an issue with the API request.
13
+ # @return [ErrorCode]
14
+ attr_accessor :error_code
15
+
16
+ # Unique reference to identify the error.
17
+ # @return [DetailedErrorCode]
18
+ attr_accessor :detailed_error_code
19
+
20
+ # Unique Text describing the specific error.
21
+ # @return [String]
22
+ attr_accessor :detailed_error_description
23
+
24
+ # The constructor.
25
+ # @param [String] reason The reason for raising an exception.
26
+ # @param [HttpResponse] response The HttpReponse of the API call.
27
+ def initialize(reason, response)
28
+ super(reason, response)
29
+ hash = APIHelper.json_deserialize(@response.raw_body)
30
+ unbox(hash)
31
+ end
32
+
33
+ # Populates this object by extracting properties from a hash.
34
+ # @param [Hash] hash The deserialized response sent by the server in the
35
+ # response body.
36
+ def unbox(hash)
37
+ return nil unless hash
38
+
39
+ @error_code = hash.key?('error_code') ? hash['error_code'] : SKIP
40
+ @detailed_error_code =
41
+ hash.key?('detailed_error_code') ? hash['detailed_error_code'] : SKIP
42
+ @detailed_error_description =
43
+ hash.key?('detailed_error_description') ? hash['detailed_error_description'] : SKIP
44
+ end
45
+
46
+ # Provides a human-readable string representation of the object.
47
+ def to_s
48
+ class_name = self.class.name.split('::').last
49
+ "<#{class_name} error_code: #{@error_code}, detailed_error_code: #{@detailed_error_code},"\
50
+ " detailed_error_description: #{@detailed_error_description}>"
51
+ end
52
+
53
+ # Provides a debugging-friendly string with detailed object information.
54
+ def inspect
55
+ class_name = self.class.name.split('::').last
56
+ "<#{class_name} error_code: #{@error_code.inspect}, detailed_error_code:"\
57
+ " #{@detailed_error_code.inspect}, detailed_error_description:"\
58
+ " #{@detailed_error_description.inspect}>"
59
+ end
60
+ end
61
+ end