wesley-key-sdk 0.1.3 → 0.1.6
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 +65 -57
- data/bin/console +15 -0
- data/lib/{swagger_petstore → cypress_test_api}/api_helper.rb +2 -2
- data/lib/cypress_test_api/client.rb +58 -0
- data/lib/cypress_test_api/configuration.rb +156 -0
- 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/cypress_test_api/http/proxy_settings.rb +22 -0
- data/lib/{swagger_petstore → cypress_test_api}/models/base_model.rb +2 -2
- data/lib/cypress_test_api/models/custom_enum.rb +40 -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 +44 -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 +40 -0
- data/lib/cypress_test_api/models/status1_enum.rb +40 -0
- data/lib/cypress_test_api/models/status_enum.rb +40 -0
- 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 -19
- data/test/controllers/test_api_controller.rb +40 -0
- data/test/http_response_catcher.rb +2 -2
- metadata +39 -45
- data/lib/swagger_petstore/client.rb +0 -84
- data/lib/swagger_petstore/configuration.rb +0 -127
- 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/http/proxy_settings.rb +0 -13
- 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/status_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,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,13 +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
|
-
##
|
|
8
|
-
# ProxySettings encapsulates HTTP proxy configuration for Faraday,
|
|
9
|
-
# including optional basic authentication.
|
|
10
|
-
#
|
|
11
|
-
class ProxySettings < CoreLibrary::ProxySettings
|
|
12
|
-
end
|
|
13
|
-
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
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
# swagger_petstore
|
|
2
|
-
#
|
|
3
|
-
# This file was automatically generated by APIMATIC v3.0
|
|
4
|
-
# ( https://www.apimatic.io ).
|
|
5
|
-
|
|
6
|
-
require 'date'
|
|
7
|
-
module SwaggerPetstore
|
|
8
|
-
# Order Model.
|
|
9
|
-
class Order < BaseModel
|
|
10
|
-
SKIP = Object.new
|
|
11
|
-
private_constant :SKIP
|
|
12
|
-
|
|
13
|
-
# TODO: Write general description for this method
|
|
14
|
-
# @return [Integer]
|
|
15
|
-
attr_accessor :id
|
|
16
|
-
|
|
17
|
-
# TODO: Write general description for this method
|
|
18
|
-
# @return [Integer]
|
|
19
|
-
attr_accessor :pet_id
|
|
20
|
-
|
|
21
|
-
# TODO: Write general description for this method
|
|
22
|
-
# @return [Integer]
|
|
23
|
-
attr_accessor :quantity
|
|
24
|
-
|
|
25
|
-
# TODO: Write general description for this method
|
|
26
|
-
# @return [DateTime]
|
|
27
|
-
attr_accessor :ship_date
|
|
28
|
-
|
|
29
|
-
# TODO: Write general description for this method
|
|
30
|
-
# @return [Status1Enum]
|
|
31
|
-
attr_accessor :status
|
|
32
|
-
|
|
33
|
-
# TODO: Write general description for this method
|
|
34
|
-
# @return [TrueClass | FalseClass]
|
|
35
|
-
attr_accessor :complete
|
|
36
|
-
|
|
37
|
-
# A mapping from model property names to API property names.
|
|
38
|
-
def self.names
|
|
39
|
-
@_hash = {} if @_hash.nil?
|
|
40
|
-
@_hash['id'] = 'id'
|
|
41
|
-
@_hash['pet_id'] = 'petId'
|
|
42
|
-
@_hash['quantity'] = 'quantity'
|
|
43
|
-
@_hash['ship_date'] = 'shipDate'
|
|
44
|
-
@_hash['status'] = 'status'
|
|
45
|
-
@_hash['complete'] = 'complete'
|
|
46
|
-
@_hash
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
# An array for optional fields
|
|
50
|
-
def self.optionals
|
|
51
|
-
%w[
|
|
52
|
-
id
|
|
53
|
-
pet_id
|
|
54
|
-
quantity
|
|
55
|
-
ship_date
|
|
56
|
-
status
|
|
57
|
-
complete
|
|
58
|
-
]
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
# An array for nullable fields
|
|
62
|
-
def self.nullables
|
|
63
|
-
[]
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def initialize(id = SKIP, pet_id = SKIP, quantity = SKIP, ship_date = SKIP,
|
|
67
|
-
status = SKIP, complete = SKIP)
|
|
68
|
-
@id = id unless id == SKIP
|
|
69
|
-
@pet_id = pet_id unless pet_id == SKIP
|
|
70
|
-
@quantity = quantity unless quantity == SKIP
|
|
71
|
-
@ship_date = ship_date unless ship_date == SKIP
|
|
72
|
-
@status = status unless status == SKIP
|
|
73
|
-
@complete = complete unless complete == SKIP
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
# Creates an instance of the object from a hash.
|
|
77
|
-
def self.from_hash(hash)
|
|
78
|
-
return nil unless hash
|
|
79
|
-
|
|
80
|
-
# Extract variables from the hash.
|
|
81
|
-
id = hash.key?('id') ? hash['id'] : SKIP
|
|
82
|
-
pet_id = hash.key?('petId') ? hash['petId'] : SKIP
|
|
83
|
-
quantity = hash.key?('quantity') ? hash['quantity'] : SKIP
|
|
84
|
-
ship_date = if hash.key?('shipDate')
|
|
85
|
-
(DateTimeHelper.from_rfc3339(hash['shipDate']) if hash['shipDate'])
|
|
86
|
-
else
|
|
87
|
-
SKIP
|
|
88
|
-
end
|
|
89
|
-
status = hash.key?('status') ? hash['status'] : SKIP
|
|
90
|
-
complete = hash.key?('complete') ? hash['complete'] : SKIP
|
|
91
|
-
|
|
92
|
-
# Create object from extracted values.
|
|
93
|
-
Order.new(id,
|
|
94
|
-
pet_id,
|
|
95
|
-
quantity,
|
|
96
|
-
ship_date,
|
|
97
|
-
status,
|
|
98
|
-
complete)
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
def to_custom_ship_date
|
|
102
|
-
DateTimeHelper.to_rfc3339(ship_date)
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
# Provides a human-readable string representation of the object.
|
|
106
|
-
def to_s
|
|
107
|
-
class_name = self.class.name.split('::').last
|
|
108
|
-
"<#{class_name} id: #{@id}, pet_id: #{@pet_id}, quantity: #{@quantity}, ship_date:"\
|
|
109
|
-
" #{@ship_date}, status: #{@status}, complete: #{@complete}>"
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
# Provides a debugging-friendly string with detailed object information.
|
|
113
|
-
def inspect
|
|
114
|
-
class_name = self.class.name.split('::').last
|
|
115
|
-
"<#{class_name} id: #{@id.inspect}, pet_id: #{@pet_id.inspect}, quantity:"\
|
|
116
|
-
" #{@quantity.inspect}, ship_date: #{@ship_date.inspect}, status: #{@status.inspect},"\
|
|
117
|
-
" complete: #{@complete.inspect}>"
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
end
|
|
@@ -1,117 +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
|
-
# Pet Model.
|
|
8
|
-
class Pet < 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 [Category2]
|
|
18
|
-
attr_accessor :category
|
|
19
|
-
|
|
20
|
-
# TODO: Write general description for this method
|
|
21
|
-
# @return [String]
|
|
22
|
-
attr_accessor :name
|
|
23
|
-
|
|
24
|
-
# TODO: Write general description for this method
|
|
25
|
-
# @return [Array[String]]
|
|
26
|
-
attr_accessor :photo_urls
|
|
27
|
-
|
|
28
|
-
# TODO: Write general description for this method
|
|
29
|
-
# @return [Array[Tag]]
|
|
30
|
-
attr_accessor :tags
|
|
31
|
-
|
|
32
|
-
# TODO: Write general description for this method
|
|
33
|
-
# @return [StatusEnum]
|
|
34
|
-
attr_accessor :status
|
|
35
|
-
|
|
36
|
-
# A mapping from model property names to API property names.
|
|
37
|
-
def self.names
|
|
38
|
-
@_hash = {} if @_hash.nil?
|
|
39
|
-
@_hash['id'] = 'id'
|
|
40
|
-
@_hash['category'] = 'category'
|
|
41
|
-
@_hash['name'] = 'name'
|
|
42
|
-
@_hash['photo_urls'] = 'photoUrls'
|
|
43
|
-
@_hash['tags'] = 'tags'
|
|
44
|
-
@_hash['status'] = 'status'
|
|
45
|
-
@_hash
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# An array for optional fields
|
|
49
|
-
def self.optionals
|
|
50
|
-
%w[
|
|
51
|
-
id
|
|
52
|
-
category
|
|
53
|
-
tags
|
|
54
|
-
status
|
|
55
|
-
]
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# An array for nullable fields
|
|
59
|
-
def self.nullables
|
|
60
|
-
[]
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def initialize(name = nil, photo_urls = nil, id = SKIP, category = SKIP,
|
|
64
|
-
tags = SKIP, status = SKIP)
|
|
65
|
-
@id = id unless id == SKIP
|
|
66
|
-
@category = category unless category == SKIP
|
|
67
|
-
@name = name
|
|
68
|
-
@photo_urls = photo_urls
|
|
69
|
-
@tags = tags unless tags == SKIP
|
|
70
|
-
@status = status unless status == SKIP
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
# Creates an instance of the object from a hash.
|
|
74
|
-
def self.from_hash(hash)
|
|
75
|
-
return nil unless hash
|
|
76
|
-
|
|
77
|
-
# Extract variables from the hash.
|
|
78
|
-
name = hash.key?('name') ? hash['name'] : nil
|
|
79
|
-
photo_urls = hash.key?('photoUrls') ? hash['photoUrls'] : nil
|
|
80
|
-
id = hash.key?('id') ? hash['id'] : SKIP
|
|
81
|
-
category = Category2.from_hash(hash['category']) if hash['category']
|
|
82
|
-
# Parameter is an array, so we need to iterate through it
|
|
83
|
-
tags = nil
|
|
84
|
-
unless hash['tags'].nil?
|
|
85
|
-
tags = []
|
|
86
|
-
hash['tags'].each do |structure|
|
|
87
|
-
tags << (Tag.from_hash(structure) if structure)
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
tags = SKIP unless hash.key?('tags')
|
|
92
|
-
status = hash.key?('status') ? hash['status'] : SKIP
|
|
93
|
-
|
|
94
|
-
# Create object from extracted values.
|
|
95
|
-
Pet.new(name,
|
|
96
|
-
photo_urls,
|
|
97
|
-
id,
|
|
98
|
-
category,
|
|
99
|
-
tags,
|
|
100
|
-
status)
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
# Provides a human-readable string representation of the object.
|
|
104
|
-
def to_s
|
|
105
|
-
class_name = self.class.name.split('::').last
|
|
106
|
-
"<#{class_name} id: #{@id}, category: #{@category}, name: #{@name}, photo_urls:"\
|
|
107
|
-
" #{@photo_urls}, tags: #{@tags}, status: #{@status}>"
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
# Provides a debugging-friendly string with detailed object information.
|
|
111
|
-
def inspect
|
|
112
|
-
class_name = self.class.name.split('::').last
|
|
113
|
-
"<#{class_name} id: #{@id.inspect}, category: #{@category.inspect}, name: #{@name.inspect},"\
|
|
114
|
-
" photo_urls: #{@photo_urls.inspect}, tags: #{@tags.inspect}, status: #{@status.inspect}>"
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
end
|
|
@@ -1,117 +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
|
-
# PetRequest Model.
|
|
8
|
-
class PetRequest < 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 [Category2]
|
|
18
|
-
attr_accessor :category
|
|
19
|
-
|
|
20
|
-
# TODO: Write general description for this method
|
|
21
|
-
# @return [String]
|
|
22
|
-
attr_accessor :name
|
|
23
|
-
|
|
24
|
-
# TODO: Write general description for this method
|
|
25
|
-
# @return [Array[String]]
|
|
26
|
-
attr_accessor :photo_urls
|
|
27
|
-
|
|
28
|
-
# TODO: Write general description for this method
|
|
29
|
-
# @return [Array[Tag]]
|
|
30
|
-
attr_accessor :tags
|
|
31
|
-
|
|
32
|
-
# TODO: Write general description for this method
|
|
33
|
-
# @return [StatusEnum]
|
|
34
|
-
attr_accessor :status
|
|
35
|
-
|
|
36
|
-
# A mapping from model property names to API property names.
|
|
37
|
-
def self.names
|
|
38
|
-
@_hash = {} if @_hash.nil?
|
|
39
|
-
@_hash['id'] = 'id'
|
|
40
|
-
@_hash['category'] = 'category'
|
|
41
|
-
@_hash['name'] = 'name'
|
|
42
|
-
@_hash['photo_urls'] = 'photoUrls'
|
|
43
|
-
@_hash['tags'] = 'tags'
|
|
44
|
-
@_hash['status'] = 'status'
|
|
45
|
-
@_hash
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# An array for optional fields
|
|
49
|
-
def self.optionals
|
|
50
|
-
%w[
|
|
51
|
-
id
|
|
52
|
-
category
|
|
53
|
-
tags
|
|
54
|
-
status
|
|
55
|
-
]
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# An array for nullable fields
|
|
59
|
-
def self.nullables
|
|
60
|
-
[]
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def initialize(name = nil, photo_urls = nil, id = SKIP, category = SKIP,
|
|
64
|
-
tags = SKIP, status = SKIP)
|
|
65
|
-
@id = id unless id == SKIP
|
|
66
|
-
@category = category unless category == SKIP
|
|
67
|
-
@name = name
|
|
68
|
-
@photo_urls = photo_urls
|
|
69
|
-
@tags = tags unless tags == SKIP
|
|
70
|
-
@status = status unless status == SKIP
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
# Creates an instance of the object from a hash.
|
|
74
|
-
def self.from_hash(hash)
|
|
75
|
-
return nil unless hash
|
|
76
|
-
|
|
77
|
-
# Extract variables from the hash.
|
|
78
|
-
name = hash.key?('name') ? hash['name'] : nil
|
|
79
|
-
photo_urls = hash.key?('photoUrls') ? hash['photoUrls'] : nil
|
|
80
|
-
id = hash.key?('id') ? hash['id'] : SKIP
|
|
81
|
-
category = Category2.from_hash(hash['category']) if hash['category']
|
|
82
|
-
# Parameter is an array, so we need to iterate through it
|
|
83
|
-
tags = nil
|
|
84
|
-
unless hash['tags'].nil?
|
|
85
|
-
tags = []
|
|
86
|
-
hash['tags'].each do |structure|
|
|
87
|
-
tags << (Tag.from_hash(structure) if structure)
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
tags = SKIP unless hash.key?('tags')
|
|
92
|
-
status = hash.key?('status') ? hash['status'] : SKIP
|
|
93
|
-
|
|
94
|
-
# Create object from extracted values.
|
|
95
|
-
PetRequest.new(name,
|
|
96
|
-
photo_urls,
|
|
97
|
-
id,
|
|
98
|
-
category,
|
|
99
|
-
tags,
|
|
100
|
-
status)
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
# Provides a human-readable string representation of the object.
|
|
104
|
-
def to_s
|
|
105
|
-
class_name = self.class.name.split('::').last
|
|
106
|
-
"<#{class_name} id: #{@id}, category: #{@category}, name: #{@name}, photo_urls:"\
|
|
107
|
-
" #{@photo_urls}, tags: #{@tags}, status: #{@status}>"
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
# Provides a debugging-friendly string with detailed object information.
|
|
111
|
-
def inspect
|
|
112
|
-
class_name = self.class.name.split('::').last
|
|
113
|
-
"<#{class_name} id: #{@id.inspect}, category: #{@category.inspect}, name: #{@name.inspect},"\
|
|
114
|
-
" photo_urls: #{@photo_urls.inspect}, tags: #{@tags.inspect}, status: #{@status.inspect}>"
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
end
|
|
@@ -1,26 +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
|
-
# Order Status
|
|
8
|
-
class Status1Enum
|
|
9
|
-
STATUS1_ENUM = [
|
|
10
|
-
# TODO: Write general description for PLACED
|
|
11
|
-
PLACED = 'placed'.freeze,
|
|
12
|
-
|
|
13
|
-
# TODO: Write general description for APPROVED
|
|
14
|
-
APPROVED = 'approved'.freeze,
|
|
15
|
-
|
|
16
|
-
# TODO: Write general description for DELIVERED
|
|
17
|
-
DELIVERED = 'delivered'.freeze
|
|
18
|
-
].freeze
|
|
19
|
-
|
|
20
|
-
def self.validate(value)
|
|
21
|
-
return false if value.nil?
|
|
22
|
-
|
|
23
|
-
STATUS1_ENUM.include?(value)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|