rose-nielsen-sdk 0.0.3 → 0.0.7
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 +18 -60
- data/lib/{swagger_petstore → cypress_test_api}/api_helper.rb +2 -2
- data/lib/cypress_test_api/client.rb +47 -0
- data/lib/{swagger_petstore → cypress_test_api}/configuration.rb +17 -41
- data/lib/cypress_test_api/controllers/api_controller.rb +102 -0
- data/lib/{swagger_petstore → cypress_test_api}/controllers/base_controller.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/exceptions/api_exception.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/http/http_call_back.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/http/http_method_enum.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/http/http_request.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/http/http_response.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/http/proxy_settings.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/models/base_model.rb +2 -2
- data/lib/cypress_test_api/models/custom_enum.rb +26 -0
- data/lib/{swagger_petstore/models/category.rb → cypress_test_api/models/deer.rb} +18 -21
- data/lib/cypress_test_api/models/item.rb +166 -0
- data/lib/{swagger_petstore/models/category2.rb → cypress_test_api/models/item_response.rb} +19 -10
- data/lib/cypress_test_api/models/lion.rb +68 -0
- data/lib/cypress_test_api/models/message.rb +68 -0
- data/lib/{swagger_petstore/models/api_response.rb → cypress_test_api/models/message2.rb} +14 -24
- data/lib/cypress_test_api/models/multiple_arrays_request.rb +70 -0
- data/lib/cypress_test_api/models/nac_tag.rb +265 -0
- data/lib/cypress_test_api/models/o_auth_scope_o_auth_acg_enum.rb +29 -0
- data/lib/cypress_test_api/models/response_http400.rb +62 -0
- data/lib/{swagger_petstore/models/tag.rb → cypress_test_api/models/response_http404.rb} +9 -18
- data/lib/cypress_test_api/models/status11_enum.rb +26 -0
- data/lib/cypress_test_api/models/status1_enum.rb +26 -0
- data/lib/{swagger_petstore → cypress_test_api}/models/status_enum.rb +9 -9
- data/lib/cypress_test_api/models/tokens_request.rb +60 -0
- data/lib/{swagger_petstore → cypress_test_api}/utilities/date_time_helper.rb +2 -2
- data/lib/{swagger_petstore → cypress_test_api}/utilities/file_wrapper.rb +2 -2
- data/lib/cypress_test_api.rb +55 -0
- data/test/controllers/controller_test_base.rb +5 -13
- data/test/controllers/test_api_controller.rb +40 -0
- data/test/http_response_catcher.rb +2 -2
- metadata +33 -40
- data/lib/swagger_petstore/client.rb +0 -84
- data/lib/swagger_petstore/controllers/pet_controller.rb +0 -206
- data/lib/swagger_petstore/controllers/store_controller.rb +0 -94
- data/lib/swagger_petstore/controllers/user_controller.rb +0 -165
- data/lib/swagger_petstore/exceptions/o_auth_provider_exception.rb +0 -64
- data/lib/swagger_petstore/http/auth/api_key.rb +0 -42
- data/lib/swagger_petstore/http/auth/http_basic.rb +0 -50
- data/lib/swagger_petstore/http/auth/petstore_auth.rb +0 -98
- data/lib/swagger_petstore/models/content_type_enum.rb +0 -20
- data/lib/swagger_petstore/models/o_auth_provider_error_enum.rb +0 -45
- data/lib/swagger_petstore/models/o_auth_scope_petstore_auth_enum.rb +0 -23
- data/lib/swagger_petstore/models/o_auth_token.rb +0 -96
- data/lib/swagger_petstore/models/order.rb +0 -120
- data/lib/swagger_petstore/models/pet.rb +0 -117
- data/lib/swagger_petstore/models/pet_request.rb +0 -117
- data/lib/swagger_petstore/models/status1_enum.rb +0 -26
- data/lib/swagger_petstore/models/status2_enum.rb +0 -26
- data/lib/swagger_petstore/models/store_order_request.rb +0 -120
- data/lib/swagger_petstore/models/user.rb +0 -132
- data/lib/swagger_petstore/models/user_request.rb +0 -132
- data/lib/swagger_petstore.rb +0 -62
- data/test/controllers/test_store_controller.rb +0 -31
@@ -1,165 +0,0 @@
|
|
1
|
-
# swagger_petstore
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v3.0
|
4
|
-
# ( https://www.apimatic.io ).
|
5
|
-
|
6
|
-
module SwaggerPetstore
|
7
|
-
# UserController
|
8
|
-
class UserController < BaseController
|
9
|
-
# Creates list of users with given input array
|
10
|
-
# @param [Array[User]] body Required parameter: List of user object
|
11
|
-
# @return [void] Response from the API call.
|
12
|
-
def create_users_with_list_input(body)
|
13
|
-
@api_call
|
14
|
-
.request(new_request_builder(HttpMethodEnum::POST,
|
15
|
-
'/user/createWithList',
|
16
|
-
Server::DEFAULT)
|
17
|
-
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
18
|
-
.body_param(new_parameter(body))
|
19
|
-
.body_serializer(proc do |param| param.to_json unless param.nil? end))
|
20
|
-
.response(new_response_handler
|
21
|
-
.is_response_void(true))
|
22
|
-
.execute
|
23
|
-
end
|
24
|
-
|
25
|
-
# Get user by user name
|
26
|
-
# @param [String] username Required parameter: The name that needs to be
|
27
|
-
# fetched. Use user1 for testing.
|
28
|
-
# @return [User] Response from the API call.
|
29
|
-
def get_user_by_name(username)
|
30
|
-
@api_call
|
31
|
-
.request(new_request_builder(HttpMethodEnum::GET,
|
32
|
-
'/user/{username}',
|
33
|
-
Server::DEFAULT)
|
34
|
-
.template_param(new_parameter(username, key: 'username')
|
35
|
-
.should_encode(true))
|
36
|
-
.header_param(new_parameter('application/json', key: 'accept')))
|
37
|
-
.response(new_response_handler
|
38
|
-
.deserializer(APIHelper.method(:custom_type_deserializer))
|
39
|
-
.deserialize_into(User.method(:from_hash))
|
40
|
-
.local_error('400',
|
41
|
-
'Invalid username supplied',
|
42
|
-
APIException)
|
43
|
-
.local_error('404',
|
44
|
-
'User not found',
|
45
|
-
APIException))
|
46
|
-
.execute
|
47
|
-
end
|
48
|
-
|
49
|
-
# This can only be done by the logged in user.
|
50
|
-
# @param [String] username Required parameter: name that need to be
|
51
|
-
# updated
|
52
|
-
# @param [UserRequest] body Required parameter: Updated user object
|
53
|
-
# @return [void] Response from the API call.
|
54
|
-
def update_user(username,
|
55
|
-
body)
|
56
|
-
@api_call
|
57
|
-
.request(new_request_builder(HttpMethodEnum::PUT,
|
58
|
-
'/user/{username}',
|
59
|
-
Server::DEFAULT)
|
60
|
-
.template_param(new_parameter(username, key: 'username')
|
61
|
-
.should_encode(true))
|
62
|
-
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
63
|
-
.body_param(new_parameter(body))
|
64
|
-
.body_serializer(proc do |param| param.to_json unless param.nil? end))
|
65
|
-
.response(new_response_handler
|
66
|
-
.is_response_void(true)
|
67
|
-
.local_error('400',
|
68
|
-
'Invalid user supplied',
|
69
|
-
APIException)
|
70
|
-
.local_error('404',
|
71
|
-
'User not found',
|
72
|
-
APIException))
|
73
|
-
.execute
|
74
|
-
end
|
75
|
-
|
76
|
-
# This can only be done by the logged in user.
|
77
|
-
# @param [String] username Required parameter: The name that needs to be
|
78
|
-
# deleted
|
79
|
-
# @return [void] Response from the API call.
|
80
|
-
def delete_user(username)
|
81
|
-
@api_call
|
82
|
-
.request(new_request_builder(HttpMethodEnum::DELETE,
|
83
|
-
'/user/{username}',
|
84
|
-
Server::DEFAULT)
|
85
|
-
.template_param(new_parameter(username, key: 'username')
|
86
|
-
.should_encode(true)))
|
87
|
-
.response(new_response_handler
|
88
|
-
.is_response_void(true)
|
89
|
-
.local_error('400',
|
90
|
-
'Invalid username supplied',
|
91
|
-
APIException)
|
92
|
-
.local_error('404',
|
93
|
-
'User not found',
|
94
|
-
APIException))
|
95
|
-
.execute
|
96
|
-
end
|
97
|
-
|
98
|
-
# Logs out current logged in user session
|
99
|
-
# @return [void] Response from the API call.
|
100
|
-
def logout_user
|
101
|
-
@api_call
|
102
|
-
.request(new_request_builder(HttpMethodEnum::GET,
|
103
|
-
'/user/logout',
|
104
|
-
Server::DEFAULT))
|
105
|
-
.response(new_response_handler
|
106
|
-
.is_response_void(true))
|
107
|
-
.execute
|
108
|
-
end
|
109
|
-
|
110
|
-
# This can only be done by the logged in user.
|
111
|
-
# @param [UserRequest] body Required parameter: Created user object
|
112
|
-
# @return [void] Response from the API call.
|
113
|
-
def create_user(body)
|
114
|
-
@api_call
|
115
|
-
.request(new_request_builder(HttpMethodEnum::POST,
|
116
|
-
'/user',
|
117
|
-
Server::DEFAULT)
|
118
|
-
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
119
|
-
.body_param(new_parameter(body))
|
120
|
-
.body_serializer(proc do |param| param.to_json unless param.nil? end))
|
121
|
-
.response(new_response_handler
|
122
|
-
.is_response_void(true))
|
123
|
-
.execute
|
124
|
-
end
|
125
|
-
|
126
|
-
# Creates list of users with given input array
|
127
|
-
# @param [Array[User]] body Required parameter: List of user object
|
128
|
-
# @return [void] Response from the API call.
|
129
|
-
def create_users_with_array_input(body)
|
130
|
-
@api_call
|
131
|
-
.request(new_request_builder(HttpMethodEnum::POST,
|
132
|
-
'/user/createWithArray',
|
133
|
-
Server::DEFAULT)
|
134
|
-
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
135
|
-
.body_param(new_parameter(body))
|
136
|
-
.body_serializer(proc do |param| param.to_json unless param.nil? end))
|
137
|
-
.response(new_response_handler
|
138
|
-
.is_response_void(true))
|
139
|
-
.execute
|
140
|
-
end
|
141
|
-
|
142
|
-
# Logs user into the system
|
143
|
-
# @param [String] username Required parameter: The user name for login
|
144
|
-
# @param [String] password Required parameter: The password for login in
|
145
|
-
# clear text
|
146
|
-
# @return [String] Response from the API call.
|
147
|
-
def login_user(username,
|
148
|
-
password)
|
149
|
-
@api_call
|
150
|
-
.request(new_request_builder(HttpMethodEnum::GET,
|
151
|
-
'/user/login',
|
152
|
-
Server::DEFAULT)
|
153
|
-
.query_param(new_parameter(username, key: 'username'))
|
154
|
-
.query_param(new_parameter(password, key: 'password')))
|
155
|
-
.response(new_response_handler
|
156
|
-
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
157
|
-
.deserialize_into(proc do |response| response&.to_s end)
|
158
|
-
.is_primitive_response(true)
|
159
|
-
.local_error('400',
|
160
|
-
'Invalid username/password supplied',
|
161
|
-
APIException))
|
162
|
-
.execute
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
# swagger_petstore
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v3.0
|
4
|
-
# ( https://www.apimatic.io ).
|
5
|
-
|
6
|
-
module SwaggerPetstore
|
7
|
-
# OAuth 2 Authorization endpoint exception.
|
8
|
-
class OAuthProviderException < APIException
|
9
|
-
SKIP = Object.new
|
10
|
-
private_constant :SKIP
|
11
|
-
|
12
|
-
# Gets or sets error code.
|
13
|
-
# @return [OAuthProviderErrorEnum]
|
14
|
-
attr_accessor :error
|
15
|
-
|
16
|
-
# Gets or sets human-readable text providing additional information on
|
17
|
-
# error.
|
18
|
-
# Used to assist the client developer in understanding the error that
|
19
|
-
# occurred.
|
20
|
-
# @return [String]
|
21
|
-
attr_accessor :error_description
|
22
|
-
|
23
|
-
# Gets or sets a URI identifying a human-readable web page with information
|
24
|
-
# about the error, used to provide the client developer with additional
|
25
|
-
# information about the error.
|
26
|
-
# @return [String]
|
27
|
-
attr_accessor :error_uri
|
28
|
-
|
29
|
-
# The constructor.
|
30
|
-
# @param [String] reason The reason for raising an exception.
|
31
|
-
# @param [HttpResponse] response The HttpReponse of the API call.
|
32
|
-
def initialize(reason, response)
|
33
|
-
super(reason, response)
|
34
|
-
hash = APIHelper.json_deserialize(@response.raw_body)
|
35
|
-
unbox(hash)
|
36
|
-
end
|
37
|
-
|
38
|
-
# Populates this object by extracting properties from a hash.
|
39
|
-
# @param [Hash] hash The deserialized response sent by the server in the
|
40
|
-
# response body.
|
41
|
-
def unbox(hash)
|
42
|
-
return nil unless hash
|
43
|
-
|
44
|
-
@error = hash.key?('error') ? hash['error'] : nil
|
45
|
-
@error_description =
|
46
|
-
hash.key?('error_description') ? hash['error_description'] : SKIP
|
47
|
-
@error_uri = hash.key?('error_uri') ? hash['error_uri'] : SKIP
|
48
|
-
end
|
49
|
-
|
50
|
-
# Provides a human-readable string representation of the object.
|
51
|
-
def to_s
|
52
|
-
class_name = self.class.name.split('::').last
|
53
|
-
"<#{class_name} error: #{@error}, error_description: #{@error_description}, error_uri:"\
|
54
|
-
" #{@error_uri}>"
|
55
|
-
end
|
56
|
-
|
57
|
-
# Provides a debugging-friendly string with detailed object information.
|
58
|
-
def inspect
|
59
|
-
class_name = self.class.name.split('::').last
|
60
|
-
"<#{class_name} error: #{@error.inspect}, error_description: #{@error_description.inspect},"\
|
61
|
-
" error_uri: #{@error_uri.inspect}>"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# swagger_petstore
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v3.0
|
4
|
-
# ( https://www.apimatic.io ).
|
5
|
-
|
6
|
-
module SwaggerPetstore
|
7
|
-
# Utility class for custom header authorization.
|
8
|
-
class ApiKey < CoreLibrary::HeaderAuth
|
9
|
-
# Display error message on occurrence of authentication failure.
|
10
|
-
# @returns [String] The oAuth error message.
|
11
|
-
def error_message
|
12
|
-
'ApiKey: api_key is undefined.'
|
13
|
-
end
|
14
|
-
|
15
|
-
# Initialization constructor.
|
16
|
-
def initialize(api_key_credentials)
|
17
|
-
auth_params = {}
|
18
|
-
auth_params['api_key'] = api_key_credentials.api_key unless
|
19
|
-
api_key_credentials.nil? || api_key_credentials.api_key.nil?
|
20
|
-
|
21
|
-
super auth_params
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# Data class for ApiKeyCredentials.
|
26
|
-
# Data class for ApiKeyCredentials.
|
27
|
-
class ApiKeyCredentials
|
28
|
-
attr_reader :api_key
|
29
|
-
|
30
|
-
def initialize(api_key:)
|
31
|
-
raise ArgumentError, 'api_key cannot be nil' if api_key.nil?
|
32
|
-
|
33
|
-
@api_key = api_key
|
34
|
-
end
|
35
|
-
|
36
|
-
def clone_with(api_key: nil)
|
37
|
-
api_key ||= self.api_key
|
38
|
-
|
39
|
-
ApiKeyCredentials.new(api_key: api_key)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# swagger_petstore
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v3.0
|
4
|
-
# ( https://www.apimatic.io ).
|
5
|
-
|
6
|
-
module SwaggerPetstore
|
7
|
-
# Utility class for basic authorization.
|
8
|
-
class HttpBasic < CoreLibrary::HeaderAuth
|
9
|
-
include CoreLibrary
|
10
|
-
# Display error message on occurrence of authentication failure.
|
11
|
-
# @returns [String] The oAuth error message.
|
12
|
-
def error_message
|
13
|
-
'HttpBasic: username or passwprd is undefined.'
|
14
|
-
end
|
15
|
-
|
16
|
-
# Initialization constructor.
|
17
|
-
def initialize(http_basic_credentials)
|
18
|
-
auth_params = {}
|
19
|
-
unless http_basic_credentials.nil? ||
|
20
|
-
http_basic_credentials.username.nil? ||
|
21
|
-
http_basic_credentials.passwprd.nil?
|
22
|
-
auth_params['Authorization'] =
|
23
|
-
"Basic #{AuthHelper.get_base64_encoded_value(http_basic_credentials.username,
|
24
|
-
http_basic_credentials.passwprd)}"
|
25
|
-
end
|
26
|
-
|
27
|
-
super auth_params
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
# Data class for HttpBasicCredentials.
|
32
|
-
class HttpBasicCredentials
|
33
|
-
attr_reader :username, :passwprd
|
34
|
-
|
35
|
-
def initialize(username:, passwprd:)
|
36
|
-
raise ArgumentError, 'username cannot be nil' if username.nil?
|
37
|
-
raise ArgumentError, 'passwprd cannot be nil' if passwprd.nil?
|
38
|
-
|
39
|
-
@username = username
|
40
|
-
@passwprd = passwprd
|
41
|
-
end
|
42
|
-
|
43
|
-
def clone_with(username: nil, passwprd: nil)
|
44
|
-
username ||= self.username
|
45
|
-
passwprd ||= self.passwprd
|
46
|
-
|
47
|
-
HttpBasicCredentials.new(username: username, passwprd: passwprd)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,98 +0,0 @@
|
|
1
|
-
# swagger_petstore
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v3.0
|
4
|
-
# ( https://www.apimatic.io ).
|
5
|
-
|
6
|
-
module SwaggerPetstore
|
7
|
-
# Utility class for OAuth 2 authorization and token management.
|
8
|
-
class PetstoreAuth < CoreLibrary::HeaderAuth
|
9
|
-
include CoreLibrary
|
10
|
-
# Display error message on occurrence of authentication failure.
|
11
|
-
# @returns [String] The oAuth error message.
|
12
|
-
def error_message
|
13
|
-
'PetstoreAuth: OAuthToken is undefined or expired.'
|
14
|
-
end
|
15
|
-
|
16
|
-
# Initialization constructor.
|
17
|
-
def initialize(petstore_auth_credentials, config)
|
18
|
-
auth_params = {}
|
19
|
-
@_o_auth_client_id = petstore_auth_credentials.o_auth_client_id unless
|
20
|
-
petstore_auth_credentials.nil? || petstore_auth_credentials.o_auth_client_id.nil?
|
21
|
-
@_o_auth_redirect_uri = petstore_auth_credentials.o_auth_redirect_uri unless
|
22
|
-
petstore_auth_credentials.nil? || petstore_auth_credentials.o_auth_redirect_uri.nil?
|
23
|
-
@_o_auth_token = petstore_auth_credentials.o_auth_token unless
|
24
|
-
petstore_auth_credentials.nil? || petstore_auth_credentials.o_auth_token.nil?
|
25
|
-
@_o_auth_scopes = petstore_auth_credentials.o_auth_scopes unless
|
26
|
-
petstore_auth_credentials.nil? || petstore_auth_credentials.o_auth_scopes.nil?
|
27
|
-
@_o_auth_api = OAuthAuthorizationController.new(config)
|
28
|
-
auth_params[:Authorization] = "Bearer #{@_o_auth_token.access_token}" unless @_o_auth_token.nil?
|
29
|
-
|
30
|
-
super auth_params
|
31
|
-
end
|
32
|
-
|
33
|
-
# Validates the oAuth token.
|
34
|
-
# @return [Boolean] true if the token is present and not expired.
|
35
|
-
def valid
|
36
|
-
!@_o_auth_token.nil? && !token_expired?(@_o_auth_token)
|
37
|
-
end
|
38
|
-
|
39
|
-
# Builds and returns an authorization URL.
|
40
|
-
# The user is expected to obtain an authorization code from this URL and then call the
|
41
|
-
# fetch token function with that authorization code.
|
42
|
-
# @param [String] state An opaque state string.
|
43
|
-
# @param [Hash] additional_params Any additional query parameters to be added to the URL.
|
44
|
-
# @return [String] The authorization URL.
|
45
|
-
def get_authorization_url(state: nil, additional_params: nil)
|
46
|
-
auth_url = @_config.get_base_uri_executor.call(Server::DEFAULT)
|
47
|
-
auth_url += '/authorize'
|
48
|
-
query_params = {
|
49
|
-
'response_type' => 'code',
|
50
|
-
'client_id' => @_o_auth_client_id,
|
51
|
-
'redirect_uri' => @_o_auth_redirect_uri
|
52
|
-
}
|
53
|
-
query_params['scope'] = Array(@_o_auth_scopes).compact.join(' ') if @_o_auth_scopes
|
54
|
-
query_params['state'] = state if state
|
55
|
-
query_params.merge!(additional_params) if additional_params
|
56
|
-
auth_url = APIHelper.append_url_with_query_parameters(auth_url,
|
57
|
-
query_params)
|
58
|
-
APIHelper.clean_url(auth_url)
|
59
|
-
end
|
60
|
-
|
61
|
-
# Checks if OAuth token has expired.
|
62
|
-
# @param [OAuthToken] token The oAuth token instance.
|
63
|
-
# @return [Boolean] true if the token is present and not expired.
|
64
|
-
def token_expired?(token)
|
65
|
-
token.respond_to?('expiry') && AuthHelper.token_expired?(token.expiry)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
# Data class for PetstoreAuthCredentials.
|
70
|
-
class PetstoreAuthCredentials
|
71
|
-
attr_reader :o_auth_client_id, :o_auth_redirect_uri, :o_auth_token,
|
72
|
-
:o_auth_scopes
|
73
|
-
|
74
|
-
def initialize(o_auth_client_id:, o_auth_redirect_uri:, o_auth_token: nil,
|
75
|
-
o_auth_scopes: nil)
|
76
|
-
raise ArgumentError, 'o_auth_client_id cannot be nil' if o_auth_client_id.nil?
|
77
|
-
raise ArgumentError, 'o_auth_redirect_uri cannot be nil' if o_auth_redirect_uri.nil?
|
78
|
-
|
79
|
-
@o_auth_client_id = o_auth_client_id
|
80
|
-
@o_auth_redirect_uri = o_auth_redirect_uri
|
81
|
-
@o_auth_token = o_auth_token
|
82
|
-
@o_auth_scopes = o_auth_scopes
|
83
|
-
end
|
84
|
-
|
85
|
-
def clone_with(o_auth_client_id: nil, o_auth_redirect_uri: nil,
|
86
|
-
o_auth_token: nil, o_auth_scopes: nil)
|
87
|
-
o_auth_client_id ||= self.o_auth_client_id
|
88
|
-
o_auth_redirect_uri ||= self.o_auth_redirect_uri
|
89
|
-
o_auth_token ||= self.o_auth_token
|
90
|
-
o_auth_scopes ||= self.o_auth_scopes
|
91
|
-
|
92
|
-
PetstoreAuthCredentials.new(o_auth_client_id: o_auth_client_id,
|
93
|
-
o_auth_redirect_uri: o_auth_redirect_uri,
|
94
|
-
o_auth_token: o_auth_token,
|
95
|
-
o_auth_scopes: o_auth_scopes)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# swagger_petstore
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v3.0
|
4
|
-
# ( https://www.apimatic.io ).
|
5
|
-
|
6
|
-
module SwaggerPetstore
|
7
|
-
# Content-Type.
|
8
|
-
class ContentTypeEnum
|
9
|
-
CONTENT_TYPE_ENUM = [
|
10
|
-
# TODO: Write general description for ENUM_APPLICATIONXWWWFORMURLENCODED
|
11
|
-
ENUM_APPLICATIONXWWWFORMURLENCODED = 'application/x-www-form-urlencoded'.freeze
|
12
|
-
].freeze
|
13
|
-
|
14
|
-
def self.validate(value)
|
15
|
-
return false if value.nil?
|
16
|
-
|
17
|
-
CONTENT_TYPE_ENUM.include?(value)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# swagger_petstore
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v3.0
|
4
|
-
# ( https://www.apimatic.io ).
|
5
|
-
|
6
|
-
module SwaggerPetstore
|
7
|
-
# OAuth 2 Authorization error codes
|
8
|
-
class OAuthProviderErrorEnum
|
9
|
-
O_AUTH_PROVIDER_ERROR_ENUM = [
|
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
|
-
O_AUTH_PROVIDER_ERROR_ENUM.include?(value)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# swagger_petstore
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v3.0
|
4
|
-
# ( https://www.apimatic.io ).
|
5
|
-
|
6
|
-
module SwaggerPetstore
|
7
|
-
# OAuth 2 scopes supported by the API
|
8
|
-
class OAuthScopePetstoreAuthEnum
|
9
|
-
O_AUTH_SCOPE_PETSTORE_AUTH_ENUM = [
|
10
|
-
# read your pets
|
11
|
-
READPETS = 'read:pets'.freeze,
|
12
|
-
|
13
|
-
# modify pets in your account
|
14
|
-
WRITEPETS = 'write:pets'.freeze
|
15
|
-
].freeze
|
16
|
-
|
17
|
-
def self.validate(value)
|
18
|
-
return false if value.nil?
|
19
|
-
|
20
|
-
O_AUTH_SCOPE_PETSTORE_AUTH_ENUM.include?(value)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,96 +0,0 @@
|
|
1
|
-
# swagger_petstore
|
2
|
-
#
|
3
|
-
# This file was automatically generated by APIMATIC v3.0
|
4
|
-
# ( https://www.apimatic.io ).
|
5
|
-
|
6
|
-
module SwaggerPetstore
|
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 = nil, token_type = nil, expires_in = SKIP,
|
66
|
-
scope = SKIP, 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,
|
89
|
-
token_type,
|
90
|
-
expires_in,
|
91
|
-
scope,
|
92
|
-
expiry,
|
93
|
-
refresh_token)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|