automation_test_no_submodules 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +93 -0
- data/README.md +76 -0
- data/Rakefile +10 -0
- data/automation_test_no_submodules.gemspec +39 -0
- data/lib/automation_test_no_submodules/api/greetings_api.rb +92 -0
- data/lib/automation_test_no_submodules/api_client.rb +436 -0
- data/lib/automation_test_no_submodules/api_client_custom.rb +14 -0
- data/lib/automation_test_no_submodules/api_error.rb +53 -0
- data/lib/automation_test_no_submodules/configuration.rb +330 -0
- data/lib/automation_test_no_submodules/models/hello_response.rb +230 -0
- data/lib/automation_test_no_submodules/version.rb +11 -0
- data/lib/automation_test_no_submodules.rb +70 -0
- data/spec/api/greetings_api_spec.rb +39 -0
- data/spec/api_client_spec.rb +191 -0
- data/spec/configuration_spec.rb +38 -0
- data/spec/models/hello_response_spec.rb +34 -0
- data/spec/spec_helper.rb +107 -0
- metadata +128 -0
@@ -0,0 +1,330 @@
|
|
1
|
+
=begin
|
2
|
+
#Test Automation (No submodules)
|
3
|
+
|
4
|
+
#SDKs (no submodules) to test automation workflows.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
=end
|
8
|
+
|
9
|
+
module AutomationTestNoSubmodules
|
10
|
+
class Configuration
|
11
|
+
# Defines url scheme
|
12
|
+
attr_accessor :scheme
|
13
|
+
|
14
|
+
# Defines url host
|
15
|
+
attr_accessor :host
|
16
|
+
|
17
|
+
# Defines url base path
|
18
|
+
attr_accessor :base_path
|
19
|
+
|
20
|
+
# Define server configuration index
|
21
|
+
attr_accessor :server_index
|
22
|
+
|
23
|
+
# Define server operation configuration index
|
24
|
+
attr_accessor :server_operation_index
|
25
|
+
|
26
|
+
# Default server variables
|
27
|
+
attr_accessor :server_variables
|
28
|
+
|
29
|
+
# Default server operation variables
|
30
|
+
attr_accessor :server_operation_variables
|
31
|
+
|
32
|
+
def api_key=(value)
|
33
|
+
@api_key_store['api_key'] = value
|
34
|
+
end
|
35
|
+
|
36
|
+
# Defines API keys used with API Key authentications.
|
37
|
+
#
|
38
|
+
# @return [Hash] key: parameter name, value: parameter value (API key)
|
39
|
+
#
|
40
|
+
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
41
|
+
# config.api_key_store['api_key'] = 'xxx'
|
42
|
+
attr_accessor :api_key_store
|
43
|
+
|
44
|
+
# Defines API key prefixes used with API Key authentications.
|
45
|
+
#
|
46
|
+
# @return [Hash] key: parameter name, value: API key prefix
|
47
|
+
#
|
48
|
+
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
49
|
+
# config.api_key_prefix['api_key'] = 'Token'
|
50
|
+
attr_accessor :api_key_prefix
|
51
|
+
|
52
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
53
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
54
|
+
# Default to false.
|
55
|
+
#
|
56
|
+
# @return [true, false]
|
57
|
+
attr_accessor :debugging
|
58
|
+
|
59
|
+
# Defines the logger used for debugging.
|
60
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
61
|
+
#
|
62
|
+
# @return [#debug]
|
63
|
+
attr_accessor :logger
|
64
|
+
|
65
|
+
# Defines the temporary folder to store downloaded files
|
66
|
+
# (for API endpoints that have file response).
|
67
|
+
# Default to use `Tempfile`.
|
68
|
+
#
|
69
|
+
# @return [String]
|
70
|
+
attr_accessor :temp_folder_path
|
71
|
+
|
72
|
+
# The time limit for HTTP request in seconds.
|
73
|
+
# Default to 0 (never times out).
|
74
|
+
attr_accessor :timeout
|
75
|
+
|
76
|
+
# Set this to false to skip client side validation in the operation.
|
77
|
+
# Default to true.
|
78
|
+
# @return [true, false]
|
79
|
+
attr_accessor :client_side_validation
|
80
|
+
|
81
|
+
### TLS/SSL setting
|
82
|
+
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
83
|
+
# Default to true.
|
84
|
+
#
|
85
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
86
|
+
#
|
87
|
+
# @return [true, false]
|
88
|
+
attr_accessor :ssl_verify
|
89
|
+
|
90
|
+
### TLS/SSL setting
|
91
|
+
# Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
|
92
|
+
#
|
93
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
94
|
+
#
|
95
|
+
attr_accessor :ssl_verify_mode
|
96
|
+
|
97
|
+
### TLS/SSL setting
|
98
|
+
# Set this to customize the certificate file to verify the peer.
|
99
|
+
#
|
100
|
+
# @return [String] the path to the certificate file
|
101
|
+
attr_accessor :ssl_ca_file
|
102
|
+
|
103
|
+
### TLS/SSL setting
|
104
|
+
# Client certificate file (for client certificate)
|
105
|
+
attr_accessor :ssl_client_cert
|
106
|
+
|
107
|
+
### TLS/SSL setting
|
108
|
+
# Client private key file (for client certificate)
|
109
|
+
attr_accessor :ssl_client_key
|
110
|
+
|
111
|
+
### Proxy setting
|
112
|
+
# HTTP Proxy settings
|
113
|
+
attr_accessor :proxy
|
114
|
+
|
115
|
+
# Set this to customize parameters encoder of array parameter.
|
116
|
+
# Default to nil. Faraday uses NestedParamsEncoder when nil.
|
117
|
+
#
|
118
|
+
# @see The params_encoder option of Faraday. Related source code:
|
119
|
+
# https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders
|
120
|
+
attr_accessor :params_encoder
|
121
|
+
|
122
|
+
|
123
|
+
attr_accessor :inject_format
|
124
|
+
|
125
|
+
attr_accessor :force_ending_format
|
126
|
+
|
127
|
+
def initialize
|
128
|
+
@scheme = 'http'
|
129
|
+
@host = 'google.com'
|
130
|
+
@base_path = ''
|
131
|
+
@server_index = 0
|
132
|
+
@server_operation_index = {}
|
133
|
+
@server_variables = {}
|
134
|
+
@server_operation_variables = {}
|
135
|
+
@api_key_store = {}
|
136
|
+
@api_key_prefix = {}
|
137
|
+
@client_side_validation = true
|
138
|
+
@ssl_verify = true
|
139
|
+
@ssl_verify_mode = nil
|
140
|
+
@ssl_ca_file = nil
|
141
|
+
@ssl_client_cert = nil
|
142
|
+
@ssl_client_key = nil
|
143
|
+
@middlewares = Hash.new { |h, k| h[k] = [] }
|
144
|
+
@timeout = 60
|
145
|
+
# return data as binary instead of file
|
146
|
+
@return_binary_data = false
|
147
|
+
@params_encoder = nil
|
148
|
+
@debugging = false
|
149
|
+
@inject_format = false
|
150
|
+
@force_ending_format = false
|
151
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
152
|
+
|
153
|
+
yield(self) if block_given?
|
154
|
+
end
|
155
|
+
|
156
|
+
# The default Configuration object.
|
157
|
+
def self.default
|
158
|
+
@@default ||= Configuration.new
|
159
|
+
end
|
160
|
+
|
161
|
+
def configure
|
162
|
+
yield(self) if block_given?
|
163
|
+
end
|
164
|
+
|
165
|
+
def scheme=(scheme)
|
166
|
+
# remove :// from scheme
|
167
|
+
@scheme = scheme.sub(/:\/\//, '')
|
168
|
+
end
|
169
|
+
|
170
|
+
def host=(host)
|
171
|
+
# remove http(s):// and anything after a slash
|
172
|
+
@host = host.sub(/https?:\/\//, '').split('/').first
|
173
|
+
|
174
|
+
# try to set @scheme and @base_path if possible
|
175
|
+
begin
|
176
|
+
uri = URI.parse(host)
|
177
|
+
@scheme = uri.scheme
|
178
|
+
@base_path = uri.path
|
179
|
+
rescue InvalidURIError
|
180
|
+
end
|
181
|
+
|
182
|
+
# unset server_index so host is used when getting request url (see ApiClient#build_request_url)
|
183
|
+
@server_index = nil
|
184
|
+
end
|
185
|
+
|
186
|
+
def base_path=(base_path)
|
187
|
+
# Add leading and trailing slashes to base_path
|
188
|
+
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
189
|
+
@base_path = '' if @base_path == '/'
|
190
|
+
end
|
191
|
+
|
192
|
+
# Returns base URL for specified operation based on server settings
|
193
|
+
def base_url(operation = nil)
|
194
|
+
index = server_operation_index.fetch(operation, server_index)
|
195
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
|
196
|
+
|
197
|
+
server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
198
|
+
end
|
199
|
+
|
200
|
+
# Gets API key (with prefix if set).
|
201
|
+
# @param [String] param_name the parameter name of API key auth
|
202
|
+
def api_key_with_prefix(param_name, param_alias = nil)
|
203
|
+
value = @api_key_store[param_name]
|
204
|
+
value = @api_key_store.fetch(param_alias, value) unless param_alias.nil?
|
205
|
+
return nil if value.nil?
|
206
|
+
if @api_key_prefix[param_name]
|
207
|
+
"#{@api_key_prefix[param_name]}#{value}"
|
208
|
+
else
|
209
|
+
value
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
# Returns Auth Settings hash for api client.
|
214
|
+
def auth_settings
|
215
|
+
{
|
216
|
+
'api_key' =>
|
217
|
+
{
|
218
|
+
type: 'api_key',
|
219
|
+
in: 'header',
|
220
|
+
key: 'superSecretKey',
|
221
|
+
value: api_key_with_prefix('api_key')
|
222
|
+
},
|
223
|
+
}
|
224
|
+
end
|
225
|
+
|
226
|
+
# Returns an array of Server setting
|
227
|
+
def server_settings
|
228
|
+
[
|
229
|
+
{
|
230
|
+
url: "http://google.com",
|
231
|
+
description: "localhost",
|
232
|
+
}
|
233
|
+
]
|
234
|
+
end
|
235
|
+
|
236
|
+
def operation_server_settings
|
237
|
+
{
|
238
|
+
}
|
239
|
+
end
|
240
|
+
|
241
|
+
# Returns URL based on server settings
|
242
|
+
#
|
243
|
+
# @param index array index of the server settings
|
244
|
+
# @param variables hash of variable and the corresponding value
|
245
|
+
def server_url(index, variables = {}, servers = nil)
|
246
|
+
servers = server_settings if servers == nil
|
247
|
+
|
248
|
+
# check array index out of bound
|
249
|
+
if (index < 0 || index >= servers.size)
|
250
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
251
|
+
end
|
252
|
+
|
253
|
+
server = servers[index]
|
254
|
+
url = server[:url]
|
255
|
+
|
256
|
+
return url unless server.key? :variables
|
257
|
+
|
258
|
+
# go through variable and assign a value
|
259
|
+
server[:variables].each do |name, variable|
|
260
|
+
if variables.key?(name)
|
261
|
+
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
262
|
+
url.gsub! "{" + name.to_s + "}", variables[name]
|
263
|
+
else
|
264
|
+
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
265
|
+
end
|
266
|
+
else
|
267
|
+
# use default value
|
268
|
+
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
url
|
273
|
+
end
|
274
|
+
|
275
|
+
# Adds middleware to the stack
|
276
|
+
def use(*middleware)
|
277
|
+
set_faraday_middleware(:use, *middleware)
|
278
|
+
end
|
279
|
+
|
280
|
+
# Adds request middleware to the stack
|
281
|
+
def request(*middleware)
|
282
|
+
set_faraday_middleware(:request, *middleware)
|
283
|
+
end
|
284
|
+
|
285
|
+
# Adds response middleware to the stack
|
286
|
+
def response(*middleware)
|
287
|
+
set_faraday_middleware(:response, *middleware)
|
288
|
+
end
|
289
|
+
|
290
|
+
# Adds Faraday middleware setting information to the stack
|
291
|
+
#
|
292
|
+
# @example Use the `set_faraday_middleware` method to set middleware information
|
293
|
+
# config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503])
|
294
|
+
# config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug })
|
295
|
+
# config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false)
|
296
|
+
# config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 })
|
297
|
+
# config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger)
|
298
|
+
# config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware)
|
299
|
+
#
|
300
|
+
# @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143
|
301
|
+
def set_faraday_middleware(operation, key, *args, &block)
|
302
|
+
unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation)
|
303
|
+
fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \
|
304
|
+
" :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete."
|
305
|
+
end
|
306
|
+
|
307
|
+
@middlewares[operation] << [key, args, block]
|
308
|
+
end
|
309
|
+
ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true)
|
310
|
+
|
311
|
+
# Set up middleware on the connection
|
312
|
+
def configure_middleware(connection)
|
313
|
+
return if @middlewares.empty?
|
314
|
+
|
315
|
+
[:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation|
|
316
|
+
next unless @middlewares.key?(operation)
|
317
|
+
|
318
|
+
@middlewares[operation].each do |key, args, block|
|
319
|
+
connection.builder.send(operation, key, *args, &block)
|
320
|
+
end
|
321
|
+
end
|
322
|
+
|
323
|
+
if @middlewares.key?(:delete)
|
324
|
+
@middlewares[:delete].each do |key, _args, _block|
|
325
|
+
connection.builder.delete(key)
|
326
|
+
end
|
327
|
+
end
|
328
|
+
end
|
329
|
+
end
|
330
|
+
end
|
@@ -0,0 +1,230 @@
|
|
1
|
+
=begin
|
2
|
+
#Test Automation (No submodules)
|
3
|
+
|
4
|
+
#SDKs (no submodules) to test automation workflows.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
=end
|
8
|
+
|
9
|
+
require 'date'
|
10
|
+
require 'time'
|
11
|
+
|
12
|
+
module AutomationTestNoSubmodules
|
13
|
+
class HelloResponse
|
14
|
+
# The greeting message
|
15
|
+
attr_accessor :message
|
16
|
+
|
17
|
+
attr_accessor :value
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
:'message' => :'message',
|
23
|
+
:'value' => :'value'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'message' => :'String',
|
36
|
+
:'value' => :'Float'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# List of attributes with nullable: true
|
41
|
+
def self.openapi_nullable
|
42
|
+
Set.new([
|
43
|
+
])
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
if (!attributes.is_a?(Hash))
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AutomationTestNoSubmodules::HelloResponse` initialize method"
|
51
|
+
end
|
52
|
+
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AutomationTestNoSubmodules::HelloResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
57
|
+
end
|
58
|
+
h[k.to_sym] = v
|
59
|
+
}
|
60
|
+
|
61
|
+
if attributes.key?(:'message')
|
62
|
+
self.message = attributes[:'message']
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.key?(:'value')
|
66
|
+
self.value = attributes[:'value']
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
+
# @return Array for valid properties with the reasons
|
72
|
+
def list_invalid_properties
|
73
|
+
invalid_properties = Array.new
|
74
|
+
if @message.nil?
|
75
|
+
invalid_properties.push('invalid value for "message", message cannot be nil.')
|
76
|
+
end
|
77
|
+
|
78
|
+
invalid_properties
|
79
|
+
end
|
80
|
+
|
81
|
+
# Check to see if the all the properties in the model are valid
|
82
|
+
# @return true if the model is valid
|
83
|
+
def valid?
|
84
|
+
return false if @message.nil?
|
85
|
+
true
|
86
|
+
end
|
87
|
+
|
88
|
+
# Checks equality by comparing each attribute.
|
89
|
+
# @param [Object] Object to be compared
|
90
|
+
def ==(o)
|
91
|
+
return true if self.equal?(o)
|
92
|
+
self.class == o.class &&
|
93
|
+
message == o.message &&
|
94
|
+
value == o.value
|
95
|
+
end
|
96
|
+
|
97
|
+
# @see the `==` method
|
98
|
+
# @param [Object] Object to be compared
|
99
|
+
def eql?(o)
|
100
|
+
self == o
|
101
|
+
end
|
102
|
+
|
103
|
+
# Calculates hash code according to all attributes.
|
104
|
+
# @return [Integer] Hash code
|
105
|
+
def hash
|
106
|
+
[message, value].hash
|
107
|
+
end
|
108
|
+
|
109
|
+
# Builds the object from hash
|
110
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
111
|
+
# @return [Object] Returns the model itself
|
112
|
+
def self.build_from_hash(attributes)
|
113
|
+
new.build_from_hash(attributes)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Builds the object from hash
|
117
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
118
|
+
# @return [Object] Returns the model itself
|
119
|
+
def build_from_hash(attributes)
|
120
|
+
return nil unless attributes.is_a?(Hash)
|
121
|
+
attributes = attributes.transform_keys(&:to_sym)
|
122
|
+
self.class.openapi_types.each_pair do |key, type|
|
123
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
124
|
+
self.send("#{key}=", nil)
|
125
|
+
elsif type =~ /\AArray<(.*)>/i
|
126
|
+
# check to ensure the input is an array given that the attribute
|
127
|
+
# is documented as an array but the input is not
|
128
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
129
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
130
|
+
end
|
131
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
132
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
self
|
137
|
+
end
|
138
|
+
|
139
|
+
# Deserializes the data based on type
|
140
|
+
# @param string type Data type
|
141
|
+
# @param string value Value to be deserialized
|
142
|
+
# @return [Object] Deserialized data
|
143
|
+
def _deserialize(type, value)
|
144
|
+
case type.to_sym
|
145
|
+
when :Time
|
146
|
+
Time.parse(value)
|
147
|
+
when :Date
|
148
|
+
Date.parse(value)
|
149
|
+
when :String
|
150
|
+
value.to_s
|
151
|
+
when :Integer
|
152
|
+
value.to_i
|
153
|
+
when :Float
|
154
|
+
value.to_f
|
155
|
+
when :Boolean
|
156
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
157
|
+
true
|
158
|
+
else
|
159
|
+
false
|
160
|
+
end
|
161
|
+
when :Object
|
162
|
+
# generic object (usually a Hash), return directly
|
163
|
+
value
|
164
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
165
|
+
inner_type = Regexp.last_match[:inner_type]
|
166
|
+
value.map { |v| _deserialize(inner_type, v) }
|
167
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
168
|
+
k_type = Regexp.last_match[:k_type]
|
169
|
+
v_type = Regexp.last_match[:v_type]
|
170
|
+
{}.tap do |hash|
|
171
|
+
value.each do |k, v|
|
172
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
else # model
|
176
|
+
# models (e.g. Pet) or oneOf
|
177
|
+
klass = AutomationTestNoSubmodules.const_get(type)
|
178
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the string representation of the object
|
183
|
+
# @return [String] String presentation of the object
|
184
|
+
def to_s
|
185
|
+
to_hash.to_s
|
186
|
+
end
|
187
|
+
|
188
|
+
# to_body is an alias to to_hash (backward compatibility)
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
190
|
+
def to_body
|
191
|
+
to_hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Returns the object in the form of hash
|
195
|
+
# @return [Hash] Returns the object in the form of hash
|
196
|
+
def to_hash
|
197
|
+
hash = {}
|
198
|
+
self.class.attribute_map.each_pair do |attr, param|
|
199
|
+
value = self.send(attr)
|
200
|
+
if value.nil?
|
201
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
202
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
203
|
+
end
|
204
|
+
|
205
|
+
hash[param] = _to_hash(value)
|
206
|
+
end
|
207
|
+
hash
|
208
|
+
end
|
209
|
+
|
210
|
+
# Outputs non-array value in the form of hash
|
211
|
+
# For object, use to_hash. Otherwise, just return the value
|
212
|
+
# @param [Object] value Any valid value
|
213
|
+
# @return [Hash] Returns the value in the form of hash
|
214
|
+
def _to_hash(value)
|
215
|
+
if value.is_a?(Array)
|
216
|
+
value.compact.map { |v| _to_hash(v) }
|
217
|
+
elsif value.is_a?(Hash)
|
218
|
+
{}.tap do |hash|
|
219
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
220
|
+
end
|
221
|
+
elsif value.respond_to? :to_hash
|
222
|
+
value.to_hash
|
223
|
+
else
|
224
|
+
value
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
end
|
229
|
+
|
230
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
=begin
|
2
|
+
#Test Automation (No submodules)
|
3
|
+
|
4
|
+
#SDKs (no submodules) to test automation workflows.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
=end
|
8
|
+
|
9
|
+
require 'forwardable'
|
10
|
+
|
11
|
+
# Common files
|
12
|
+
require 'automation_test_no_submodules/api_client'
|
13
|
+
require 'automation_test_no_submodules/api_error'
|
14
|
+
require 'automation_test_no_submodules/version'
|
15
|
+
require 'automation_test_no_submodules/configuration'
|
16
|
+
|
17
|
+
# Models
|
18
|
+
require 'automation_test_no_submodules/models/hello_response'
|
19
|
+
|
20
|
+
# APIs
|
21
|
+
require 'automation_test_no_submodules/api/greetings_api'
|
22
|
+
|
23
|
+
module AutomationTestNoSubmodules
|
24
|
+
@config = Configuration.default
|
25
|
+
SENTINEL = Object.new
|
26
|
+
class << self
|
27
|
+
|
28
|
+
private def is_sentinel(value)
|
29
|
+
value == SENTINEL
|
30
|
+
end
|
31
|
+
|
32
|
+
def host
|
33
|
+
@config.host
|
34
|
+
end
|
35
|
+
|
36
|
+
def host=(value)
|
37
|
+
@config.host = value
|
38
|
+
end
|
39
|
+
# api key from OpenAPI spec
|
40
|
+
def api_key
|
41
|
+
@config.api_key
|
42
|
+
end
|
43
|
+
|
44
|
+
def api_key=(value)
|
45
|
+
@config.api_key = value
|
46
|
+
end
|
47
|
+
|
48
|
+
# Customize default settings for the SDK using block.
|
49
|
+
# AutomationTestNoSubmodules.configure do |config|
|
50
|
+
# config.host = "http://example.com"
|
51
|
+
# end
|
52
|
+
# If no block given, return the default Configuration object.
|
53
|
+
def configure
|
54
|
+
if block_given?
|
55
|
+
yield(Configuration.default)
|
56
|
+
else
|
57
|
+
Configuration.default
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
class Client
|
63
|
+
attr_reader :greetings
|
64
|
+
|
65
|
+
def initialize(config = Configuration.default)
|
66
|
+
@api_client = ApiClient::new(config)
|
67
|
+
@greetings = AutomationTestNoSubmodules::GreetingsApi.new(@api_client)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
=begin
|
2
|
+
#Test Automation (No submodules)
|
3
|
+
|
4
|
+
#SDKs (no submodules) to test automation workflows.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
=end
|
8
|
+
|
9
|
+
require 'spec_helper'
|
10
|
+
require 'json'
|
11
|
+
|
12
|
+
# Unit tests for AutomationTestNoSubmodules::GreetingsApi
|
13
|
+
describe 'GreetingsApi' do
|
14
|
+
before do
|
15
|
+
# run before each test
|
16
|
+
@api_instance = AutomationTestNoSubmodules::GreetingsApi.new
|
17
|
+
end
|
18
|
+
|
19
|
+
after do
|
20
|
+
# run after each test
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'test an instance of GreetingsApi' do
|
24
|
+
it 'should create an instance of GreetingsApi' do
|
25
|
+
expect(@api_instance).to be_instance_of(AutomationTestNoSubmodules::GreetingsApi)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# unit tests for hello
|
30
|
+
# Get a simple greeting
|
31
|
+
# @param [Hash] opts the optional parameters
|
32
|
+
# @return [HelloResponse]
|
33
|
+
describe 'hello test' do
|
34
|
+
it 'should work' do
|
35
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|