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.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +82 -0
- data/lib/apimatic_api/api_helper.rb +10 -0
- data/lib/apimatic_api/client.rb +96 -0
- data/lib/apimatic_api/configuration.rb +125 -0
- data/lib/apimatic_api/controllers/api_validation_external_apis_controller.rb +84 -0
- data/lib/apimatic_api/controllers/api_validation_imported_apis_controller.rb +74 -0
- data/lib/apimatic_api/controllers/apis_management_controller.rb +260 -0
- data/lib/apimatic_api/controllers/base_controller.rb +66 -0
- data/lib/apimatic_api/controllers/code_generation_external_apis_controller.rb +178 -0
- data/lib/apimatic_api/controllers/code_generation_imported_apis_controller.rb +136 -0
- data/lib/apimatic_api/controllers/docs_portal_management_controller.rb +198 -0
- data/lib/apimatic_api/controllers/transformation_controller.rb +174 -0
- data/lib/apimatic_api/exceptions/api_exception.rb +10 -0
- data/lib/apimatic_api/http/auth/custom_header_authentication.rb +42 -0
- data/lib/apimatic_api/http/http_call_back.rb +10 -0
- data/lib/apimatic_api/http/http_method_enum.rb +10 -0
- data/lib/apimatic_api/http/http_request.rb +10 -0
- data/lib/apimatic_api/http/http_response.rb +10 -0
- data/lib/apimatic_api/models/api_entity.rb +220 -0
- data/lib/apimatic_api/models/api_entity_code_generation.rb +131 -0
- data/lib/apimatic_api/models/api_entity_identifier.rb +48 -0
- data/lib/apimatic_api/models/api_validation_summary.rb +75 -0
- data/lib/apimatic_api/models/attributes.rb +48 -0
- data/lib/apimatic_api/models/auth_scope.rb +75 -0
- data/lib/apimatic_api/models/authentication.rb +112 -0
- data/lib/apimatic_api/models/base_model.rb +62 -0
- data/lib/apimatic_api/models/code_gen_settings.rb +541 -0
- data/lib/apimatic_api/models/code_generation.rb +122 -0
- data/lib/apimatic_api/models/docs_validation_summary.rb +75 -0
- data/lib/apimatic_api/models/endpoints_group.rb +57 -0
- data/lib/apimatic_api/models/environment.rb +79 -0
- data/lib/apimatic_api/models/export_formats.rb +60 -0
- data/lib/apimatic_api/models/field.rb +156 -0
- data/lib/apimatic_api/models/generate_on_prem_portal_via_build_input_request_body.rb +48 -0
- data/lib/apimatic_api/models/generate_sdk_via_file_request_body.rb +61 -0
- data/lib/apimatic_api/models/generate_sdk_via_url_request.rb +59 -0
- data/lib/apimatic_api/models/import_api_version_via_url_request.rb +64 -0
- data/lib/apimatic_api/models/import_api_via_file_request_body.rb +51 -0
- data/lib/apimatic_api/models/import_api_via_url_request.rb +49 -0
- data/lib/apimatic_api/models/import_new_api_version_via_file_request_body.rb +66 -0
- data/lib/apimatic_api/models/import_validation_summary.rb +75 -0
- data/lib/apimatic_api/models/inplace_api_import_binary_file.rb +51 -0
- data/lib/apimatic_api/models/inplace_import_api_via_url_request.rb +49 -0
- data/lib/apimatic_api/models/meta_data.rb +70 -0
- data/lib/apimatic_api/models/parameter.rb +165 -0
- data/lib/apimatic_api/models/paramter_format_details.rb +48 -0
- data/lib/apimatic_api/models/platforms.rb +39 -0
- data/lib/apimatic_api/models/platforms_template.rb +49 -0
- data/lib/apimatic_api/models/server.rb +69 -0
- data/lib/apimatic_api/models/server_configuration.rb +105 -0
- data/lib/apimatic_api/models/test_gen_settings.rb +70 -0
- data/lib/apimatic_api/models/transform_via_file_request_body.rb +61 -0
- data/lib/apimatic_api/models/transform_via_url_request.rb +60 -0
- data/lib/apimatic_api/models/transformation.rb +152 -0
- data/lib/apimatic_api/models/user_code_generation.rb +140 -0
- data/lib/apimatic_api/models/user_code_generation_requirements.rb +57 -0
- data/lib/apimatic_api/models/validate_api_via_file_request_body.rb +51 -0
- data/lib/apimatic_api/utilities/date_time_helper.rb +11 -0
- data/lib/apimatic_api/utilities/file_wrapper.rb +16 -0
- data/lib/apimatic_api.rb +86 -0
- data/test/controllers/controller_test_base.rb +29 -0
- data/test/controllers/test_api_validation_external_apis_controller.rb +144 -0
- data/test/controllers/test_api_validation_imported_apis_controller.rb +2971 -0
- data/test/controllers/test_code_generation_external_apis_controller.rb +32 -0
- data/test/controllers/test_docs_portal_management_controller.rb +94 -0
- data/test/controllers/test_transformation_controller.rb +32 -0
- data/test/http_response_catcher.rb +19 -0
- metadata +187 -0
|
@@ -0,0 +1,140 @@
|
|
|
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 by a user.
|
|
10
|
+
class UserCodeGeneration < 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 User Identifier
|
|
48
|
+
# @return [String]
|
|
49
|
+
attr_accessor :user_id
|
|
50
|
+
|
|
51
|
+
# API Specification file in a supported format
|
|
52
|
+
# @return [String]
|
|
53
|
+
attr_accessor :input_file
|
|
54
|
+
|
|
55
|
+
# A mapping from model property names to API property names.
|
|
56
|
+
def self.names
|
|
57
|
+
@_hash = {} if @_hash.nil?
|
|
58
|
+
@_hash['id'] = 'id'
|
|
59
|
+
@_hash['template'] = 'template'
|
|
60
|
+
@_hash['generated_file'] = 'generatedFile'
|
|
61
|
+
@_hash['generated_on'] = 'generatedOn'
|
|
62
|
+
@_hash['hash_code'] = 'hashCode'
|
|
63
|
+
@_hash['code_generation_source'] = 'codeGenerationSource'
|
|
64
|
+
@_hash['code_gen_version'] = 'codeGenVersion'
|
|
65
|
+
@_hash['success'] = 'success'
|
|
66
|
+
@_hash['user_id'] = 'userId'
|
|
67
|
+
@_hash['input_file'] = 'inputFile'
|
|
68
|
+
@_hash
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# An array for optional fields
|
|
72
|
+
def self.optionals
|
|
73
|
+
[]
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# An array for nullable fields
|
|
77
|
+
def self.nullables
|
|
78
|
+
[]
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def initialize(id = nil,
|
|
82
|
+
template = Platforms::CS_NET_STANDARD_LIB,
|
|
83
|
+
generated_file = nil,
|
|
84
|
+
generated_on = nil,
|
|
85
|
+
hash_code = nil,
|
|
86
|
+
code_generation_source = nil,
|
|
87
|
+
code_gen_version = nil,
|
|
88
|
+
success = nil,
|
|
89
|
+
user_id = nil,
|
|
90
|
+
input_file = nil)
|
|
91
|
+
@id = id
|
|
92
|
+
@template = template
|
|
93
|
+
@generated_file = generated_file
|
|
94
|
+
@generated_on = generated_on
|
|
95
|
+
@hash_code = hash_code
|
|
96
|
+
@code_generation_source = code_generation_source
|
|
97
|
+
@code_gen_version = code_gen_version
|
|
98
|
+
@success = success
|
|
99
|
+
@user_id = user_id
|
|
100
|
+
@input_file = input_file
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Creates an instance of the object from a hash.
|
|
104
|
+
def self.from_hash(hash)
|
|
105
|
+
return nil unless hash
|
|
106
|
+
|
|
107
|
+
# Extract variables from the hash.
|
|
108
|
+
id = hash.key?('id') ? hash['id'] : nil
|
|
109
|
+
template = hash['template'] ||= Platforms::CS_NET_STANDARD_LIB
|
|
110
|
+
generated_file = hash.key?('generatedFile') ? hash['generatedFile'] : nil
|
|
111
|
+
generated_on = if hash.key?('generatedOn')
|
|
112
|
+
(DateTimeHelper.from_rfc3339(hash['generatedOn']) if hash['generatedOn'])
|
|
113
|
+
end
|
|
114
|
+
hash_code = hash.key?('hashCode') ? hash['hashCode'] : nil
|
|
115
|
+
code_generation_source =
|
|
116
|
+
hash.key?('codeGenerationSource') ? hash['codeGenerationSource'] : nil
|
|
117
|
+
code_gen_version =
|
|
118
|
+
hash.key?('codeGenVersion') ? hash['codeGenVersion'] : nil
|
|
119
|
+
success = hash.key?('success') ? hash['success'] : nil
|
|
120
|
+
user_id = hash.key?('userId') ? hash['userId'] : nil
|
|
121
|
+
input_file = hash.key?('inputFile') ? hash['inputFile'] : nil
|
|
122
|
+
|
|
123
|
+
# Create object from extracted values.
|
|
124
|
+
UserCodeGeneration.new(id,
|
|
125
|
+
template,
|
|
126
|
+
generated_file,
|
|
127
|
+
generated_on,
|
|
128
|
+
hash_code,
|
|
129
|
+
code_generation_source,
|
|
130
|
+
code_gen_version,
|
|
131
|
+
success,
|
|
132
|
+
user_id,
|
|
133
|
+
input_file)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def to_custom_generated_on
|
|
137
|
+
DateTimeHelper.to_rfc3339(generated_on)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# apimatic_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module ApimaticApi
|
|
7
|
+
# UserCodeGenerationRequirements Model.
|
|
8
|
+
class UserCodeGenerationRequirements < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Unique User Identifier
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :user_id
|
|
15
|
+
|
|
16
|
+
# API Specification file in a supported format
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :input_file
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['user_id'] = 'userId'
|
|
24
|
+
@_hash['input_file'] = 'inputFile'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
[]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for nullable fields
|
|
34
|
+
def self.nullables
|
|
35
|
+
[]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def initialize(user_id = nil,
|
|
39
|
+
input_file = nil)
|
|
40
|
+
@user_id = user_id
|
|
41
|
+
@input_file = input_file
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Creates an instance of the object from a hash.
|
|
45
|
+
def self.from_hash(hash)
|
|
46
|
+
return nil unless hash
|
|
47
|
+
|
|
48
|
+
# Extract variables from the hash.
|
|
49
|
+
user_id = hash.key?('userId') ? hash['userId'] : nil
|
|
50
|
+
input_file = hash.key?('inputFile') ? hash['inputFile'] : nil
|
|
51
|
+
|
|
52
|
+
# Create object from extracted values.
|
|
53
|
+
UserCodeGenerationRequirements.new(user_id,
|
|
54
|
+
input_file)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
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
|
+
# ValidateAPIViaFileRequestBody Model.
|
|
8
|
+
class ValidateAPIViaFileRequestBody < 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
|
+
ValidateAPIViaFileRequestBody.new(file)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
# A utility that supports dateTime conversion to different formats
|
|
9
|
+
class DateTimeHelper < CoreLibrary::DateTimeHelper
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# apimatic_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module ApimaticApi
|
|
7
|
+
# A utility to allow users to set the content-type for files
|
|
8
|
+
class FileWrapper < CoreLibrary::FileWrapper
|
|
9
|
+
# The constructor.
|
|
10
|
+
# @param [File] file The file to be sent in the request.
|
|
11
|
+
# @param [string] content_type The content type of the provided file.
|
|
12
|
+
def initialize(file, content_type: 'application/octet-stream')
|
|
13
|
+
super
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/apimatic_api.rb
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# apimatic_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
require 'date'
|
|
7
|
+
require 'json'
|
|
8
|
+
require 'apimatic_core_interfaces'
|
|
9
|
+
require 'apimatic_core'
|
|
10
|
+
require 'apimatic_faraday_client_adapter'
|
|
11
|
+
|
|
12
|
+
require_relative 'apimatic_api/api_helper'
|
|
13
|
+
require_relative 'apimatic_api/client'
|
|
14
|
+
|
|
15
|
+
# Utilities
|
|
16
|
+
require_relative 'apimatic_api/utilities/file_wrapper'
|
|
17
|
+
require_relative 'apimatic_api/utilities/date_time_helper'
|
|
18
|
+
|
|
19
|
+
# Http
|
|
20
|
+
require_relative 'apimatic_api/http/http_call_back'
|
|
21
|
+
require_relative 'apimatic_api/http/http_method_enum'
|
|
22
|
+
require_relative 'apimatic_api/http/http_request'
|
|
23
|
+
require_relative 'apimatic_api/http/http_response'
|
|
24
|
+
require_relative 'apimatic_api/http/auth/custom_header_authentication'
|
|
25
|
+
|
|
26
|
+
# Models
|
|
27
|
+
require_relative 'apimatic_api/models/base_model'
|
|
28
|
+
require_relative 'apimatic_api/models/api_entity'
|
|
29
|
+
require_relative 'apimatic_api/models/auth_scope'
|
|
30
|
+
require_relative 'apimatic_api/models/authentication'
|
|
31
|
+
require_relative 'apimatic_api/models/endpoints_group'
|
|
32
|
+
require_relative 'apimatic_api/models/api_entity_code_generation'
|
|
33
|
+
require_relative 'apimatic_api/models/server_configuration'
|
|
34
|
+
require_relative 'apimatic_api/models/field'
|
|
35
|
+
require_relative 'apimatic_api/models/server'
|
|
36
|
+
require_relative 'apimatic_api/models/user_code_generation'
|
|
37
|
+
require_relative 'apimatic_api/models/test_gen_settings'
|
|
38
|
+
require_relative 'apimatic_api/models/attributes'
|
|
39
|
+
require_relative 'apimatic_api/models/transformation'
|
|
40
|
+
require_relative 'apimatic_api/models/code_generation'
|
|
41
|
+
require_relative 'apimatic_api/models/environment'
|
|
42
|
+
require_relative 'apimatic_api/models/code_gen_settings'
|
|
43
|
+
require_relative 'apimatic_api/models/meta_data'
|
|
44
|
+
require_relative 'apimatic_api/models/parameter'
|
|
45
|
+
require_relative 'apimatic_api/models/api_validation_summary'
|
|
46
|
+
require_relative 'apimatic_api/models/docs_validation_summary'
|
|
47
|
+
require_relative 'apimatic_api/models/import_validation_summary'
|
|
48
|
+
require_relative 'apimatic_api/models/import_api_version_via_url_request'
|
|
49
|
+
require_relative 'apimatic_api/models/inplace_import_api_via_url_request'
|
|
50
|
+
require_relative 'apimatic_api/models/generate_sdk_via_url_request'
|
|
51
|
+
require_relative 'apimatic_api/models/import_api_via_url_request'
|
|
52
|
+
require_relative 'apimatic_api/models/transform_via_url_request'
|
|
53
|
+
require_relative 'apimatic_api/models/import_api_via_file_request_body'
|
|
54
|
+
require_relative 'apimatic_api/models/' \
|
|
55
|
+
'import_new_api_version_via_file_request_body'
|
|
56
|
+
require_relative 'apimatic_api/models/inplace_api_import_binary_file'
|
|
57
|
+
require_relative 'apimatic_api/models/platforms_template'
|
|
58
|
+
require_relative 'apimatic_api/models/generate_sdk_via_file_request_body'
|
|
59
|
+
require_relative 'apimatic_api/models/transform_via_file_request_body'
|
|
60
|
+
require_relative 'apimatic_api/models/' \
|
|
61
|
+
'generate_on_prem_portal_via_build_input_request_body'
|
|
62
|
+
require_relative 'apimatic_api/models/validate_api_via_file_request_body'
|
|
63
|
+
require_relative 'apimatic_api/models/api_entity_identifier'
|
|
64
|
+
require_relative 'apimatic_api/models/user_code_generation_requirements'
|
|
65
|
+
require_relative 'apimatic_api/models/paramter_format_details'
|
|
66
|
+
require_relative 'apimatic_api/models/export_formats'
|
|
67
|
+
require_relative 'apimatic_api/models/platforms'
|
|
68
|
+
|
|
69
|
+
# Exceptions
|
|
70
|
+
require_relative 'apimatic_api/exceptions/api_exception'
|
|
71
|
+
|
|
72
|
+
require_relative 'apimatic_api/configuration'
|
|
73
|
+
|
|
74
|
+
# Controllers
|
|
75
|
+
require_relative 'apimatic_api/controllers/base_controller'
|
|
76
|
+
require_relative 'apimatic_api/controllers/apis_management_controller'
|
|
77
|
+
require_relative 'apimatic_api/controllers/' \
|
|
78
|
+
'code_generation_imported_apis_controller'
|
|
79
|
+
require_relative 'apimatic_api/controllers/' \
|
|
80
|
+
'code_generation_external_apis_controller'
|
|
81
|
+
require_relative 'apimatic_api/controllers/transformation_controller'
|
|
82
|
+
require_relative 'apimatic_api/controllers/docs_portal_management_controller'
|
|
83
|
+
require_relative 'apimatic_api/controllers/' \
|
|
84
|
+
'api_validation_imported_apis_controller'
|
|
85
|
+
require_relative 'apimatic_api/controllers/' \
|
|
86
|
+
'api_validation_external_apis_controller'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# apimatic_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
require 'json'
|
|
7
|
+
require 'minitest/autorun'
|
|
8
|
+
require 'minitest/hell'
|
|
9
|
+
require 'minitest/pride'
|
|
10
|
+
require 'minitest/proveit'
|
|
11
|
+
require 'apimatic_api'
|
|
12
|
+
require_relative '../http_response_catcher'
|
|
13
|
+
|
|
14
|
+
class ControllerTestBase < Minitest::Test
|
|
15
|
+
parallelize_me!
|
|
16
|
+
include ApimaticApi
|
|
17
|
+
include CoreLibrary
|
|
18
|
+
|
|
19
|
+
# Create configuration and set any test parameters
|
|
20
|
+
def create_configuration
|
|
21
|
+
Configuration.new(http_callback: HttpResponseCatcher.new)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Initializes the base test controller
|
|
25
|
+
def setup_class
|
|
26
|
+
_config = create_configuration
|
|
27
|
+
@client = Client.new(config: _config)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# apimatic_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
require_relative 'controller_test_base'
|
|
7
|
+
|
|
8
|
+
class APIValidationExternalApisControllerTests < ControllerTestBase
|
|
9
|
+
# Called only once for the class before any test has executed
|
|
10
|
+
def setup
|
|
11
|
+
setup_class
|
|
12
|
+
@controller = @client.api_validation_external_apis
|
|
13
|
+
@response_catcher = @controller.http_call_back
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Validate an API by providing the URL of the API specification file.
|
|
17
|
+
#
|
|
18
|
+
#You can also specify [API Metadata](https://docs.apimatic.io/manage-apis/apimatic-metadata) while validating the API using this endpoint. When specifying Metadata, the URL provided will be that of a zip file containing the API specification file and the `APIMATIC-META` json file.
|
|
19
|
+
def test_validate_api_via_url
|
|
20
|
+
# Parameters for the API call
|
|
21
|
+
description_url = 'https://petstore.swagger.io/v2/swagger.json'
|
|
22
|
+
|
|
23
|
+
# Perform the API call through the SDK function
|
|
24
|
+
result = @controller.validate_api_via_url(description_url)
|
|
25
|
+
|
|
26
|
+
# Test response code
|
|
27
|
+
assert_equal(200, @response_catcher.response.status_code)
|
|
28
|
+
|
|
29
|
+
# Test headers
|
|
30
|
+
expected_headers = {}
|
|
31
|
+
expected_headers['content-type'] = 'application/json'
|
|
32
|
+
|
|
33
|
+
assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers))
|
|
34
|
+
|
|
35
|
+
# Test whether the captured response is as we expected
|
|
36
|
+
refute_nil(result)
|
|
37
|
+
expected_body = JSON.parse(
|
|
38
|
+
'{"success":true,"errors":[],"warnings":["Media type <i><code>applicatio'\
|
|
39
|
+
'n/json; charset=utf-8</code></i> content definition of response code <i'\
|
|
40
|
+
'><code>429</code></i> in endpoint <i><code>getRealTimeData</code></i> o'\
|
|
41
|
+
'f group <i><code>data</code></i> contains an example value with followi'\
|
|
42
|
+
'ng undeclared fields: <i><code>detail</i></code>.","Endpoint <i><code>g'\
|
|
43
|
+
'etRealTimeData</code></i> has an example specified for error code <i><c'\
|
|
44
|
+
'ode>429</code></i> which contains following undeclared fields: <i><code'\
|
|
45
|
+
'>detail</i></code>.","Media type <i><code>application/json; charset=utf'\
|
|
46
|
+
'-8</code></i> content definition of response code <i><code>429</code></'\
|
|
47
|
+
'i> in endpoint <i><code>getDataPerCategory</code></i> of group <i><code'\
|
|
48
|
+
'>data</code></i> contains an example value with following undeclared fi'\
|
|
49
|
+
'elds: <i><code>detail</i></code>.","Endpoint <i><code>getDataPerCategor'\
|
|
50
|
+
'y</code></i> has an example specified for error code <i><code>429</code'\
|
|
51
|
+
'></i> which contains following undeclared fields: <i><code>detail</i></'\
|
|
52
|
+
'code>.","Media type <i><code>application/json; charset=utf-8</code></i>'\
|
|
53
|
+
' content definition of response code <i><code>429</code></i> in endpoin'\
|
|
54
|
+
't <i><code>getData</code></i> of group <i><code>data</code></i> contain'\
|
|
55
|
+
's an example value with following undeclared fields: <i><code>detail</i'\
|
|
56
|
+
'></code>.","Endpoint <i><code>getData</code></i> has an example specifi'\
|
|
57
|
+
'ed for error code <i><code>429</code></i> which contains following unde'\
|
|
58
|
+
'clared fields: <i><code>detail</i></code>.","Media type <i><code>applic'\
|
|
59
|
+
'ation/json; charset=utf-8</code></i> content definition of response cod'\
|
|
60
|
+
'e <i><code>429</code></i> in endpoint <i><code>getActiveStatuses</code>'\
|
|
61
|
+
'</i> of group <i><code>statuses</code></i> contains an example value wi'\
|
|
62
|
+
'th following undeclared fields: <i><code>detail</i></code>.","Endpoint '\
|
|
63
|
+
'<i><code>getActiveStatuses</code></i> has an example specified for erro'\
|
|
64
|
+
'r code <i><code>429</code></i> which contains following undeclared fiel'\
|
|
65
|
+
'ds: <i><code>detail</i></code>.","Media type <i><code>application/json;'\
|
|
66
|
+
' charset=utf-8</code></i> content definition of response code <i><code>'\
|
|
67
|
+
'200</code></i> in endpoint <i><code>getDevices</code></i> of group <i><'\
|
|
68
|
+
'code>assets</code></i> contains an example value with following undecla'\
|
|
69
|
+
'red fields: <i><code>deviceModelId</code></i>, <i><code>manufacturer</c'\
|
|
70
|
+
'ode></i>, <i><code>model</i></code>.","Media type <i><code>application/'\
|
|
71
|
+
'json; charset=utf-8</code></i> content definition of response code <i><'\
|
|
72
|
+
'code>429</code></i> in endpoint <i><code>getDevices</code></i> of group'\
|
|
73
|
+
' <i><code>assets</code></i> contains an example value with following un'\
|
|
74
|
+
'declared fields: <i><code>detail</i></code>.","Endpoint <i><code>getDev'\
|
|
75
|
+
'ices</code></i> has an example specified for error code <i><code>429</c'\
|
|
76
|
+
'ode></i> which contains following undeclared fields: <i><code>detail</i'\
|
|
77
|
+
'></code>.","Media type <i><code>application/json; charset=utf-8</code><'\
|
|
78
|
+
'/i> content definition of response code <i><code>429</code></i> in endp'\
|
|
79
|
+
'oint <i><code>getAlarms</code></i> of group <i><code>alerts</code></i> '\
|
|
80
|
+
'contains an example value with following undeclared fields: <i><code>de'\
|
|
81
|
+
'tail</i></code>.","Endpoint <i><code>getAlarms</code></i> has an exampl'\
|
|
82
|
+
'e specified for error code <i><code>429</code></i> which contains follo'\
|
|
83
|
+
'wing undeclared fields: <i><code>detail</i></code>.","Media type <i><co'\
|
|
84
|
+
'de>application/json; charset=utf-8</code></i> content definition of res'\
|
|
85
|
+
'ponse code <i><code>429</code></i> in endpoint <i><code>getActiveAlerts'\
|
|
86
|
+
'</code></i> of group <i><code>alerts</code></i> contains an example val'\
|
|
87
|
+
'ue with following undeclared fields: <i><code>detail</i></code>.","Endp'\
|
|
88
|
+
'oint <i><code>getActiveAlerts</code></i> has an example specified for e'\
|
|
89
|
+
'rror code <i><code>429</code></i> which contains following undeclared f'\
|
|
90
|
+
'ields: <i><code>detail</i></code>.","Media type <i><code>application/js'\
|
|
91
|
+
'on; charset=utf-8</code></i> content definition of response code <i><co'\
|
|
92
|
+
'de>429</code></i> in endpoint <i><code>getAlerts</code></i> of group <i'\
|
|
93
|
+
'><code>alerts</code></i> contains an example value with following undec'\
|
|
94
|
+
'lared fields: <i><code>detail</i></code>.","Endpoint <i><code>getAlerts'\
|
|
95
|
+
'</code></i> has an example specified for error code <i><code>429</code>'\
|
|
96
|
+
'</i> which contains following undeclared fields: <i><code>detail</i></c'\
|
|
97
|
+
'ode>.","Media type <i><code>application/json; charset=utf-8</code></i> '\
|
|
98
|
+
'content definition of response code <i><code>429</code></i> in endpoint'\
|
|
99
|
+
' <i><code>getConfiguration</code></i> of group <i><code>configuration d'\
|
|
100
|
+
'ata</code></i> contains an example value with following undeclared fiel'\
|
|
101
|
+
'ds: <i><code>detail</i></code>.","Endpoint <i><code>getConfiguration</c'\
|
|
102
|
+
'ode></i> has an example specified for error code <i><code>429</code></i'\
|
|
103
|
+
'> which contains following undeclared fields: <i><code>detail</i></code'\
|
|
104
|
+
'>.","Media type <i><code>application/json; charset=utf-8</code></i> con'\
|
|
105
|
+
'tent definition of response code <i><code>429</code></i> in endpoint <i'\
|
|
106
|
+
'><code>getActiveAlarms</code></i> of group <i><code>alerts</code></i> c'\
|
|
107
|
+
'ontains an example value with following undeclared fields: <i><code>det'\
|
|
108
|
+
'ail</i></code>.","Endpoint <i><code>getActiveAlarms</code></i> has an e'\
|
|
109
|
+
'xample specified for error code <i><code>429</code></i> which contains '\
|
|
110
|
+
'following undeclared fields: <i><code>detail</i></code>.","Media type <'\
|
|
111
|
+
'i><code>application/json; charset=utf-8</code></i> content definition o'\
|
|
112
|
+
'f response code <i><code>429</code></i> in endpoint <i><code>getPowerCu'\
|
|
113
|
+
'rves</code></i> of group <i><code>assets</code></i> contains an example'\
|
|
114
|
+
' value with following undeclared fields: <i><code>detail</i></code>.","'\
|
|
115
|
+
'Endpoint <i><code>getPowerCurves</code></i> has an example specified fo'\
|
|
116
|
+
'r error code <i><code>429</code></i> which contains following undeclare'\
|
|
117
|
+
'd fields: <i><code>detail</i></code>.","Media type <i><code>application'\
|
|
118
|
+
'/json; charset=utf-8</code></i> content definition of response code <i>'\
|
|
119
|
+
'<code>429</code></i> in endpoint <i><code>getDataSignals</code></i> of '\
|
|
120
|
+
'group <i><code>data</code></i> contains an example value with following'\
|
|
121
|
+
' undeclared fields: <i><code>detail</i></code>.","Endpoint <i><code>get'\
|
|
122
|
+
'DataSignals</code></i> has an example specified for error code <i><code'\
|
|
123
|
+
'>429</code></i> which contains following undeclared fields: <i><code>de'\
|
|
124
|
+
'tail</i></code>.","Media type <i><code>application/json; charset=utf-8<'\
|
|
125
|
+
'/code></i> content definition of response code <i><code>429</code></i> '\
|
|
126
|
+
'in endpoint <i><code>getStatuses</code></i> of group <i><code>statuses<'\
|
|
127
|
+
'/code></i> contains an example value with following undeclared fields: '\
|
|
128
|
+
'<i><code>detail</i></code>.","Endpoint <i><code>getStatuses</code></i> '\
|
|
129
|
+
'has an example specified for error code <i><code>429</code></i> which c'\
|
|
130
|
+
'ontains following undeclared fields: <i><code>detail</i></code>.","Medi'\
|
|
131
|
+
'a type <i><code>application/json; charset=utf-8</code></i> content defi'\
|
|
132
|
+
'nition of response code <i><code>429</code></i> in endpoint <i><code>ge'\
|
|
133
|
+
'tSites</code></i> of group <i><code>assets</code></i> contains an examp'\
|
|
134
|
+
'le value with following undeclared fields: <i><code>detail</i></code>."'\
|
|
135
|
+
',"Endpoint <i><code>getSites</code></i> has an example specified for er'\
|
|
136
|
+
'ror code <i><code>429</code></i> which contains following undeclared fi'\
|
|
137
|
+
'elds: <i><code>detail</i></code>."],"messages":["One or more elements i'\
|
|
138
|
+
'n the API specification has a missing description field."]}'
|
|
139
|
+
)
|
|
140
|
+
received_body = JSON.parse(@response_catcher.response.raw_body)
|
|
141
|
+
assert(ComparisonHelper.match_body(expected_body, received_body))
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
end
|