sdksio-apimatic-sdk 3.0.0

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 (70) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +82 -0
  4. data/lib/apimatic_api/api_helper.rb +10 -0
  5. data/lib/apimatic_api/client.rb +96 -0
  6. data/lib/apimatic_api/configuration.rb +125 -0
  7. data/lib/apimatic_api/controllers/api_validation_external_apis_controller.rb +84 -0
  8. data/lib/apimatic_api/controllers/api_validation_imported_apis_controller.rb +74 -0
  9. data/lib/apimatic_api/controllers/apis_management_controller.rb +260 -0
  10. data/lib/apimatic_api/controllers/base_controller.rb +66 -0
  11. data/lib/apimatic_api/controllers/code_generation_external_apis_controller.rb +178 -0
  12. data/lib/apimatic_api/controllers/code_generation_imported_apis_controller.rb +136 -0
  13. data/lib/apimatic_api/controllers/docs_portal_management_controller.rb +198 -0
  14. data/lib/apimatic_api/controllers/transformation_controller.rb +174 -0
  15. data/lib/apimatic_api/exceptions/api_exception.rb +10 -0
  16. data/lib/apimatic_api/http/auth/custom_header_authentication.rb +42 -0
  17. data/lib/apimatic_api/http/http_call_back.rb +10 -0
  18. data/lib/apimatic_api/http/http_method_enum.rb +10 -0
  19. data/lib/apimatic_api/http/http_request.rb +10 -0
  20. data/lib/apimatic_api/http/http_response.rb +10 -0
  21. data/lib/apimatic_api/models/api_entity.rb +220 -0
  22. data/lib/apimatic_api/models/api_entity_code_generation.rb +131 -0
  23. data/lib/apimatic_api/models/api_entity_identifier.rb +48 -0
  24. data/lib/apimatic_api/models/api_validation_summary.rb +75 -0
  25. data/lib/apimatic_api/models/attributes.rb +48 -0
  26. data/lib/apimatic_api/models/auth_scope.rb +75 -0
  27. data/lib/apimatic_api/models/authentication.rb +112 -0
  28. data/lib/apimatic_api/models/base_model.rb +62 -0
  29. data/lib/apimatic_api/models/code_gen_settings.rb +541 -0
  30. data/lib/apimatic_api/models/code_generation.rb +122 -0
  31. data/lib/apimatic_api/models/docs_validation_summary.rb +75 -0
  32. data/lib/apimatic_api/models/endpoints_group.rb +57 -0
  33. data/lib/apimatic_api/models/environment.rb +79 -0
  34. data/lib/apimatic_api/models/export_formats.rb +60 -0
  35. data/lib/apimatic_api/models/field.rb +156 -0
  36. data/lib/apimatic_api/models/generate_on_prem_portal_via_build_input_request_body.rb +48 -0
  37. data/lib/apimatic_api/models/generate_sdk_via_file_request_body.rb +61 -0
  38. data/lib/apimatic_api/models/generate_sdk_via_url_request.rb +59 -0
  39. data/lib/apimatic_api/models/import_api_version_via_url_request.rb +64 -0
  40. data/lib/apimatic_api/models/import_api_via_file_request_body.rb +51 -0
  41. data/lib/apimatic_api/models/import_api_via_url_request.rb +49 -0
  42. data/lib/apimatic_api/models/import_new_api_version_via_file_request_body.rb +66 -0
  43. data/lib/apimatic_api/models/import_validation_summary.rb +75 -0
  44. data/lib/apimatic_api/models/inplace_api_import_binary_file.rb +51 -0
  45. data/lib/apimatic_api/models/inplace_import_api_via_url_request.rb +49 -0
  46. data/lib/apimatic_api/models/meta_data.rb +70 -0
  47. data/lib/apimatic_api/models/parameter.rb +165 -0
  48. data/lib/apimatic_api/models/paramter_format_details.rb +48 -0
  49. data/lib/apimatic_api/models/platforms.rb +39 -0
  50. data/lib/apimatic_api/models/platforms_template.rb +49 -0
  51. data/lib/apimatic_api/models/server.rb +69 -0
  52. data/lib/apimatic_api/models/server_configuration.rb +105 -0
  53. data/lib/apimatic_api/models/test_gen_settings.rb +70 -0
  54. data/lib/apimatic_api/models/transform_via_file_request_body.rb +61 -0
  55. data/lib/apimatic_api/models/transform_via_url_request.rb +60 -0
  56. data/lib/apimatic_api/models/transformation.rb +152 -0
  57. data/lib/apimatic_api/models/user_code_generation.rb +140 -0
  58. data/lib/apimatic_api/models/user_code_generation_requirements.rb +57 -0
  59. data/lib/apimatic_api/models/validate_api_via_file_request_body.rb +51 -0
  60. data/lib/apimatic_api/utilities/date_time_helper.rb +11 -0
  61. data/lib/apimatic_api/utilities/file_wrapper.rb +16 -0
  62. data/lib/apimatic_api.rb +86 -0
  63. data/test/controllers/controller_test_base.rb +29 -0
  64. data/test/controllers/test_api_validation_external_apis_controller.rb +144 -0
  65. data/test/controllers/test_api_validation_imported_apis_controller.rb +2971 -0
  66. data/test/controllers/test_code_generation_external_apis_controller.rb +32 -0
  67. data/test/controllers/test_docs_portal_management_controller.rb +94 -0
  68. data/test/controllers/test_transformation_controller.rb +32 -0
  69. data/test/http_response_catcher.rb +19 -0
  70. metadata +187 -0
