sdksio-apimatic-sdk 3.0.0 → 3.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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +165 -77
  4. data/bin/console +15 -0
  5. data/lib/apimatic_api/api_helper.rb +10 -10
  6. data/lib/apimatic_api/client.rb +108 -96
  7. data/lib/apimatic_api/configuration.rb +198 -125
  8. data/lib/apimatic_api/controllers/api_validation_external_apis_controller.rb +90 -84
  9. data/lib/apimatic_api/controllers/api_validation_v2_external_apis_controller.rb +89 -0
  10. data/lib/apimatic_api/controllers/base_controller.rb +55 -66
  11. data/lib/apimatic_api/controllers/code_generation_external_apis_controller.rb +201 -178
  12. data/lib/apimatic_api/controllers/docs_portal_generation_async_controller.rb +110 -0
  13. data/lib/apimatic_api/controllers/docs_portal_management_controller.rb +56 -198
  14. data/lib/apimatic_api/controllers/sdk_generation_async_controller.rb +112 -0
  15. data/lib/apimatic_api/controllers/transformation_controller.rb +180 -174
  16. data/lib/apimatic_api/exceptions/api_exception.rb +21 -10
  17. data/lib/apimatic_api/exceptions/bad_request_response_sdk_exception.rb +46 -0
  18. data/lib/apimatic_api/exceptions/internal_server_error_response_exception.rb +46 -0
  19. data/lib/apimatic_api/exceptions/problem_details_exception.rb +74 -0
  20. data/lib/apimatic_api/exceptions/unauthorized_response_exception.rb +46 -0
  21. data/lib/apimatic_api/http/api_response.rb +19 -0
  22. data/lib/apimatic_api/http/auth/custom_header_authentication.rb +48 -38
  23. data/lib/apimatic_api/http/http_call_back.rb +10 -10
  24. data/lib/apimatic_api/http/http_method_enum.rb +10 -10
  25. data/lib/apimatic_api/http/http_request.rb +10 -10
  26. data/lib/apimatic_api/http/http_response.rb +10 -10
  27. data/lib/apimatic_api/http/proxy_settings.rb +22 -0
  28. data/lib/apimatic_api/logging/configuration/api_logging_configuration.rb +186 -0
  29. data/lib/apimatic_api/logging/sdk_logger.rb +17 -0
  30. data/lib/apimatic_api/models/accept.rb +26 -0
  31. data/lib/apimatic_api/models/api_validation_summary.rb +100 -75
  32. data/lib/apimatic_api/models/base_model.rb +110 -62
  33. data/lib/apimatic_api/models/content_type.rb +26 -0
  34. data/lib/apimatic_api/models/export_formats.rb +85 -60
  35. data/lib/apimatic_api/models/generate_sdk_via_url_request.rb +85 -59
  36. data/lib/apimatic_api/models/line_info.rb +105 -0
  37. data/lib/apimatic_api/models/links.rb +82 -0
  38. data/lib/apimatic_api/models/platforms.rb +57 -39
  39. data/lib/apimatic_api/models/portal_generation_async_response.rb +68 -0
  40. data/lib/apimatic_api/models/portal_generation_status_response.rb +70 -0
  41. data/lib/apimatic_api/models/sdk_generation_async_response.rb +68 -0
  42. data/lib/apimatic_api/models/sdk_generation_status_response.rb +70 -0
  43. data/lib/apimatic_api/models/sdk_languages.rb +56 -0
  44. data/lib/apimatic_api/models/status.rb +48 -0
  45. data/lib/apimatic_api/models/transform_via_url_request.rb +85 -60
  46. data/lib/apimatic_api/models/transformation.rb +180 -152
  47. data/lib/apimatic_api/models/user_code_generation.rb +167 -140
  48. data/lib/apimatic_api/models/validate_api_result.rb +82 -0
  49. data/lib/apimatic_api/models/validation_entry.rb +143 -0
  50. data/lib/apimatic_api/models/validation_summary.rb +145 -0
  51. data/lib/apimatic_api/utilities/date_time_helper.rb +11 -11
  52. data/lib/apimatic_api/utilities/file_wrapper.rb +28 -16
  53. data/lib/apimatic_api.rb +79 -86
  54. metadata +39 -89
  55. data/lib/apimatic_api/controllers/api_validation_imported_apis_controller.rb +0 -74
  56. data/lib/apimatic_api/controllers/apis_management_controller.rb +0 -260
  57. data/lib/apimatic_api/controllers/code_generation_imported_apis_controller.rb +0 -136
  58. data/lib/apimatic_api/models/api_entity.rb +0 -220
  59. data/lib/apimatic_api/models/api_entity_code_generation.rb +0 -131
  60. data/lib/apimatic_api/models/api_entity_identifier.rb +0 -48
  61. data/lib/apimatic_api/models/attributes.rb +0 -48
  62. data/lib/apimatic_api/models/auth_scope.rb +0 -75
  63. data/lib/apimatic_api/models/authentication.rb +0 -112
  64. data/lib/apimatic_api/models/code_gen_settings.rb +0 -541
  65. data/lib/apimatic_api/models/code_generation.rb +0 -122
  66. data/lib/apimatic_api/models/docs_validation_summary.rb +0 -75
  67. data/lib/apimatic_api/models/endpoints_group.rb +0 -57
  68. data/lib/apimatic_api/models/environment.rb +0 -79
  69. data/lib/apimatic_api/models/field.rb +0 -156
  70. data/lib/apimatic_api/models/generate_on_prem_portal_via_build_input_request_body.rb +0 -48
  71. data/lib/apimatic_api/models/generate_sdk_via_file_request_body.rb +0 -61
  72. data/lib/apimatic_api/models/import_api_version_via_url_request.rb +0 -64
  73. data/lib/apimatic_api/models/import_api_via_file_request_body.rb +0 -51
  74. data/lib/apimatic_api/models/import_api_via_url_request.rb +0 -49
  75. data/lib/apimatic_api/models/import_new_api_version_via_file_request_body.rb +0 -66
  76. data/lib/apimatic_api/models/import_validation_summary.rb +0 -75
  77. data/lib/apimatic_api/models/inplace_api_import_binary_file.rb +0 -51
  78. data/lib/apimatic_api/models/inplace_import_api_via_url_request.rb +0 -49
  79. data/lib/apimatic_api/models/meta_data.rb +0 -70
  80. data/lib/apimatic_api/models/parameter.rb +0 -165
  81. data/lib/apimatic_api/models/paramter_format_details.rb +0 -48
  82. data/lib/apimatic_api/models/platforms_template.rb +0 -49
  83. data/lib/apimatic_api/models/server.rb +0 -69
  84. data/lib/apimatic_api/models/server_configuration.rb +0 -105
  85. data/lib/apimatic_api/models/test_gen_settings.rb +0 -70
  86. data/lib/apimatic_api/models/transform_via_file_request_body.rb +0 -61
  87. data/lib/apimatic_api/models/user_code_generation_requirements.rb +0 -57
  88. data/lib/apimatic_api/models/validate_api_via_file_request_body.rb +0 -51
  89. data/test/controllers/controller_test_base.rb +0 -29
  90. data/test/controllers/test_api_validation_external_apis_controller.rb +0 -144
  91. data/test/controllers/test_api_validation_imported_apis_controller.rb +0 -2971
  92. data/test/controllers/test_code_generation_external_apis_controller.rb +0 -32
  93. data/test/controllers/test_docs_portal_management_controller.rb +0 -94
  94. data/test/controllers/test_transformation_controller.rb +0 -32
  95. data/test/http_response_catcher.rb +0 -19
