wesley-key-sdk 3.0.7 → 4.2.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 +4 -4
- data/README.md +168 -131
- data/bin/console +4 -4
- data/lib/swagger_petstore_open_api30/api_helper.rb +10 -0
- data/lib/{cypress_test_api/controllers/base_controller.rb → swagger_petstore_open_api30/apis/base_api.rb} +17 -10
- data/lib/swagger_petstore_open_api30/apis/pet_api.rb +287 -0
- data/lib/swagger_petstore_open_api30/apis/store_api.rb +131 -0
- data/lib/swagger_petstore_open_api30/apis/user_api.rb +233 -0
- data/lib/swagger_petstore_open_api30/client.rb +95 -0
- data/lib/{cypress_test_api → swagger_petstore_open_api30}/configuration.rb +72 -47
- data/lib/{cypress_test_api → swagger_petstore_open_api30}/exceptions/api_exception.rb +4 -4
- data/lib/swagger_petstore_open_api30/exceptions/oauth_provider_exception.rb +64 -0
- data/lib/swagger_petstore_open_api30/http/api_response.rb +19 -0
- data/lib/swagger_petstore_open_api30/http/auth/api_key.rb +52 -0
- data/lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb +112 -0
- data/lib/swagger_petstore_open_api30/http/http_call_back.rb +10 -0
- data/lib/swagger_petstore_open_api30/http/http_method_enum.rb +10 -0
- data/lib/swagger_petstore_open_api30/http/http_request.rb +10 -0
- data/lib/swagger_petstore_open_api30/http/http_response.rb +10 -0
- data/lib/{cypress_test_api → swagger_petstore_open_api30}/http/proxy_settings.rb +4 -4
- data/lib/swagger_petstore_open_api30/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/swagger_petstore_open_api30/logging/sdk_logger.rb +17 -0
- data/lib/swagger_petstore_open_api30/models/api_response.rb +118 -0
- data/lib/{cypress_test_api → swagger_petstore_open_api30}/models/base_model.rb +4 -4
- data/lib/swagger_petstore_open_api30/models/category.rb +105 -0
- data/lib/swagger_petstore_open_api30/models/oauth_provider_error.rb +62 -0
- data/lib/swagger_petstore_open_api30/models/oauth_scope_petstore_auth.rb +36 -0
- data/lib/swagger_petstore_open_api30/models/oauth_token.rb +125 -0
- data/lib/swagger_petstore_open_api30/models/order.rb +167 -0
- data/lib/swagger_petstore_open_api30/models/order_status.rb +40 -0
- data/lib/swagger_petstore_open_api30/models/pet.rb +168 -0
- data/lib/swagger_petstore_open_api30/models/pet_status.rb +40 -0
- data/lib/swagger_petstore_open_api30/models/tag.rb +105 -0
- data/lib/swagger_petstore_open_api30/models/user.rb +182 -0
- data/lib/swagger_petstore_open_api30/utilities/date_time_helper.rb +11 -0
- data/lib/{cypress_test_api → swagger_petstore_open_api30}/utilities/file_wrapper.rb +4 -4
- data/lib/swagger_petstore_open_api30/utilities/xml_utilities.rb +12 -0
- data/lib/swagger_petstore_open_api30.rb +62 -0
- metadata +37 -64
- data/lib/cypress_test_api/api_helper.rb +0 -10
- data/lib/cypress_test_api/client.rb +0 -58
- data/lib/cypress_test_api/controllers/api_controller.rb +0 -102
- data/lib/cypress_test_api/http/http_call_back.rb +0 -10
- data/lib/cypress_test_api/http/http_method_enum.rb +0 -10
- data/lib/cypress_test_api/http/http_request.rb +0 -10
- data/lib/cypress_test_api/http/http_response.rb +0 -10
- data/lib/cypress_test_api/models/custom_enum.rb +0 -40
- data/lib/cypress_test_api/models/deer.rb +0 -68
- data/lib/cypress_test_api/models/item.rb +0 -166
- data/lib/cypress_test_api/models/item_response.rb +0 -80
- data/lib/cypress_test_api/models/lion.rb +0 -68
- data/lib/cypress_test_api/models/message.rb +0 -68
- data/lib/cypress_test_api/models/message2.rb +0 -71
- data/lib/cypress_test_api/models/multiple_arrays_request.rb +0 -70
- data/lib/cypress_test_api/models/nac_tag.rb +0 -265
- data/lib/cypress_test_api/models/o_auth_scope_o_auth_acg_enum.rb +0 -44
- data/lib/cypress_test_api/models/response_http400.rb +0 -62
- data/lib/cypress_test_api/models/response_http404.rb +0 -62
- data/lib/cypress_test_api/models/status11_enum.rb +0 -40
- data/lib/cypress_test_api/models/status1_enum.rb +0 -40
- data/lib/cypress_test_api/models/status_enum.rb +0 -40
- data/lib/cypress_test_api/models/tokens_request.rb +0 -60
- data/lib/cypress_test_api/utilities/date_time_helper.rb +0 -11
- data/lib/cypress_test_api.rb +0 -55
- data/test/controllers/controller_test_base.rb +0 -23
- data/test/controllers/test_api_controller.rb +0 -40
- data/test/http_response_catcher.rb +0 -19
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
|
+
# Initializes a new instance of RequestLoggingConfiguration.
|
|
8
|
+
class RequestLoggingConfiguration < CoreLibrary::ApiRequestLoggingConfiguration
|
|
9
|
+
# @param log_body [Boolean] Indicates whether the message body should be logged. Default is false.
|
|
10
|
+
# @param log_headers [Boolean] Indicates whether the message headers should be logged. Default is false.
|
|
11
|
+
# @param headers_to_exclude [Array<String>] Array of headers not displayed in logging. Default is an empty array.
|
|
12
|
+
# @param headers_to_include [Array<String>] Array of headers to be displayed in logging. Default is an empty array.
|
|
13
|
+
# @param headers_to_unmask [Array<String>] Array of headers which values are non-sensitive to display in logging.
|
|
14
|
+
# Default is an empty array.
|
|
15
|
+
def initialize(log_body: false, log_headers: false, headers_to_include: nil,
|
|
16
|
+
headers_to_exclude: nil, headers_to_unmask: nil,
|
|
17
|
+
include_query_in_path: false)
|
|
18
|
+
super(
|
|
19
|
+
log_body,
|
|
20
|
+
log_headers,
|
|
21
|
+
headers_to_exclude,
|
|
22
|
+
headers_to_include,
|
|
23
|
+
headers_to_unmask,
|
|
24
|
+
include_query_in_path
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
|
|
29
|
+
headers_to_exclude: nil, headers_to_unmask: nil, include_query_in_path: nil)
|
|
30
|
+
log_body ||= self.log_body
|
|
31
|
+
log_headers ||= self.log_headers
|
|
32
|
+
headers_to_include ||= self.headers_to_include
|
|
33
|
+
headers_to_exclude ||= self.headers_to_exclude
|
|
34
|
+
headers_to_unmask ||= self.headers_to_unmask
|
|
35
|
+
include_query_in_path ||= self.include_query_in_path
|
|
36
|
+
|
|
37
|
+
RequestLoggingConfiguration.new(
|
|
38
|
+
log_body: log_body,
|
|
39
|
+
log_headers: log_headers,
|
|
40
|
+
headers_to_include: headers_to_include,
|
|
41
|
+
headers_to_exclude: headers_to_exclude,
|
|
42
|
+
headers_to_unmask: headers_to_unmask,
|
|
43
|
+
include_query_in_path: include_query_in_path
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def self.from_env
|
|
48
|
+
log_body = ENV['REQUEST_LOG_BODY']
|
|
49
|
+
log_headers = ENV['REQUEST_LOG_HEADERS']
|
|
50
|
+
headers_to_include = ENV['REQUEST_HEADERS_TO_INCLUDE']
|
|
51
|
+
headers_to_exclude = ENV['REQUEST_HEADERS_TO_EXCLUDE']
|
|
52
|
+
headers_to_unmask = ENV['REQUEST_HEADERS_TO_UNMASK']
|
|
53
|
+
include_query_in_path = ENV['REQUEST_INCLUDE_QUERY_IN_PATH']
|
|
54
|
+
|
|
55
|
+
new(
|
|
56
|
+
log_body: log_body,
|
|
57
|
+
log_headers: log_headers,
|
|
58
|
+
headers_to_include: headers_to_include,
|
|
59
|
+
headers_to_exclude: headers_to_exclude,
|
|
60
|
+
headers_to_unmask: headers_to_unmask,
|
|
61
|
+
include_query_in_path: include_query_in_path
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def self.any_logging_configured?
|
|
66
|
+
%w[
|
|
67
|
+
REQUEST_LOG_BODY
|
|
68
|
+
REQUEST_LOG_HEADERS
|
|
69
|
+
REQUEST_HEADERS_TO_INCLUDE
|
|
70
|
+
REQUEST_HEADERS_TO_EXCLUDE
|
|
71
|
+
REQUEST_HEADERS_TO_UNMASK
|
|
72
|
+
REQUEST_INCLUDE_QUERY_IN_PATH
|
|
73
|
+
].any? { |key| ENV.key?(key) && !ENV[key].nil? && !ENV[key].empty? }
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Initializes a new instance of ResponseLoggingConfiguration.
|
|
78
|
+
class ResponseLoggingConfiguration < CoreLibrary::ApiResponseLoggingConfiguration
|
|
79
|
+
def initialize(log_body: false, log_headers: false, headers_to_include: nil,
|
|
80
|
+
headers_to_exclude: nil, headers_to_unmask: nil)
|
|
81
|
+
super(
|
|
82
|
+
log_body,
|
|
83
|
+
log_headers,
|
|
84
|
+
headers_to_exclude,
|
|
85
|
+
headers_to_include,
|
|
86
|
+
headers_to_unmask
|
|
87
|
+
)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
|
|
91
|
+
headers_to_exclude: nil, headers_to_unmask: nil)
|
|
92
|
+
log_body ||= self.log_body
|
|
93
|
+
log_headers ||= self.log_headers
|
|
94
|
+
headers_to_include ||= self.headers_to_include
|
|
95
|
+
headers_to_exclude ||= self.headers_to_exclude
|
|
96
|
+
headers_to_unmask ||= self.headers_to_unmask
|
|
97
|
+
|
|
98
|
+
ResponseLoggingConfiguration.new(
|
|
99
|
+
log_body: log_body,
|
|
100
|
+
log_headers: log_headers,
|
|
101
|
+
headers_to_include: headers_to_include,
|
|
102
|
+
headers_to_exclude: headers_to_exclude,
|
|
103
|
+
headers_to_unmask: headers_to_unmask
|
|
104
|
+
)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def self.from_env
|
|
108
|
+
log_body = ENV['RESPONSE_LOG_BODY']
|
|
109
|
+
log_headers = ENV['RESPONSE_LOG_HEADERS']
|
|
110
|
+
headers_to_include = ENV['RESPONSE_HEADERS_TO_INCLUDE']
|
|
111
|
+
headers_to_exclude = ENV['RESPONSE_HEADERS_TO_EXCLUDE']
|
|
112
|
+
headers_to_unmask = ENV['RESPONSE_HEADERS_TO_UNMASK']
|
|
113
|
+
|
|
114
|
+
new(
|
|
115
|
+
log_body: log_body,
|
|
116
|
+
log_headers: log_headers,
|
|
117
|
+
headers_to_include: headers_to_include,
|
|
118
|
+
headers_to_exclude: headers_to_exclude,
|
|
119
|
+
headers_to_unmask: headers_to_unmask
|
|
120
|
+
)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def self.any_logging_configured?
|
|
124
|
+
%w[
|
|
125
|
+
RESPONSE_LOG_BODY
|
|
126
|
+
RESPONSE_LOG_HEADERS
|
|
127
|
+
RESPONSE_HEADERS_TO_INCLUDE
|
|
128
|
+
RESPONSE_HEADERS_TO_EXCLUDE
|
|
129
|
+
RESPONSE_HEADERS_TO_UNMASK
|
|
130
|
+
].any? { |key| ENV.key?(key) && !ENV[key].nil? && !ENV[key].empty? }
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Initializes a new instance of LoggingConfiguration.
|
|
135
|
+
class LoggingConfiguration < CoreLibrary::ApiLoggingConfiguration
|
|
136
|
+
def initialize(logger: nil, log_level: nil, mask_sensitive_headers: true,
|
|
137
|
+
request_logging_config: nil,
|
|
138
|
+
response_logging_config: nil)
|
|
139
|
+
request_logging_config ||= RequestLoggingConfiguration.new
|
|
140
|
+
response_logging_config ||= ResponseLoggingConfiguration.new
|
|
141
|
+
super(
|
|
142
|
+
logger,
|
|
143
|
+
log_level,
|
|
144
|
+
request_logging_config,
|
|
145
|
+
response_logging_config,
|
|
146
|
+
mask_sensitive_headers
|
|
147
|
+
)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def clone_with(logger: nil, log_level: nil, mask_sensitive_headers: nil,
|
|
151
|
+
request_logging_config: nil, response_logging_config: nil)
|
|
152
|
+
logger ||= self.logger
|
|
153
|
+
log_level ||= self.log_level
|
|
154
|
+
mask_sensitive_headers ||= self.mask_sensitive_headers
|
|
155
|
+
request_logging_config ||= self.request_logging_config.clone
|
|
156
|
+
response_logging_config ||= self.response_logging_config.clone
|
|
157
|
+
|
|
158
|
+
LoggingConfiguration.new(
|
|
159
|
+
logger: logger,
|
|
160
|
+
log_level: log_level,
|
|
161
|
+
mask_sensitive_headers: mask_sensitive_headers,
|
|
162
|
+
request_logging_config: request_logging_config,
|
|
163
|
+
response_logging_config: response_logging_config
|
|
164
|
+
)
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
def self.from_env
|
|
168
|
+
log_level = ENV['LOG_LEVEL']
|
|
169
|
+
mask_sensitive_headers = ENV['MASK_SENSITIVE_HEADERS']
|
|
170
|
+
|
|
171
|
+
new(
|
|
172
|
+
log_level: log_level,
|
|
173
|
+
mask_sensitive_headers: mask_sensitive_headers,
|
|
174
|
+
request_logging_config: RequestLoggingConfiguration.from_env,
|
|
175
|
+
response_logging_config: ResponseLoggingConfiguration.from_env
|
|
176
|
+
)
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def self.any_logging_configured?
|
|
180
|
+
RequestLoggingConfiguration.any_logging_configured? ||
|
|
181
|
+
ResponseLoggingConfiguration.any_logging_configured? ||
|
|
182
|
+
ENV.key?('LOG_LEVEL') ||
|
|
183
|
+
ENV.key?('MASK_SENSITIVE_HEADERS')
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
|
+
# Represents the generic logger facade
|
|
8
|
+
class AbstractLogger < Logger
|
|
9
|
+
# Logs a message with a specified log level and additional parameters.
|
|
10
|
+
# @param level [Symbol] The log level of the message.
|
|
11
|
+
# @param message [String] The message to log.
|
|
12
|
+
# @param params [Hash] Additional parameters to include in the log message.
|
|
13
|
+
def log(level, message, params)
|
|
14
|
+
raise NotImplementedError, 'This method needs to be implemented in a child class.'
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
|
+
# ApiResponse Model.
|
|
8
|
+
class ApiResponse < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [Integer]
|
|
14
|
+
attr_accessor :code
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :type
|
|
19
|
+
|
|
20
|
+
# TODO: Write general description for this method
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :message
|
|
23
|
+
|
|
24
|
+
# A mapping from model property names to API property names.
|
|
25
|
+
def self.names
|
|
26
|
+
@_hash = {} if @_hash.nil?
|
|
27
|
+
@_hash['code'] = 'code'
|
|
28
|
+
@_hash['type'] = 'type'
|
|
29
|
+
@_hash['message'] = 'message'
|
|
30
|
+
@_hash
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for optional fields
|
|
34
|
+
def self.optionals
|
|
35
|
+
%w[
|
|
36
|
+
code
|
|
37
|
+
type
|
|
38
|
+
message
|
|
39
|
+
]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# An array for nullable fields
|
|
43
|
+
def self.nullables
|
|
44
|
+
[]
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def initialize(code: SKIP, type: SKIP, message: SKIP,
|
|
48
|
+
additional_properties: nil)
|
|
49
|
+
# Add additional model properties to the instance
|
|
50
|
+
additional_properties = {} if additional_properties.nil?
|
|
51
|
+
|
|
52
|
+
@code = code unless code == SKIP
|
|
53
|
+
@type = type unless type == SKIP
|
|
54
|
+
@message = message unless message == SKIP
|
|
55
|
+
@additional_properties = additional_properties
|
|
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
|
+
code = hash.key?('code') ? hash['code'] : SKIP
|
|
64
|
+
type = hash.key?('type') ? hash['type'] : SKIP
|
|
65
|
+
message = hash.key?('message') ? hash['message'] : SKIP
|
|
66
|
+
|
|
67
|
+
# Create a new hash for additional properties, removing known properties.
|
|
68
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
69
|
+
|
|
70
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
71
|
+
new_hash, proc { |value| value }
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# Create object from extracted values.
|
|
75
|
+
ApiResponse.new(code: code,
|
|
76
|
+
type: type,
|
|
77
|
+
message: message,
|
|
78
|
+
additional_properties: additional_properties)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def self.from_element(root)
|
|
82
|
+
code = XmlUtilities.from_element(root, 'code', Integer)
|
|
83
|
+
type = XmlUtilities.from_element(root, 'type', String)
|
|
84
|
+
message = XmlUtilities.from_element(root, 'message', String)
|
|
85
|
+
|
|
86
|
+
new(code: code,
|
|
87
|
+
type: type,
|
|
88
|
+
message: message,
|
|
89
|
+
additional_properties: additional_properties)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def to_xml_element(doc, root_name)
|
|
93
|
+
root = doc.create_element(root_name)
|
|
94
|
+
|
|
95
|
+
XmlUtilities.add_as_subelement(doc, root, 'code', code)
|
|
96
|
+
XmlUtilities.add_as_subelement(doc, root, 'type', type)
|
|
97
|
+
XmlUtilities.add_as_subelement(doc, root, 'message', message)
|
|
98
|
+
XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
|
|
99
|
+
additional_properties)
|
|
100
|
+
|
|
101
|
+
root
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Provides a human-readable string representation of the object.
|
|
105
|
+
def to_s
|
|
106
|
+
class_name = self.class.name.split('::').last
|
|
107
|
+
"<#{class_name} code: #{@code}, type: #{@type}, message: #{@message},"\
|
|
108
|
+
" additional_properties: #{@additional_properties}>"
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
112
|
+
def inspect
|
|
113
|
+
class_name = self.class.name.split('::').last
|
|
114
|
+
"<#{class_name} code: #{@code.inspect}, type: #{@type.inspect}, message:"\
|
|
115
|
+
" #{@message.inspect}, additional_properties: #{@additional_properties}>"
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
2
|
#
|
|
3
|
-
# This file was automatically generated by
|
|
4
|
-
# ( https://www.apimatic.io ).
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
7
|
# Base model.
|
|
8
8
|
# rubocop:disable all
|
|
9
9
|
class BaseModel < CoreLibrary::BaseModel
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
|
+
# Category Model.
|
|
8
|
+
class Category < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [Integer]
|
|
14
|
+
attr_accessor :id
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :name
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['id'] = 'id'
|
|
24
|
+
@_hash['name'] = 'name'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
%w[
|
|
31
|
+
id
|
|
32
|
+
name
|
|
33
|
+
]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# An array for nullable fields
|
|
37
|
+
def self.nullables
|
|
38
|
+
[]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def initialize(id: SKIP, name: SKIP, additional_properties: nil)
|
|
42
|
+
# Add additional model properties to the instance
|
|
43
|
+
additional_properties = {} if additional_properties.nil?
|
|
44
|
+
|
|
45
|
+
@id = id unless id == SKIP
|
|
46
|
+
@name = name unless name == SKIP
|
|
47
|
+
@additional_properties = additional_properties
|
|
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
|
+
id = hash.key?('id') ? hash['id'] : SKIP
|
|
56
|
+
name = hash.key?('name') ? hash['name'] : SKIP
|
|
57
|
+
|
|
58
|
+
# Create a new hash for additional properties, removing known properties.
|
|
59
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
60
|
+
|
|
61
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
62
|
+
new_hash, proc { |value| value }
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# Create object from extracted values.
|
|
66
|
+
Category.new(id: id,
|
|
67
|
+
name: name,
|
|
68
|
+
additional_properties: additional_properties)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def self.from_element(root)
|
|
72
|
+
id = XmlUtilities.from_element(root, 'id', Integer)
|
|
73
|
+
name = XmlUtilities.from_element(root, 'name', String)
|
|
74
|
+
|
|
75
|
+
new(id: id,
|
|
76
|
+
name: name,
|
|
77
|
+
additional_properties: additional_properties)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def to_xml_element(doc, root_name)
|
|
81
|
+
root = doc.create_element(root_name)
|
|
82
|
+
|
|
83
|
+
XmlUtilities.add_as_subelement(doc, root, 'id', id)
|
|
84
|
+
XmlUtilities.add_as_subelement(doc, root, 'name', name)
|
|
85
|
+
XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
|
|
86
|
+
additional_properties)
|
|
87
|
+
|
|
88
|
+
root
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Provides a human-readable string representation of the object.
|
|
92
|
+
def to_s
|
|
93
|
+
class_name = self.class.name.split('::').last
|
|
94
|
+
"<#{class_name} id: #{@id}, name: #{@name}, additional_properties:"\
|
|
95
|
+
" #{@additional_properties}>"
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
99
|
+
def inspect
|
|
100
|
+
class_name = self.class.name.split('::').last
|
|
101
|
+
"<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, additional_properties:"\
|
|
102
|
+
" #{@additional_properties}>"
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
|
+
# OAuth 2 Authorization error codes
|
|
8
|
+
class OauthProviderError
|
|
9
|
+
OAUTH_PROVIDER_ERROR = [
|
|
10
|
+
# The request is missing a required parameter, includes an unsupported
|
|
11
|
+
# parameter value (other than grant type), repeats a parameter, includes
|
|
12
|
+
# multiple credentials, utilizes more than one mechanism for
|
|
13
|
+
# authenticating the client, or is otherwise malformed.
|
|
14
|
+
INVALID_REQUEST = 'invalid_request'.freeze,
|
|
15
|
+
|
|
16
|
+
# Client authentication failed (e.g., unknown client, no client
|
|
17
|
+
# authentication included, or unsupported authentication method).
|
|
18
|
+
INVALID_CLIENT = 'invalid_client'.freeze,
|
|
19
|
+
|
|
20
|
+
# The provided authorization grant (e.g., authorization code, resource
|
|
21
|
+
# owner credentials) or refresh token is invalid, expired, revoked, does
|
|
22
|
+
# not match the redirection URI used in the authorization request, or was
|
|
23
|
+
# issued to another client.
|
|
24
|
+
INVALID_GRANT = 'invalid_grant'.freeze,
|
|
25
|
+
|
|
26
|
+
# The authenticated client is not authorized to use this authorization
|
|
27
|
+
# grant type.
|
|
28
|
+
UNAUTHORIZED_CLIENT = 'unauthorized_client'.freeze,
|
|
29
|
+
|
|
30
|
+
# The authorization grant type is not supported by the authorization
|
|
31
|
+
# server.
|
|
32
|
+
UNSUPPORTED_GRANT_TYPE = 'unsupported_grant_type'.freeze,
|
|
33
|
+
|
|
34
|
+
# The requested scope is invalid, unknown, malformed, or exceeds the scope
|
|
35
|
+
# granted by the resource owner.
|
|
36
|
+
INVALID_SCOPE = 'invalid_scope'.freeze
|
|
37
|
+
].freeze
|
|
38
|
+
|
|
39
|
+
def self.validate(value)
|
|
40
|
+
return false if value.nil?
|
|
41
|
+
|
|
42
|
+
OAUTH_PROVIDER_ERROR.include?(value)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def self.from_value(value, default_value = INVALID_REQUEST)
|
|
46
|
+
return default_value if value.nil?
|
|
47
|
+
|
|
48
|
+
str = value.to_s.strip
|
|
49
|
+
|
|
50
|
+
case str.downcase
|
|
51
|
+
when 'invalid_request' then INVALID_REQUEST
|
|
52
|
+
when 'invalid_client' then INVALID_CLIENT
|
|
53
|
+
when 'invalid_grant' then INVALID_GRANT
|
|
54
|
+
when 'unauthorized_client' then UNAUTHORIZED_CLIENT
|
|
55
|
+
when 'unsupported_grant_type' then UNSUPPORTED_GRANT_TYPE
|
|
56
|
+
when 'invalid_scope' then INVALID_SCOPE
|
|
57
|
+
else
|
|
58
|
+
default_value
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
|
+
# OAuth 2 scopes supported by the API
|
|
8
|
+
class OauthScopePetstoreAuth
|
|
9
|
+
OAUTH_SCOPE_PETSTORE_AUTH = [
|
|
10
|
+
# modify pets in your account
|
|
11
|
+
WRITEPETS = 'write:pets'.freeze,
|
|
12
|
+
|
|
13
|
+
# read your pets
|
|
14
|
+
READPETS = 'read:pets'.freeze
|
|
15
|
+
].freeze
|
|
16
|
+
|
|
17
|
+
def self.validate(value)
|
|
18
|
+
return false if value.nil?
|
|
19
|
+
|
|
20
|
+
OAUTH_SCOPE_PETSTORE_AUTH.include?(value)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.from_value(value, default_value = WRITEPETS)
|
|
24
|
+
return default_value if value.nil?
|
|
25
|
+
|
|
26
|
+
str = value.to_s.strip
|
|
27
|
+
|
|
28
|
+
case str.downcase
|
|
29
|
+
when 'writepets' then WRITEPETS
|
|
30
|
+
when 'readpets' then READPETS
|
|
31
|
+
else
|
|
32
|
+
default_value
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by
|
|
4
|
+
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
|
+
# OAuth 2 Authorization endpoint response
|
|
8
|
+
class OauthToken < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Access token
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :access_token
|
|
15
|
+
|
|
16
|
+
# Type of access token
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :token_type
|
|
19
|
+
|
|
20
|
+
# Time in seconds before the access token expires
|
|
21
|
+
# @return [Integer]
|
|
22
|
+
attr_accessor :expires_in
|
|
23
|
+
|
|
24
|
+
# List of scopes granted
|
|
25
|
+
# This is a space-delimited list of strings.
|
|
26
|
+
# @return [String]
|
|
27
|
+
attr_accessor :scope
|
|
28
|
+
|
|
29
|
+
# Time of token expiry as unix timestamp (UTC)
|
|
30
|
+
# @return [Integer]
|
|
31
|
+
attr_accessor :expiry
|
|
32
|
+
|
|
33
|
+
# Refresh token
|
|
34
|
+
# Used to get a new access token when it expires.
|
|
35
|
+
# @return [String]
|
|
36
|
+
attr_accessor :refresh_token
|
|
37
|
+
|
|
38
|
+
# A mapping from model property names to API property names.
|
|
39
|
+
def self.names
|
|
40
|
+
@_hash = {} if @_hash.nil?
|
|
41
|
+
@_hash['access_token'] = 'access_token'
|
|
42
|
+
@_hash['token_type'] = 'token_type'
|
|
43
|
+
@_hash['expires_in'] = 'expires_in'
|
|
44
|
+
@_hash['scope'] = 'scope'
|
|
45
|
+
@_hash['expiry'] = 'expiry'
|
|
46
|
+
@_hash['refresh_token'] = 'refresh_token'
|
|
47
|
+
@_hash
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# An array for optional fields
|
|
51
|
+
def self.optionals
|
|
52
|
+
%w[
|
|
53
|
+
expires_in
|
|
54
|
+
scope
|
|
55
|
+
expiry
|
|
56
|
+
refresh_token
|
|
57
|
+
]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# An array for nullable fields
|
|
61
|
+
def self.nullables
|
|
62
|
+
[]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def initialize(access_token:, token_type:, expires_in: SKIP, scope: SKIP,
|
|
66
|
+
expiry: SKIP, refresh_token: SKIP)
|
|
67
|
+
@access_token = access_token
|
|
68
|
+
@token_type = token_type
|
|
69
|
+
@expires_in = expires_in unless expires_in == SKIP
|
|
70
|
+
@scope = scope unless scope == SKIP
|
|
71
|
+
@expiry = expiry unless expiry == SKIP
|
|
72
|
+
@refresh_token = refresh_token unless refresh_token == SKIP
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Creates an instance of the object from a hash.
|
|
76
|
+
def self.from_hash(hash)
|
|
77
|
+
return nil unless hash
|
|
78
|
+
|
|
79
|
+
# Extract variables from the hash.
|
|
80
|
+
access_token = hash.key?('access_token') ? hash['access_token'] : nil
|
|
81
|
+
token_type = hash.key?('token_type') ? hash['token_type'] : nil
|
|
82
|
+
expires_in = hash.key?('expires_in') ? hash['expires_in'] : SKIP
|
|
83
|
+
scope = hash.key?('scope') ? hash['scope'] : SKIP
|
|
84
|
+
expiry = hash.key?('expiry') ? hash['expiry'] : SKIP
|
|
85
|
+
refresh_token = hash.key?('refresh_token') ? hash['refresh_token'] : SKIP
|
|
86
|
+
|
|
87
|
+
# Create object from extracted values.
|
|
88
|
+
OauthToken.new(access_token: access_token,
|
|
89
|
+
token_type: token_type,
|
|
90
|
+
expires_in: expires_in,
|
|
91
|
+
scope: scope,
|
|
92
|
+
expiry: expiry,
|
|
93
|
+
refresh_token: refresh_token)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def self.from_element(root)
|
|
97
|
+
access_token = XmlUtilities.from_element(root, 'access_token', String)
|
|
98
|
+
token_type = XmlUtilities.from_element(root, 'token_type', String)
|
|
99
|
+
expires_in = XmlUtilities.from_element(root, 'expires_in', Integer)
|
|
100
|
+
scope = XmlUtilities.from_element(root, 'scope', String)
|
|
101
|
+
expiry = XmlUtilities.from_element(root, 'expiry', Integer)
|
|
102
|
+
refresh_token = XmlUtilities.from_element(root, 'refresh_token', String)
|
|
103
|
+
|
|
104
|
+
new(access_token: access_token,
|
|
105
|
+
token_type: token_type,
|
|
106
|
+
expires_in: expires_in,
|
|
107
|
+
scope: scope,
|
|
108
|
+
expiry: expiry,
|
|
109
|
+
refresh_token: refresh_token)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def to_xml_element(doc, root_name)
|
|
113
|
+
root = doc.create_element(root_name)
|
|
114
|
+
|
|
115
|
+
XmlUtilities.add_as_subelement(doc, root, 'access_token', access_token)
|
|
116
|
+
XmlUtilities.add_as_subelement(doc, root, 'token_type', token_type)
|
|
117
|
+
XmlUtilities.add_as_subelement(doc, root, 'expires_in', expires_in)
|
|
118
|
+
XmlUtilities.add_as_subelement(doc, root, 'scope', scope)
|
|
119
|
+
XmlUtilities.add_as_subelement(doc, root, 'expiry', expiry)
|
|
120
|
+
XmlUtilities.add_as_subelement(doc, root, 'refresh_token', refresh_token)
|
|
121
|
+
|
|
122
|
+
root
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|