@@ -0,0 +1,220 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # The API Entity Structure encapsulates all the details of an API Entity. An
8
+ # API entity is a unique API Version.
9
+ class ApiEntity < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # Unique API Entity identifier
14
+ # @return [String]
15
+ attr_accessor :id
16
+
17
+ # Enrcypted API Entity Id
18
+ # @return [String]
19
+ attr_accessor :encrypted_id
20
+
21
+ # API Integration Key. Obtain from API Card on Dashboard.
22
+ # @return [String]
23
+ attr_accessor :api_key
24
+
25
+ # Unique API Group Identifier
26
+ # @return [String]
27
+ attr_accessor :api_group_id
28
+
29
+ # Cover Image
30
+ # @return [String]
31
+ attr_accessor :image_uri
32
+
33
+ # Entity creation date
34
+ # @return [String]
35
+ attr_accessor :creation_date
36
+
37
+ # API Status (Deprecated)
38
+ # @return [TrueClass | FalseClass]
39
+ attr_accessor :public
40
+
41
+ # API Entity Name
42
+ # @return [String]
43
+ attr_accessor :name
44
+
45
+ # Description of the API
46
+ # @return [String]
47
+ attr_accessor :description
48
+
49
+ # Entity Version Number
50
+ # @return [String]
51
+ attr_accessor :version
52
+
53
+ # Header Content
54
+ # @return [Array[String]]
55
+ attr_accessor :additional_headers
56
+
57
+ # This Structure encapsulates all details of API authentication.
58
+ # @return [Authentication]
59
+ attr_accessor :authentication
60
+
61
+ # APIMatic’s code generation engine has various code generation
62
+ # configurations to customise the behaviour and outlook across the generated
63
+ # SDKS. This structure encapsulates all settings for CodeGeneration.
64
+ # @return [CodeGenSettings]
65
+ attr_accessor :code_gen_settings
66
+
67
+ # This structure helps specify additional test configurations which affects
68
+ # how test cases are generated.
69
+ # @return [TestGenSettings]
70
+ attr_accessor :test_gen_settings
71
+
72
+ # API Errors
73
+ # @return [Array[String]]
74
+ attr_accessor :errors
75
+
76
+ # Server configurations can be used to create multiple environments,
77
+ # multiple servers that can be used with specific endpoints and server URLs
78
+ # with template paramters.
79
+ # @return [ServerConfiguration]
80
+ attr_accessor :server_configuration
81
+
82
+ # API Endpoint Groups
83
+ # @return [Array[EndpointsGroup]]
84
+ attr_accessor :endpoints_group
85
+
86
+ # API Endpoint Groups
87
+ # @return [MetaData]
88
+ attr_accessor :meta_data
89
+
90
+ # A mapping from model property names to API property names.
91
+ def self.names
92
+ @_hash = {} if @_hash.nil?
93
+ @_hash['id'] = 'id'
94
+ @_hash['encrypted_id'] = 'encryptedId'
95
+ @_hash['api_key'] = 'apiKey'
96
+ @_hash['api_group_id'] = 'apiGroupId'
97
+ @_hash['image_uri'] = 'imageUri'
98
+ @_hash['creation_date'] = 'creationDate'
99
+ @_hash['public'] = 'public'
100
+ @_hash['name'] = 'name'
101
+ @_hash['description'] = 'description'
102
+ @_hash['version'] = 'version'
103
+ @_hash['additional_headers'] = 'additionalHeaders'
104
+ @_hash['authentication'] = 'authentication'
105
+ @_hash['code_gen_settings'] = 'codeGenSettings'
106
+ @_hash['test_gen_settings'] = 'testGenSettings'
107
+ @_hash['errors'] = 'errors'
108
+ @_hash['server_configuration'] = 'serverConfiguration'
109
+ @_hash['endpoints_group'] = 'endpointsGroup'
110
+ @_hash['meta_data'] = 'metaData'
111
+ @_hash
112
+ end
113
+
114
+ # An array for optional fields
115
+ def self.optionals
116
+ []
117
+ end
118
+
119
+ # An array for nullable fields
120
+ def self.nullables
121
+ []
122
+ end
123
+
124
+ def initialize(id = nil,
125
+ encrypted_id = nil,
126
+ api_key = nil,
127
+ api_group_id = nil,
128
+ image_uri = nil,
129
+ creation_date = nil,
130
+ public = nil,
131
+ name = nil,
132
+ description = nil,
133
+ version = nil,
134
+ additional_headers = nil,
135
+ authentication = nil,
136
+ code_gen_settings = nil,
137
+ test_gen_settings = nil,
138
+ errors = nil,
139
+ server_configuration = nil,
140
+ endpoints_group = nil,
141
+ meta_data = nil)
142
+ @id = id
143
+ @encrypted_id = encrypted_id
144
+ @api_key = api_key
145
+ @api_group_id = api_group_id
146
+ @image_uri = image_uri
147
+ @creation_date = creation_date
148
+ @public = public
149
+ @name = name
150
+ @description = description
151
+ @version = version
152
+ @additional_headers = additional_headers
153
+ @authentication = authentication
154
+ @code_gen_settings = code_gen_settings
155
+ @test_gen_settings = test_gen_settings
156
+ @errors = errors
157
+ @server_configuration = server_configuration
158
+ @endpoints_group = endpoints_group
159
+ @meta_data = meta_data
160
+ end
161
+
162
+ # Creates an instance of the object from a hash.
163
+ def self.from_hash(hash)
164
+ return nil unless hash
165
+
166
+ # Extract variables from the hash.
167
+ id = hash.key?('id') ? hash['id'] : nil
168
+ encrypted_id = hash.key?('encryptedId') ? hash['encryptedId'] : nil
169
+ api_key = hash.key?('apiKey') ? hash['apiKey'] : nil
170
+ api_group_id = hash.key?('apiGroupId') ? hash['apiGroupId'] : nil
171
+ image_uri = hash.key?('imageUri') ? hash['imageUri'] : nil
172
+ creation_date = hash.key?('creationDate') ? hash['creationDate'] : nil
173
+ public = hash.key?('public') ? hash['public'] : nil
174
+ name = hash.key?('name') ? hash['name'] : nil
175
+ description = hash.key?('description') ? hash['description'] : nil
176
+ version = hash.key?('version') ? hash['version'] : nil
177
+ additional_headers =
178
+ hash.key?('additionalHeaders') ? hash['additionalHeaders'] : nil
179
+ authentication = Authentication.from_hash(hash['authentication']) if hash['authentication']
180
+ code_gen_settings = CodeGenSettings.from_hash(hash['codeGenSettings']) if
181
+ hash['codeGenSettings']
182
+ test_gen_settings = TestGenSettings.from_hash(hash['testGenSettings']) if
183
+ hash['testGenSettings']
184
+ errors = hash.key?('errors') ? hash['errors'] : nil
185
+ server_configuration = ServerConfiguration.from_hash(hash['serverConfiguration']) if
186
+ hash['serverConfiguration']
187
+ # Parameter is an array, so we need to iterate through it
188
+ endpoints_group = nil
189
+ unless hash['endpointsGroup'].nil?
190
+ endpoints_group = []
191
+ hash['endpointsGroup'].each do |structure|
192
+ endpoints_group << (EndpointsGroup.from_hash(structure) if structure)
193
+ end
194
+ end
195
+
196
+ endpoints_group = nil unless hash.key?('endpointsGroup')
197
+ meta_data = MetaData.from_hash(hash['metaData']) if hash['metaData']
198
+
199
+ # Create object from extracted values.
200
+ ApiEntity.new(id,
201
+ encrypted_id,
202
+ api_key,
203
+ api_group_id,
204
+ image_uri,
205
+ creation_date,
206
+ public,
207
+ name,
208
+ description,
209
+ version,
210
+ additional_headers,
211
+ authentication,
212
+ code_gen_settings,
213
+ test_gen_settings,
214
+ errors,
215
+ server_configuration,
216
+ endpoints_group,
217
+ meta_data)
218
+ end
219
+ end
220
+ end
@@ -0,0 +1,131 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ module ApimaticApi
8
+ # The Code Generation structure encapsulates all the the details of an SDK
9
+ # generation performed against an API Entity
10
+ class APIEntityCodeGeneration < BaseModel
11
+ SKIP = Object.new
12
+ private_constant :SKIP
13
+
14
+ # Unique Code Generation Identifier
15
+ # @return [String]
16
+ attr_accessor :id
17
+
18
+ # The structure contains platforms that APIMatic CodeGen can generate SDKs
19
+ # and Docs in.
20
+ # @return [Platforms]
21
+ attr_accessor :template
22
+
23
+ # The generated SDK
24
+ # @return [String]
25
+ attr_accessor :generated_file
26
+
27
+ # Generation Date and Time
28
+ # @return [DateTime]
29
+ attr_accessor :generated_on
30
+
31
+ # The md5 hash of the API Description
32
+ # @return [String]
33
+ attr_accessor :hash_code
34
+
35
+ # Generation Source
36
+ # @return [String]
37
+ attr_accessor :code_generation_source
38
+
39
+ # Generation Version
40
+ # @return [String]
41
+ attr_accessor :code_gen_version
42
+
43
+ # Generation Status
44
+ # @return [TrueClass | FalseClass]
45
+ attr_accessor :success
46
+
47
+ # Unique API Entity Identifier
48
+ # @return [String]
49
+ attr_accessor :api_entity_id
50
+
51
+ # A mapping from model property names to API property names.
52
+ def self.names
53
+ @_hash = {} if @_hash.nil?
54
+ @_hash['id'] = 'id'
55
+ @_hash['template'] = 'template'
56
+ @_hash['generated_file'] = 'generatedFile'
57
+ @_hash['generated_on'] = 'generatedOn'
58
+ @_hash['hash_code'] = 'hashCode'
59
+ @_hash['code_generation_source'] = 'codeGenerationSource'
60
+ @_hash['code_gen_version'] = 'codeGenVersion'
61
+ @_hash['success'] = 'success'
62
+ @_hash['api_entity_id'] = 'apiEntityId'
63
+ @_hash
64
+ end
65
+
66
+ # An array for optional fields
67
+ def self.optionals
68
+ []
69
+ end
70
+
71
+ # An array for nullable fields
72
+ def self.nullables
73
+ []
74
+ end
75
+
76
+ def initialize(id = nil,
77
+ template = Platforms::CS_NET_STANDARD_LIB,
78
+ generated_file = nil,
79
+ generated_on = nil,
80
+ hash_code = nil,
81
+ code_generation_source = nil,
82
+ code_gen_version = nil,
83
+ success = nil,
84
+ api_entity_id = nil)
85
+ @id = id
86
+ @template = template
87
+ @generated_file = generated_file
88
+ @generated_on = generated_on
89
+ @hash_code = hash_code
90
+ @code_generation_source = code_generation_source
91
+ @code_gen_version = code_gen_version
92
+ @success = success
93
+ @api_entity_id = api_entity_id
94
+ end
95
+
96
+ # Creates an instance of the object from a hash.
97
+ def self.from_hash(hash)
98
+ return nil unless hash
99
+
100
+ # Extract variables from the hash.
101
+ id = hash.key?('id') ? hash['id'] : nil
102
+ template = hash['template'] ||= Platforms::CS_NET_STANDARD_LIB
103
+ generated_file = hash.key?('generatedFile') ? hash['generatedFile'] : nil
104
+ generated_on = if hash.key?('generatedOn')
105
+ (DateTimeHelper.from_rfc3339(hash['generatedOn']) if hash['generatedOn'])
106
+ end
107
+ hash_code = hash.key?('hashCode') ? hash['hashCode'] : nil
108
+ code_generation_source =
109
+ hash.key?('codeGenerationSource') ? hash['codeGenerationSource'] : nil
110
+ code_gen_version =
111
+ hash.key?('codeGenVersion') ? hash['codeGenVersion'] : nil
112
+ success = hash.key?('success') ? hash['success'] : nil
113
+ api_entity_id = hash.key?('apiEntityId') ? hash['apiEntityId'] : nil
114
+
115
+ # Create object from extracted values.
116
+ APIEntityCodeGeneration.new(id,
117
+ template,
118
+ generated_file,
119
+ generated_on,
120
+ hash_code,
121
+ code_generation_source,
122
+ code_gen_version,
123
+ success,
124
+ api_entity_id)
125
+ end
126
+
127
+ def to_custom_generated_on
128
+ DateTimeHelper.to_rfc3339(generated_on)
129
+ end
130
+ end
131
+ end
@@ -0,0 +1,48 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # APIEntityIdentifier Model.
8
+ class APIEntityIdentifier < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Unique API Entity Identifier
13
+ # @return [String]
14
+ attr_accessor :api_entity_id
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['api_entity_id'] = 'apiEntityId'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ []
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def self.nullables
30
+ []
31
+ end
32
+
33
+ def initialize(api_entity_id = nil)
34
+ @api_entity_id = api_entity_id
35
+ end
36
+
37
+ # Creates an instance of the object from a hash.
38
+ def self.from_hash(hash)
39
+ return nil unless hash
40
+
41
+ # Extract variables from the hash.
42
+ api_entity_id = hash.key?('apiEntityId') ? hash['apiEntityId'] : nil
43
+
44
+ # Create object from extracted values.
45
+ APIEntityIdentifier.new(api_entity_id)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,75 @@
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
@@ -0,0 +1,48 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # The structure contain attribute details of a parameter type.
8
+ class Attributes < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Unique Attribute Identifier
13
+ # @return [String]
14
+ attr_accessor :id
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ @_hash = {} if @_hash.nil?
19
+ @_hash['id'] = 'id'
20
+ @_hash
21
+ end
22
+
23
+ # An array for optional fields
24
+ def self.optionals
25
+ []
26
+ end
27
+
28
+ # An array for nullable fields
29
+ def self.nullables
30
+ []
31
+ end
32
+
33
+ def initialize(id = nil)
34
+ @id = id
35
+ end
36
+
37
+ # Creates an instance of the object from a hash.
38
+ def self.from_hash(hash)
39
+ return nil unless hash
40
+
41
+ # Extract variables from the hash.
42
+ id = hash.key?('id') ? hash['id'] : nil
43
+
44
+ # Create object from extracted values.
45
+ Attributes.new(id)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,75 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # AuthScope Model.
8
+ class AuthScope < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Scope Id
13
+ # @return [String]
14
+ attr_accessor :id
15
+
16
+ # Scope Name
17
+ # @return [String]
18
+ attr_accessor :name
19
+
20
+ # Scope Value
21
+ # @return [String]
22
+ attr_accessor :value
23
+
24
+ # Scope Description
25
+ # @return [String]
26
+ attr_accessor :description
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['id'] = 'id'
32
+ @_hash['name'] = 'name'
33
+ @_hash['value'] = 'value'
34
+ @_hash['description'] = 'description'
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(id = nil,
49
+ name = nil,
50
+ value = nil,
51
+ description = nil)
52
+ @id = id
53
+ @name = name
54
+ @value = value
55
+ @description = description
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
+ id = hash.key?('id') ? hash['id'] : nil
64
+ name = hash.key?('name') ? hash['name'] : nil
65
+ value = hash.key?('value') ? hash['value'] : nil
66
+ description = hash.key?('description') ? hash['description'] : nil
67
+
68
+ # Create object from extracted values.
69
+ AuthScope.new(id,
70
+ name,
71
+ value,
72
+ description)
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,112 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # This Structure encapsulates all details of API authentication.
8
+ class Authentication < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Auth Id
13
+ # @return [String]
14
+ attr_accessor :id
15
+
16
+ # Auth Type
17
+ # @return [String]
18
+ attr_accessor :auth_type
19
+
20
+ # Scope
21
+ # @return [Array[AuthScope]]
22
+ attr_accessor :scopes
23
+
24
+ # Auth Params
25
+ # @return [Array[String]]
26
+ attr_accessor :parameters
27
+
28
+ # Auth Scopes
29
+ # @return [Array[String]]
30
+ attr_accessor :auth_scopes
31
+
32
+ # Auth Grant Types
33
+ # @return [Array[String]]
34
+ attr_accessor :auth_grant_types
35
+
36
+ # Paramater Formats
37
+ # @return [Object]
38
+ attr_accessor :param_formats
39
+
40
+ # A mapping from model property names to API property names.
41
+ def self.names
42
+ @_hash = {} if @_hash.nil?
43
+ @_hash['id'] = 'id'
44
+ @_hash['auth_type'] = 'authType'
45
+ @_hash['scopes'] = 'scopes'
46
+ @_hash['parameters'] = 'parameters'
47
+ @_hash['auth_scopes'] = 'authScopes'
48
+ @_hash['auth_grant_types'] = 'authGrantTypes'
49
+ @_hash['param_formats'] = 'paramFormats'
50
+ @_hash
51
+ end
52
+
53
+ # An array for optional fields
54
+ def self.optionals
55
+ []
56
+ end
57
+
58
+ # An array for nullable fields
59
+ def self.nullables
60
+ []
61
+ end
62
+
63
+ def initialize(id = nil,
64
+ auth_type = nil,
65
+ scopes = nil,
66
+ parameters = nil,
67
+ auth_scopes = nil,
68
+ auth_grant_types = nil,
69
+ param_formats = nil)
70
+ @id = id
71
+ @auth_type = auth_type
72
+ @scopes = scopes
73
+ @parameters = parameters
74
+ @auth_scopes = auth_scopes
75
+ @auth_grant_types = auth_grant_types
76
+ @param_formats = param_formats
77
+ end
78
+
79
+ # Creates an instance of the object from a hash.
80
+ def self.from_hash(hash)
81
+ return nil unless hash
82
+
83
+ # Extract variables from the hash.
84
+ id = hash.key?('id') ? hash['id'] : nil
85
+ auth_type = hash.key?('authType') ? hash['authType'] : nil
86
+ # Parameter is an array, so we need to iterate through it
87
+ scopes = nil
88
+ unless hash['scopes'].nil?
89
+ scopes = []
90
+ hash['scopes'].each do |structure|
91
+ scopes << (AuthScope.from_hash(structure) if structure)
92
+ end
93
+ end
94
+
95
+ scopes = nil unless hash.key?('scopes')
96
+ parameters = hash.key?('parameters') ? hash['parameters'] : nil
97
+ auth_scopes = hash.key?('authScopes') ? hash['authScopes'] : nil
98
+ auth_grant_types =
99
+ hash.key?('authGrantTypes') ? hash['authGrantTypes'] : nil
100
+ param_formats = hash.key?('paramFormats') ? hash['paramFormats'] : nil
101
+
102
+ # Create object from extracted values.
103
+ Authentication.new(id,
104
+ auth_type,
105
+ scopes,
106
+ parameters,
107
+ auth_scopes,
108
+ auth_grant_types,
109
+ param_formats)
110
+ end
111
+ end
112
+ end