@@ -1,42 +1,52 @@
1
- # apimatic_api
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module ApimaticApi
7
- # Utility class for custom header authorization.
8
- class CustomHeaderAuthentication < CoreLibrary::HeaderAuth
9
- # Display error message on occurrence of authentication failure.
10
- # @returns [String] The oAuth error message.
11
- def error_message
12
- 'CustomHeaderAuthentication: authorization is undefined.'
13
- end
14
-
15
- # Initialization constructor.
16
- def initialize(custom_header_authentication_credentials)
17
- auth_params = {}
18
- auth_params['Authorization'] = custom_header_authentication_credentials.authorization unless
19
- custom_header_authentication_credentials.nil? || custom_header_authentication_credentials.authorization.nil?
20
-
21
- super auth_params
22
- end
23
- end
24
-
25
- # Data class for CustomHeaderAuthenticationCredentials.
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # Utility class for custom header authorization.
8
+ class CustomHeaderAuthentication < CoreLibrary::HeaderAuth
9
+ # Display error message on occurrence of authentication failure.
10
+ # @returns [String] The oAuth error message.
11
+ def error_message
12
+ 'CustomHeaderAuthentication: authorization is undefined.'
13
+ end
14
+
15
+ # Initialization constructor.
16
+ def initialize(custom_header_authentication_credentials)
17
+ auth_params = {}
18
+ auth_params['Authorization'] = custom_header_authentication_credentials.authorization unless
19
+ custom_header_authentication_credentials.nil? || custom_header_authentication_credentials.authorization.nil?
20
+
21
+ super auth_params
22
+ end
23
+ end
24
+
25
+ # Data class for CustomHeaderAuthenticationCredentials.
26
26
  # Data class for CustomHeaderAuthenticationCredentials.
