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,59 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # GenerateSdkViaUrlRequest Model.
8
+ class GenerateSdkViaUrlRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The URL for the API specification file.<br><br>**Note:** This URL should
13
+ # be publicly accessible.
14
+ # @return [String]
15
+ attr_accessor :url
16
+
17
+ # The structure contains platforms that APIMatic CodeGen can generate SDKs
18
+ # and Docs in.
19
+ # @return [Platforms]
20
+ attr_accessor :template
21
+
22
+ # A mapping from model property names to API property names.
23
+ def self.names
24
+ @_hash = {} if @_hash.nil?
25
+ @_hash['url'] = 'url'
26
+ @_hash['template'] = 'template'
27
+ @_hash
28
+ end
29
+
30
+ # An array for optional fields
31
+ def self.optionals
32
+ []
33
+ end
34
+
35
+ # An array for nullable fields
36
+ def self.nullables
37
+ []
38
+ end
39
+
40
+ def initialize(url = nil,
41
+ template = Platforms::CS_NET_STANDARD_LIB)
42
+ @url = url
43
+ @template = template
44
+ end
45
+
46
+ # Creates an instance of the object from a hash.
47
+ def self.from_hash(hash)
48
+ return nil unless hash
49
+
50
+ # Extract variables from the hash.
51
+ url = hash.key?('url') ? hash['url'] : nil
52
+ template = hash['template'] ||= Platforms::CS_NET_STANDARD_LIB
53
+
54
+ # Create object from extracted values.
55
+ GenerateSdkViaUrlRequest.new(url,
56
+ template)
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,64 @@
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 contains details of importing a new API Version
8
+ class ImportApiVersionViaUrlRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The version number with which the new API version will be imported. This
13
+ # version number will override the version specified in the API
14
+ # specification file.<br>APIMatic recommends versioning the API with the
15
+ # [versioning
16
+ # scheme](https://docs.apimatic.io/define-apis/basic-settings/#version)
17
+ # documented in the docs.
18
+ # @return [String]
19
+ attr_accessor :version_override
20
+
21
+ # The URL for the API specification file.<br><br>**Note:** This URL should
22
+ # be publicly accessible.
23
+ # @return [String]
24
+ attr_accessor :url
25
+
26
+ # A mapping from model property names to API property names.
27
+ def self.names
28
+ @_hash = {} if @_hash.nil?
29
+ @_hash['version_override'] = 'version_override'
30
+ @_hash['url'] = 'url'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def self.optionals
36
+ []
37
+ end
38
+
39
+ # An array for nullable fields
40
+ def self.nullables
41
+ []
42
+ end
43
+
44
+ def initialize(version_override = nil,
45
+ url = nil)
46
+ @version_override = version_override
47
+ @url = url
48
+ end
49
+
50
+ # Creates an instance of the object from a hash.
51
+ def self.from_hash(hash)
52
+ return nil unless hash
53
+
54
+ # Extract variables from the hash.
55
+ version_override =
56
+ hash.key?('version_override') ? hash['version_override'] : nil
57
+ url = hash.key?('url') ? hash['url'] : nil
58
+
59
+ # Create object from extracted values.
60
+ ImportApiVersionViaUrlRequest.new(version_override,
61
+ url)
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,51 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # ImportAPIViaFileRequestBody Model.
8
+ class ImportAPIViaFileRequestBody < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The API specification file.<br>The type of the specification file should
13
+ # be any of the [supported
14
+ # formats](https://docs.apimatic.io/api-transformer/overview-transformer#sup
15
+ # ported-input-formats).
16
+ # @return [Binary]
17
+ attr_accessor :file
18
+
19
+ # A mapping from model property names to API property names.
20
+ def self.names
21
+ @_hash = {} if @_hash.nil?
22
+ @_hash['file'] = 'file'
23
+ @_hash
24
+ end
25
+
26
+ # An array for optional fields
27
+ def self.optionals
28
+ []
29
+ end
30
+
31
+ # An array for nullable fields
32
+ def self.nullables
33
+ []
34
+ end
35
+
36
+ def initialize(file = nil)
37
+ @file = file
38
+ end
39
+
40
+ # Creates an instance of the object from a hash.
41
+ def self.from_hash(hash)
42
+ return nil unless hash
43
+
44
+ # Extract variables from the hash.
45
+ file = hash.key?('file') ? hash['file'] : nil
46
+
47
+ # Create object from extracted values.
48
+ ImportAPIViaFileRequestBody.new(file)
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,49 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # Contains a url field to allow Apis to be imported via url
8
+ class ImportApiViaUrlRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The URL for the API specification file.<br><br>**Note:** This URL should
13
+ # be publicly accessible.
14
+ # @return [String]
15
+ attr_accessor :url
16
+
17
+ # A mapping from model property names to API property names.
18
+ def self.names
19
+ @_hash = {} if @_hash.nil?
20
+ @_hash['url'] = 'url'
21
+ @_hash
22
+ end
23
+
24
+ # An array for optional fields
25
+ def self.optionals
26
+ []
27
+ end
28
+
29
+ # An array for nullable fields
30
+ def self.nullables
31
+ []
32
+ end
33
+
34
+ def initialize(url = nil)
35
+ @url = url
36
+ end
37
+
38
+ # Creates an instance of the object from a hash.
39
+ def self.from_hash(hash)
40
+ return nil unless hash
41
+
42
+ # Extract variables from the hash.
43
+ url = hash.key?('url') ? hash['url'] : nil
44
+
45
+ # Create object from extracted values.
46
+ ImportApiViaUrlRequest.new(url)
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,66 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # ImportNewAPIVersionViaFileRequestBody Model.
8
+ class ImportNewAPIVersionViaFileRequestBody < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The version number with which the new API version will be imported. This
13
+ # version number will override the version specified in the API
14
+ # specification file.<br>APIMatic recommends versioning the API with the
15
+ # [versioning
16
+ # scheme](https://docs.apimatic.io/define-apis/basic-settings/#version)
17
+ # documented in the docs.
18
+ # @return [String]
19
+ attr_accessor :version_override
20
+
21
+ # The API specification file.<br>The type of the specification file should
22
+ # be any of the [supported
23
+ # formats](https://docs.apimatic.io/api-transformer/overview-transformer#sup
24
+ # ported-input-formats).
25
+ # @return [Binary]
26
+ attr_accessor :file
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['version_override'] = 'version_override'
32
+ @_hash['file'] = 'file'
33
+ @_hash
34
+ end
35
+
36
+ # An array for optional fields
37
+ def self.optionals
38
+ []
39
+ end
40
+
41
+ # An array for nullable fields
42
+ def self.nullables
43
+ []
44
+ end
45
+
46
+ def initialize(version_override = nil,
47
+ file = nil)
48
+ @version_override = version_override
49
+ @file = file
50
+ end
51
+
52
+ # Creates an instance of the object from a hash.
53
+ def self.from_hash(hash)
54
+ return nil unless hash
55
+
56
+ # Extract variables from the hash.
57
+ version_override =
58
+ hash.key?('version_override') ? hash['version_override'] : nil
59
+ file = hash.key?('file') ? hash['file'] : nil
60
+
61
+ # Create object from extracted values.
62
+ ImportNewAPIVersionViaFileRequestBody.new(version_override,
63
+ file)
64
+ end
65
+ end
66
+ 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
+ # ImportValidationSummary Model.
8
+ class ImportValidationSummary < 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
+ ImportValidationSummary.new(success,
70
+ errors,
71
+ warnings,
72
+ messages)
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,51 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # InplaceApiImportBinaryFile Model.
8
+ class InplaceApiImportBinaryFile < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The API specification file.<br>The type of the specification file should
13
+ # be any of the [supported
14
+ # formats](https://docs.apimatic.io/api-transformer/overview-transformer#sup
15
+ # ported-input-formats).
16
+ # @return [Binary]
17
+ attr_accessor :file
18
+
19
+ # A mapping from model property names to API property names.
20
+ def self.names
21
+ @_hash = {} if @_hash.nil?
22
+ @_hash['file'] = 'file'
23
+ @_hash
24
+ end
25
+
26
+ # An array for optional fields
27
+ def self.optionals
28
+ []
29
+ end
30
+
31
+ # An array for nullable fields
32
+ def self.nullables
33
+ []
34
+ end
35
+
36
+ def initialize(file = nil)
37
+ @file = file
38
+ end
39
+
40
+ # Creates an instance of the object from a hash.
41
+ def self.from_hash(hash)
42
+ return nil unless hash
43
+
44
+ # Extract variables from the hash.
45
+ file = hash.key?('file') ? hash['file'] : nil
46
+
47
+ # Create object from extracted values.
48
+ InplaceApiImportBinaryFile.new(file)
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,49 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # Contains a url field to allow Apis to be imported via url
8
+ class InplaceImportApiViaUrlRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The URL for the API specification file.<br><br>**Note:** This URL should
13
+ # be publicly accessible.
14
+ # @return [String]
15
+ attr_accessor :url
16
+
17
+ # A mapping from model property names to API property names.
18
+ def self.names
19
+ @_hash = {} if @_hash.nil?
20
+ @_hash['url'] = 'url'
21
+ @_hash
22
+ end
23
+
24
+ # An array for optional fields
25
+ def self.optionals
26
+ []
27
+ end
28
+
29
+ # An array for nullable fields
30
+ def self.nullables
31
+ []
32
+ end
33
+
34
+ def initialize(url = nil)
35
+ @url = url
36
+ end
37
+
38
+ # Creates an instance of the object from a hash.
39
+ def self.from_hash(hash)
40
+ return nil unless hash
41
+
42
+ # Extract variables from the hash.
43
+ url = hash.key?('url') ? hash['url'] : nil
44
+
45
+ # Create object from extracted values.
46
+ InplaceImportApiViaUrlRequest.new(url)
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,70 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # MetaData Model.
8
+ class MetaData < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [ImportValidationSummary]
14
+ attr_accessor :import_validation_summary
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [ApiValidationSummary]
18
+ attr_accessor :api_validation_summary
19
+
20
+ # TODO: Write general description for this method
21
+ # @return [DocsValidationSummary]
22
+ attr_accessor :docs_validation_summary
23
+
24
+ # A mapping from model property names to API property names.
25
+ def self.names
26
+ @_hash = {} if @_hash.nil?
27
+ @_hash['import_validation_summary'] = 'importValidationSummary'
28
+ @_hash['api_validation_summary'] = 'apiValidationSummary'
29
+ @_hash['docs_validation_summary'] = 'docsValidationSummary'
30
+ @_hash
31
+ end
32
+
33
+ # An array for optional fields
34
+ def self.optionals
35
+ []
36
+ end
37
+
38
+ # An array for nullable fields
39
+ def self.nullables
40
+ []
41
+ end
42
+
43
+ def initialize(import_validation_summary = nil,
44
+ api_validation_summary = nil,
45
+ docs_validation_summary = nil)
46
+ @import_validation_summary = import_validation_summary
47
+ @api_validation_summary = api_validation_summary
48
+ @docs_validation_summary = docs_validation_summary
49
+ end
50
+
51
+ # Creates an instance of the object from a hash.
52
+ def self.from_hash(hash)
53
+ return nil unless hash
54
+
55
+ # Extract variables from the hash.
56
+ if hash['importValidationSummary']
57
+ import_validation_summary = ImportValidationSummary.from_hash(hash['importValidationSummary'])
58
+ end
59
+ api_validation_summary = ApiValidationSummary.from_hash(hash['apiValidationSummary']) if
60
+ hash['apiValidationSummary']
61
+ docs_validation_summary = DocsValidationSummary.from_hash(hash['docsValidationSummary']) if
62
+ hash['docsValidationSummary']
63
+
64
+ # Create object from extracted values.
65
+ MetaData.new(import_validation_summary,
66
+ api_validation_summary,
67
+ docs_validation_summary)
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,165 @@
1
+ # apimatic_api
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module ApimaticApi
7
+ # Parameters are options passed with the endpoint
8
+ class Parameter < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # If parameter is optional
13
+ # @return [TrueClass | FalseClass]
14
+ attr_accessor :optional
15
+
16
+ # Type of Parameter
17
+ # @return [String]
18
+ attr_accessor :type
19
+
20
+ # IF Parameter is constant
21
+ # @return [TrueClass | FalseClass]
22
+ attr_accessor :constant
23
+
24
+ # If Param is collected as array
25
+ # @return [TrueClass | FalseClass]
26
+ attr_accessor :is_array
27
+
28
+ # If Param is collected as array
29
+ # @return [TrueClass | FalseClass]
30
+ attr_accessor :is_stream
31
+
32
+ # If Param is collected as array
33
+ # @return [TrueClass | FalseClass]
34
+ attr_accessor :is_attribute
35
+
36
+ # If Param is collected as array
37
+ # @return [TrueClass | FalseClass]
38
+ attr_accessor :is_map
39
+
40
+ # The structure contain attribute details of a parameter type.
41
+ # @return [Attributes]
42
+ attr_accessor :attributes
43
+
44
+ # If Parameter is nullable
45
+ # @return [TrueClass | FalseClass]
46
+ attr_accessor :nullable
47
+
48
+ # Unique Parameter identifier
49
+ # @return [String]
50
+ attr_accessor :id
51
+
52
+ # Parameter Name
53
+ # @return [String]
54
+ attr_accessor :name
55
+
56
+ # Parameter Description
57
+ # @return [String]
58
+ attr_accessor :description
59
+
60
+ # Default Values of a Parameter
61
+ # @return [String]
62
+ attr_accessor :default_value
63
+
64
+ # Specify Parameter Format
65
+ # @return [String]
66
+ attr_accessor :param_format
67
+
68
+ # A mapping from model property names to API property names.
69
+ def self.names
70
+ @_hash = {} if @_hash.nil?
71
+ @_hash['optional'] = 'optional'
72
+ @_hash['type'] = 'type'
73
+ @_hash['constant'] = 'constant'
74
+ @_hash['is_array'] = 'isArray'
75
+ @_hash['is_stream'] = 'isStream'
76
+ @_hash['is_attribute'] = 'isAttribute'
77
+ @_hash['is_map'] = 'isMap'
78
+ @_hash['attributes'] = 'attributes'
79
+ @_hash['nullable'] = 'nullable'
80
+ @_hash['id'] = 'id'
81
+ @_hash['name'] = 'name'
82
+ @_hash['description'] = 'description'
83
+ @_hash['default_value'] = 'defaultValue'
84
+ @_hash['param_format'] = 'ParamFormat'
85
+ @_hash
86
+ end
87
+
88
+ # An array for optional fields
89
+ def self.optionals
90
+ []
91
+ end
92
+
93
+ # An array for nullable fields
94
+ def self.nullables
95
+ []
96
+ end
97
+
98
+ def initialize(optional = nil,
99
+ type = nil,
100
+ constant = nil,
101
+ is_array = nil,
102
+ is_stream = nil,
103
+ is_attribute = nil,
104
+ is_map = nil,
105
+ attributes = nil,
106
+ nullable = nil,
107
+ id = nil,
108
+ name = nil,
109
+ description = nil,
110
+ default_value = nil,
111
+ param_format = nil)
112
+ @optional = optional
113
+ @type = type
114
+ @constant = constant
115
+ @is_array = is_array
116
+ @is_stream = is_stream
117
+ @is_attribute = is_attribute
118
+ @is_map = is_map
119
+ @attributes = attributes
120
+ @nullable = nullable
121
+ @id = id
122
+ @name = name
123
+ @description = description
124
+ @default_value = default_value
125
+ @param_format = param_format
126
+ end
127
+
128
+ # Creates an instance of the object from a hash.
129
+ def self.from_hash(hash)
130
+ return nil unless hash
131
+
132
+ # Extract variables from the hash.
133
+ optional = hash.key?('optional') ? hash['optional'] : nil
134
+ type = hash.key?('type') ? hash['type'] : nil
135
+ constant = hash.key?('constant') ? hash['constant'] : nil
136
+ is_array = hash.key?('isArray') ? hash['isArray'] : nil
137
+ is_stream = hash.key?('isStream') ? hash['isStream'] : nil
138
+ is_attribute = hash.key?('isAttribute') ? hash['isAttribute'] : nil
139
+ is_map = hash.key?('isMap') ? hash['isMap'] : nil
140
+ attributes = Attributes.from_hash(hash['attributes']) if hash['attributes']
141
+ nullable = hash.key?('nullable') ? hash['nullable'] : nil
142
+ id = hash.key?('id') ? hash['id'] : nil
143
+ name = hash.key?('name') ? hash['name'] : nil
144
+ description = hash.key?('description') ? hash['description'] : nil
145
+ default_value = hash.key?('defaultValue') ? hash['defaultValue'] : nil
146
+ param_format = hash.key?('ParamFormat') ? hash['ParamFormat'] : nil
147
+
148
+ # Create object from extracted values.
149
+ Parameter.new(optional,
150
+ type,
151
+ constant,
152
+ is_array,
153
+ is_stream,
154
+ is_attribute,
155
+ is_map,
156
+ attributes,
157
+ nullable,
158
+ id,
159
+ name,
160
+ description,
161
+ default_value,
162
+ param_format)
163
+ end
164
+ end
165
+ end