wesley-key-sdk 0.1.6 → 0.1.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 +67 -25
- data/bin/console +4 -4
- data/lib/{cypress_test_api → swagger_petstore}/api_helper.rb +2 -2
- data/lib/swagger_petstore/client.rb +95 -0
- data/lib/{cypress_test_api → swagger_petstore}/configuration.rb +61 -20
- data/lib/{cypress_test_api → swagger_petstore}/controllers/base_controller.rb +2 -2
- data/lib/swagger_petstore/controllers/pet_controller.rb +206 -0
- data/lib/swagger_petstore/controllers/store_controller.rb +94 -0
- data/lib/swagger_petstore/controllers/user_controller.rb +165 -0
- data/lib/{cypress_test_api → swagger_petstore}/exceptions/api_exception.rb +2 -2
- data/lib/swagger_petstore/exceptions/o_auth_provider_exception.rb +64 -0
- data/lib/swagger_petstore/http/auth/api_key.rb +52 -0
- data/lib/swagger_petstore/http/auth/http_basic.rb +62 -0
- data/lib/swagger_petstore/http/auth/petstore_auth.rb +113 -0
- data/lib/{cypress_test_api → swagger_petstore}/http/http_call_back.rb +2 -2
- data/lib/{cypress_test_api → swagger_petstore}/http/http_method_enum.rb +2 -2
- data/lib/{cypress_test_api → swagger_petstore}/http/http_request.rb +2 -2
- data/lib/{cypress_test_api → swagger_petstore}/http/http_response.rb +2 -2
- data/lib/{cypress_test_api → swagger_petstore}/http/proxy_settings.rb +2 -2
- data/lib/{cypress_test_api/models/message2.rb → swagger_petstore/models/api_response.rb} +24 -14
- data/lib/{cypress_test_api → swagger_petstore}/models/base_model.rb +2 -2
- data/lib/{cypress_test_api/models/item_response.rb → swagger_petstore/models/category.rb} +10 -19
- data/lib/{cypress_test_api/models/deer.rb → swagger_petstore/models/category2.rb} +21 -18
- data/lib/swagger_petstore/models/content_type_enum.rb +26 -0
- data/lib/swagger_petstore/models/o_auth_provider_error_enum.rb +62 -0
- data/lib/swagger_petstore/models/o_auth_scope_petstore_auth_enum.rb +36 -0
- data/lib/swagger_petstore/models/o_auth_token.rb +96 -0
- data/lib/swagger_petstore/models/order.rb +120 -0
- data/lib/swagger_petstore/models/pet.rb +117 -0
- data/lib/swagger_petstore/models/pet_request.rb +117 -0
- data/lib/swagger_petstore/models/status1_enum.rb +40 -0
- data/lib/swagger_petstore/models/status2_enum.rb +40 -0
- data/lib/{cypress_test_api → swagger_petstore}/models/status_enum.rb +12 -12
- data/lib/swagger_petstore/models/store_order_request.rb +120 -0
- data/lib/{cypress_test_api/models/response_http404.rb → swagger_petstore/models/tag.rb} +18 -9
- data/lib/swagger_petstore/models/user.rb +132 -0
- data/lib/swagger_petstore/models/user_request.rb +132 -0
- data/lib/{cypress_test_api → swagger_petstore}/utilities/date_time_helper.rb +2 -2
- data/lib/{cypress_test_api → swagger_petstore}/utilities/file_wrapper.rb +2 -2
- data/lib/swagger_petstore.rb +62 -0
- data/test/controllers/controller_test_base.rb +14 -5
- data/test/controllers/test_store_controller.rb +31 -0
- data/test/http_response_catcher.rb +2 -2
- metadata +41 -34
- 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/models/custom_enum.rb +0 -40
- data/lib/cypress_test_api/models/item.rb +0 -166
- 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/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/status11_enum.rb +0 -40
- data/lib/cypress_test_api/models/status1_enum.rb +0 -40
- data/lib/cypress_test_api/models/tokens_request.rb +0 -60
- data/lib/cypress_test_api.rb +0 -55
- data/test/controllers/test_api_controller.rb +0 -40
|
@@ -0,0 +1,113 @@
|
|
|
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 self.from_env
|
|
86
|
+
o_auth_client_id = ENV['PETSTORE_AUTH_O_AUTH_CLIENT_ID']
|
|
87
|
+
o_auth_redirect_uri = ENV['PETSTORE_AUTH_O_AUTH_REDIRECT_URI']
|
|
88
|
+
o_auth_scopes = ENV['PETSTORE_AUTH_O_AUTH_SCOPES']
|
|
89
|
+
all_nil = [
|
|
90
|
+
o_auth_client_id,
|
|
91
|
+
o_auth_redirect_uri
|
|
92
|
+
].all?(&:nil?)
|
|
93
|
+
return nil if all_nil
|
|
94
|
+
|
|
95
|
+
new(o_auth_client_id: o_auth_client_id,
|
|
96
|
+
o_auth_redirect_uri: o_auth_redirect_uri,
|
|
97
|
+
o_auth_scopes: o_auth_scopes)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def clone_with(o_auth_client_id: nil, o_auth_redirect_uri: nil,
|
|
101
|
+
o_auth_token: nil, o_auth_scopes: nil)
|
|
102
|
+
o_auth_client_id ||= self.o_auth_client_id
|
|
103
|
+
o_auth_redirect_uri ||= self.o_auth_redirect_uri
|
|
104
|
+
o_auth_token ||= self.o_auth_token
|
|
105
|
+
o_auth_scopes ||= self.o_auth_scopes
|
|
106
|
+
|
|
107
|
+
PetstoreAuthCredentials.new(o_auth_client_id: o_auth_client_id,
|
|
108
|
+
o_auth_redirect_uri: o_auth_redirect_uri,
|
|
109
|
+
o_auth_token: o_auth_token,
|
|
110
|
+
o_auth_scopes: o_auth_scopes)
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstore
|
|
7
7
|
# HttpCallBack allows defining callables for pre and post API calls.
|
|
8
8
|
class HttpCallBack < CoreLibrary::HttpCallback
|
|
9
9
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstore
|
|
7
7
|
# HTTP Methods Enumeration.
|
|
8
8
|
class HttpMethodEnum < CoreLibrary::HttpMethod
|
|
9
9
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstore
|
|
7
7
|
# Represents a single Http Request.
|
|
8
8
|
class HttpRequest < CoreLibrary::HttpRequest
|
|
9
9
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstore
|
|
7
7
|
# Http response received.
|
|
8
8
|
class HttpResponse < CoreLibrary::HttpResponse
|
|
9
9
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstore
|
|
7
7
|
##
|
|
8
8
|
# ProxySettings encapsulates HTTP proxy configuration for Faraday,
|
|
9
9
|
# including optional basic authentication.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
7
|
-
#
|
|
8
|
-
class
|
|
6
|
+
module SwaggerPetstore
|
|
7
|
+
# ApiResponse Model.
|
|
8
|
+
class ApiResponse < BaseModel
|
|
9
9
|
SKIP = Object.new
|
|
10
10
|
private_constant :SKIP
|
|
11
11
|
|
|
@@ -15,13 +15,18 @@ module CypressTestApi
|
|
|
15
15
|
|
|
16
16
|
# TODO: Write general description for this method
|
|
17
17
|
# @return [String]
|
|
18
|
-
attr_accessor :
|
|
18
|
+
attr_accessor :type
|
|
19
|
+
|
|
20
|
+
# TODO: Write general description for this method
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :message
|
|
19
23
|
|
|
20
24
|
# A mapping from model property names to API property names.
|
|
21
25
|
def self.names
|
|
22
26
|
@_hash = {} if @_hash.nil?
|
|
23
27
|
@_hash['code'] = 'code'
|
|
24
|
-
@_hash['
|
|
28
|
+
@_hash['type'] = 'type'
|
|
29
|
+
@_hash['message'] = 'message'
|
|
25
30
|
@_hash
|
|
26
31
|
end
|
|
27
32
|
|
|
@@ -29,7 +34,8 @@ module CypressTestApi
|
|
|
29
34
|
def self.optionals
|
|
30
35
|
%w[
|
|
31
36
|
code
|
|
32
|
-
|
|
37
|
+
type
|
|
38
|
+
message
|
|
33
39
|
]
|
|
34
40
|
end
|
|
35
41
|
|
|
@@ -38,9 +44,10 @@ module CypressTestApi
|
|
|
38
44
|
[]
|
|
39
45
|
end
|
|
40
46
|
|
|
41
|
-
def initialize(code = SKIP,
|
|
47
|
+
def initialize(code = SKIP, type = SKIP, message = SKIP)
|
|
42
48
|
@code = code unless code == SKIP
|
|
43
|
-
@
|
|
49
|
+
@type = type unless type == SKIP
|
|
50
|
+
@message = message unless message == SKIP
|
|
44
51
|
end
|
|
45
52
|
|
|
46
53
|
# Creates an instance of the object from a hash.
|
|
@@ -49,23 +56,26 @@ module CypressTestApi
|
|
|
49
56
|
|
|
50
57
|
# Extract variables from the hash.
|
|
51
58
|
code = hash.key?('code') ? hash['code'] : SKIP
|
|
52
|
-
|
|
59
|
+
type = hash.key?('type') ? hash['type'] : SKIP
|
|
60
|
+
message = hash.key?('message') ? hash['message'] : SKIP
|
|
53
61
|
|
|
54
62
|
# Create object from extracted values.
|
|
55
|
-
|
|
56
|
-
|
|
63
|
+
ApiResponse.new(code,
|
|
64
|
+
type,
|
|
65
|
+
message)
|
|
57
66
|
end
|
|
58
67
|
|
|
59
68
|
# Provides a human-readable string representation of the object.
|
|
60
69
|
def to_s
|
|
61
70
|
class_name = self.class.name.split('::').last
|
|
62
|
-
"<#{class_name} code: #{@code},
|
|
71
|
+
"<#{class_name} code: #{@code}, type: #{@type}, message: #{@message}>"
|
|
63
72
|
end
|
|
64
73
|
|
|
65
74
|
# Provides a debugging-friendly string with detailed object information.
|
|
66
75
|
def inspect
|
|
67
76
|
class_name = self.class.name.split('::').last
|
|
68
|
-
"<#{class_name} code: #{@code.inspect},
|
|
77
|
+
"<#{class_name} code: #{@code.inspect}, type: #{@type.inspect}, message:"\
|
|
78
|
+
" #{@message.inspect}>"
|
|
69
79
|
end
|
|
70
80
|
end
|
|
71
81
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstore
|
|
7
7
|
# Base model.
|
|
8
8
|
# rubocop:disable all
|
|
9
9
|
class BaseModel < CoreLibrary::BaseModel
|
|
@@ -1,32 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
7
|
-
#
|
|
8
|
-
class
|
|
6
|
+
module SwaggerPetstore
|
|
7
|
+
# Category Model.
|
|
8
|
+
class Category < BaseModel
|
|
9
9
|
SKIP = Object.new
|
|
10
10
|
private_constant :SKIP
|
|
11
11
|
|
|
12
12
|
# TODO: Write general description for this method
|
|
13
|
-
# @return [
|
|
13
|
+
# @return [Integer]
|
|
14
14
|
attr_accessor :id
|
|
15
15
|
|
|
16
16
|
# TODO: Write general description for this method
|
|
17
17
|
# @return [String]
|
|
18
18
|
attr_accessor :name
|
|
19
19
|
|
|
20
|
-
# TODO: Write general description for this method
|
|
21
|
-
# @return [String]
|
|
22
|
-
attr_accessor :message
|
|
23
|
-
|
|
24
20
|
# A mapping from model property names to API property names.
|
|
25
21
|
def self.names
|
|
26
22
|
@_hash = {} if @_hash.nil?
|
|
27
23
|
@_hash['id'] = 'id'
|
|
28
24
|
@_hash['name'] = 'name'
|
|
29
|
-
@_hash['message'] = 'message'
|
|
30
25
|
@_hash
|
|
31
26
|
end
|
|
32
27
|
|
|
@@ -35,7 +30,6 @@ module CypressTestApi
|
|
|
35
30
|
%w[
|
|
36
31
|
id
|
|
37
32
|
name
|
|
38
|
-
message
|
|
39
33
|
]
|
|
40
34
|
end
|
|
41
35
|
|
|
@@ -44,10 +38,9 @@ module CypressTestApi
|
|
|
44
38
|
[]
|
|
45
39
|
end
|
|
46
40
|
|
|
47
|
-
def initialize(id = SKIP, name = SKIP
|
|
41
|
+
def initialize(id = SKIP, name = SKIP)
|
|
48
42
|
@id = id unless id == SKIP
|
|
49
43
|
@name = name unless name == SKIP
|
|
50
|
-
@message = message unless message == SKIP
|
|
51
44
|
end
|
|
52
45
|
|
|
53
46
|
# Creates an instance of the object from a hash.
|
|
@@ -57,24 +50,22 @@ module CypressTestApi
|
|
|
57
50
|
# Extract variables from the hash.
|
|
58
51
|
id = hash.key?('id') ? hash['id'] : SKIP
|
|
59
52
|
name = hash.key?('name') ? hash['name'] : SKIP
|
|
60
|
-
message = hash.key?('message') ? hash['message'] : SKIP
|
|
61
53
|
|
|
62
54
|
# Create object from extracted values.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
message)
|
|
55
|
+
Category.new(id,
|
|
56
|
+
name)
|
|
66
57
|
end
|
|
67
58
|
|
|
68
59
|
# Provides a human-readable string representation of the object.
|
|
69
60
|
def to_s
|
|
70
61
|
class_name = self.class.name.split('::').last
|
|
71
|
-
"<#{class_name} id: #{@id}, name: #{@name}
|
|
62
|
+
"<#{class_name} id: #{@id}, name: #{@name}>"
|
|
72
63
|
end
|
|
73
64
|
|
|
74
65
|
# Provides a debugging-friendly string with detailed object information.
|
|
75
66
|
def inspect
|
|
76
67
|
class_name = self.class.name.split('::').last
|
|
77
|
-
"<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}
|
|
68
|
+
"<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}>"
|
|
78
69
|
end
|
|
79
70
|
end
|
|
80
71
|
end
|
|
@@ -1,33 +1,36 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by APIMATIC v3.0
|
|
4
4
|
# ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
7
|
-
#
|
|
8
|
-
class
|
|
6
|
+
module SwaggerPetstore
|
|
7
|
+
# Category2 Model.
|
|
8
|
+
class Category2 < BaseModel
|
|
9
9
|
SKIP = Object.new
|
|
10
10
|
private_constant :SKIP
|
|
11
11
|
|
|
12
12
|
# TODO: Write general description for this method
|
|
13
|
-
# @return [
|
|
14
|
-
attr_accessor :
|
|
13
|
+
# @return [Integer]
|
|
14
|
+
attr_accessor :id
|
|
15
15
|
|
|
16
16
|
# TODO: Write general description for this method
|
|
17
17
|
# @return [String]
|
|
18
|
-
attr_accessor :
|
|
18
|
+
attr_accessor :name
|
|
19
19
|
|
|
20
20
|
# A mapping from model property names to API property names.
|
|
21
21
|
def self.names
|
|
22
22
|
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['id'] = 'id'
|
|
23
24
|
@_hash['name'] = 'name'
|
|
24
|
-
@_hash['type'] = 'type'
|
|
25
25
|
@_hash
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
# An array for optional fields
|
|
29
29
|
def self.optionals
|
|
30
|
-
[
|
|
30
|
+
%w[
|
|
31
|
+
id
|
|
32
|
+
name
|
|
33
|
+
]
|
|
31
34
|
end
|
|
32
35
|
|
|
33
36
|
# An array for nullable fields
|
|
@@ -35,9 +38,9 @@ module CypressTestApi
|
|
|
35
38
|
[]
|
|
36
39
|
end
|
|
37
40
|
|
|
38
|
-
def initialize(
|
|
39
|
-
@
|
|
40
|
-
@
|
|
41
|
+
def initialize(id = SKIP, name = SKIP)
|
|
42
|
+
@id = id unless id == SKIP
|
|
43
|
+
@name = name unless name == SKIP
|
|
41
44
|
end
|
|
42
45
|
|
|
43
46
|
# Creates an instance of the object from a hash.
|
|
@@ -45,24 +48,24 @@ module CypressTestApi
|
|
|
45
48
|
return nil unless hash
|
|
46
49
|
|
|
47
50
|
# Extract variables from the hash.
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
id = hash.key?('id') ? hash['id'] : SKIP
|
|
52
|
+
name = hash.key?('name') ? hash['name'] : SKIP
|
|
50
53
|
|
|
51
54
|
# Create object from extracted values.
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
Category2.new(id,
|
|
56
|
+
name)
|
|
54
57
|
end
|
|
55
58
|
|
|
56
59
|
# Provides a human-readable string representation of the object.
|
|
57
60
|
def to_s
|
|
58
61
|
class_name = self.class.name.split('::').last
|
|
59
|
-
"<#{class_name}
|
|
62
|
+
"<#{class_name} id: #{@id}, name: #{@name}>"
|
|
60
63
|
end
|
|
61
64
|
|
|
62
65
|
# Provides a debugging-friendly string with detailed object information.
|
|
63
66
|
def inspect
|
|
64
67
|
class_name = self.class.name.split('::').last
|
|
65
|
-
"<#{class_name}
|
|
68
|
+
"<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}>"
|
|
66
69
|
end
|
|
67
70
|
end
|
|
68
71
|
end
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
|
|
20
|
+
def self.from_value(value, default_value = ENUM_APPLICATIONXWWWFORMURLENCODED)
|
|
21
|
+
return default_value if value.nil?
|
|
22
|
+
|
|
23
|
+
default_value
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
|
|
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
|
|
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
|
+
|
|
23
|
+
def self.from_value(value, default_value = READPETS)
|
|
24
|
+
return default_value if value.nil?
|
|
25
|
+
|
|
26
|
+
str = value.to_s.strip
|
|
27
|
+
|
|
28
|
+
case str.downcase
|
|
29
|
+
when 'readpets' then READPETS
|
|
30
|
+
when 'writepets' then WRITEPETS
|
|
31
|
+
else
|
|
32
|
+
default_value
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|