27
27
  class CustomHeaderAuthenticationCredentials
28
28
  attr_reader :authorization
29
29
 
30
- def initialize(authorization:)
31
- raise ArgumentError, 'authorization cannot be nil' if authorization.nil?
32
-
33
- @authorization = authorization
34
- end
35
-
36
- def clone_with(authorization: nil)
37
- authorization ||= self.authorization
38
-
39
- CustomHeaderAuthenticationCredentials.new(authorization: authorization)
40
- end
41
- end
42
- end
30
+ def initialize(authorization:)
31
+ raise ArgumentError, 'authorization cannot be nil' if authorization.nil?
32
+
33
+ @authorization = authorization
34
+ end
35
+
36
+ def self.from_env
37
+ authorization = ENV['AUTHORIZATION']
38
+ all_nil = [
39
+ authorization
40
+ ].all?(&:nil?)
41
+ return nil if all_nil
42
+
43
+ new(authorization: authorization)
44
+ end
45
+
46
+ def clone_with(authorization: nil)
47
+ authorization ||= self.authorization
48
+
49
+ CustomHeaderAuthenticationCredentials.new(authorization: authorization)
50
+ end
51
+ end
52
+ end
@@ -1,10 +1,10 @@
1
- # apimatic_api
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module ApimaticApi
7
- # HttpCallBack allows defining callables for pre and post API calls.
8
- class HttpCallBack < CoreLibrary::HttpCallback
9
- end
10
- end
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # HttpCallBack allows defining callables for pre and post API calls.
8
+ class HttpCallBack < CoreLibrary::HttpCallback
9
+ end
10
+ end
@@ -1,10 +1,10 @@
1
- # apimatic_api
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module ApimaticApi
7
- # HTTP Methods Enumeration.
8
- class HttpMethodEnum < CoreLibrary::HttpMethod
9
- end
10
- end
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # HTTP Methods Enumeration.
8
+ class HttpMethodEnum < CoreLibrary::HttpMethod
9
+ end
10
+ end
@@ -1,10 +1,10 @@
1
- # apimatic_api
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module ApimaticApi
7
- # Represents a single Http Request.
8
- class HttpRequest < CoreLibrary::HttpRequest
9
- end
10
- end
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # Represents a single Http Request.
8
+ class HttpRequest < CoreLibrary::HttpRequest
9
+ end
10
+ end
@@ -1,10 +1,10 @@
1
- # apimatic_api
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module ApimaticApi
7
- # Http response received.
8
- class HttpResponse < CoreLibrary::HttpResponse
9
- end
10
- end
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # Http response received.
8
+ class HttpResponse < CoreLibrary::HttpResponse
9
+ end
10
+ end
@@ -0,0 +1,22 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ApimaticApi
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
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ApimaticApi
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
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ApimaticApi
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,26 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # Accept.
8
+ class Accept
9
+ ACCEPT = [
10
+ # TODO: Write general description for ENUM_APPLICATIONJSON
11
+ ENUM_APPLICATIONJSON = 'application/json'.freeze
12
+ ].freeze
13
+
14
+ def self.validate(value)
15
+ return false if value.nil?
16
+
17
+ ACCEPT.include?(value)
18
+ end
19
+
20
+ def self.from_value(value, default_value = ENUM_APPLICATIONJSON)
21
+ return default_value if value.nil?
22
+
23
+ default_value
24
+ end
25
+ end
26
+ end
@@ -1,75 +1,100 @@
1
- # apimatic_api
2
- #
3
- # This file was automatically generated by APIMATIC v2.0
4
- # ( https://apimatic.io ).
5
-
6
- module ApimaticApi
7
- # ApiValidationSummary Model.
8
- class ApiValidationSummary < BaseModel
9
- SKIP = Object.new
10
- private_constant :SKIP
11
-
12
- # TODO: Write general description for this method
13
- # @return [TrueClass | FalseClass]
14
- attr_accessor :success
15
-
16
- # TODO: Write general description for this method
17
- # @return [Array[String]]
18
- attr_accessor :errors
19
-
20
- # TODO: Write general description for this method
21
- # @return [Array[String]]
22
- attr_accessor :warnings
23
-
24
- # TODO: Write general description for this method
25
- # @return [Array[String]]
26
- attr_accessor :messages
27
-
28
- # A mapping from model property names to API property names.
29
- def self.names
30
- @_hash = {} if @_hash.nil?
31
- @_hash['success'] = 'success'
32
- @_hash['errors'] = 'errors'
33
- @_hash['warnings'] = 'warnings'
34
- @_hash['messages'] = 'messages'
35
- @_hash
36
- end
37
-
38
- # An array for optional fields
39
- def self.optionals
40
- []
41
- end
42
-
43
- # An array for nullable fields
44
- def self.nullables
45
- []
46
- end
47
-
48
- def initialize(success = nil,
49
- errors = nil,
50
- warnings = nil,
51
- messages = nil)
52
- @success = success
53
- @errors = errors
54
- @warnings = warnings
55
- @messages = messages
56
- end
57
-
58
- # Creates an instance of the object from a hash.
59
- def self.from_hash(hash)
60
- return nil unless hash
61
-
62
- # Extract variables from the hash.
63
- success = hash.key?('success') ? hash['success'] : nil
64
- errors = hash.key?('errors') ? hash['errors'] : nil
65
- warnings = hash.key?('warnings') ? hash['warnings'] : nil
66
- messages = hash.key?('messages') ? hash['messages'] : nil
67
-
68
- # Create object from extracted values.
69
- ApiValidationSummary.new(success,
70
- errors,
71
- warnings,
72
- messages)
73
- end
74
- end
75
- end
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # ApiValidationSummary Model.
8
+ class ApiValidationSummary < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [TrueClass | FalseClass]
14
+ attr_accessor :success
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [Array[String]]
18
+ attr_accessor :errors
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [Array[String]]
22
+ attr_accessor :warnings
23
+
24
+ # TODO: Write general description for this method
25
+ # @return [Array[String]]
26
+ attr_accessor :messages
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['success'] = 'success'
32
+ @_hash['errors'] = 'errors'
33
+ @_hash['warnings'] = 'warnings'
34
+ @_hash['messages'] = 'messages'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ []
41
+ end
42
+
43
+ # An array for nullable fields
44
+ def self.nullables
45
+ []
46
+ end
47
+
48
+ def initialize(success:, errors:, warnings:, messages:,
49
+ additional_properties: nil)
50
+ # Add additional model properties to the instance
51
+ additional_properties = {} if additional_properties.nil?
52
+
53
+ @success = success
54
+ @errors = errors
55
+ @warnings = warnings
56
+ @messages = messages
57
+ @additional_properties = additional_properties
58
+ end
59
+
60
+ # Creates an instance of the object from a hash.
61
+ def self.from_hash(hash)
62
+ return nil unless hash
63
+
64
+ # Extract variables from the hash.
65
+ success = hash.key?('success') ? hash['success'] : nil
66
+ errors = hash.key?('errors') ? hash['errors'] : nil
67
+ warnings = hash.key?('warnings') ? hash['warnings'] : nil
68
+ messages = hash.key?('messages') ? hash['messages'] : nil
69
+
70
+ # Create a new hash for additional properties, removing known properties.
71
+ new_hash = hash.reject { |k, _| names.value?(k) }
72
+
73
+ additional_properties = APIHelper.get_additional_properties(
74
+ new_hash, proc { |value| value }
75
+ )
76
+
77
+ # Create object from extracted values.
78
+ ApiValidationSummary.new(success: success,
79
+ errors: errors,
80
+ warnings: warnings,
81
+ messages: messages,
82
+ additional_properties: additional_properties)
83
+ end
84
+
85
+ # Provides a human-readable string representation of the object.
86
+ def to_s
87
+ class_name = self.class.name.split('::').last
88
+ "<#{class_name} success: #{@success}, errors: #{@errors}, warnings: #{@warnings}, messages:"\
89
+ " #{@messages}, additional_properties: #{@additional_properties}>"
90
+ end
91
+
92
+ # Provides a debugging-friendly string with detailed object information.
93
+ def inspect
94
+ class_name = self.class.name.split('::').last
95
+ "<#{class_name} success: #{@success.inspect}, errors: #{@errors.inspect}, warnings:"\
96
+ " #{@warnings.inspect}, messages: #{@messages.inspect}, additional_properties:"\
97
+ " #{@additional_properties}>"
98
+ end
99
+ end
100
+ end