wesley-key-sdk 4.0.0 → 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 +47 -34
- data/bin/console +4 -4
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/api_helper.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/apis/base_api.rb +3 -3
- 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/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/client.rb +34 -15
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/configuration.rb +30 -20
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/exceptions/api_exception.rb +2 -2
- data/lib/swagger_petstore_open_api30/exceptions/oauth_provider_exception.rb +64 -0
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/api_response.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/auth/api_key.rb +15 -15
- data/lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb +112 -0
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_call_back.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_method_enum.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_request.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_response.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/proxy_settings.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/logging/configuration/api_logging_configuration.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/logging/sdk_logger.rb +2 -2
- data/lib/swagger_petstore_open_api30/models/api_response.rb +118 -0
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/models/base_model.rb +2 -2
- data/lib/{webhooks_and_callbacks_api/models/package.rb → swagger_petstore_open_api30/models/category.rb} +39 -29
- 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/{webhooks_and_callbacks_api/models/delivery_details.rb → swagger_petstore_open_api30/models/tag.rb} +36 -35
- data/lib/swagger_petstore_open_api30/models/user.rb +182 -0
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/utilities/date_time_helper.rb +2 -2
- data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/utilities/file_wrapper.rb +2 -2
- data/lib/swagger_petstore_open_api30/utilities/xml_utilities.rb +12 -0
- data/lib/swagger_petstore_open_api30.rb +62 -0
- metadata +37 -78
- data/lib/webhooks_and_callbacks_api/apis/orders_api.rb +0 -34
- data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_a_handler.rb +0 -66
- data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_b_handler.rb +0 -78
- data/lib/webhooks_and_callbacks_api/events/signature_verification_failure.rb +0 -33
- data/lib/webhooks_and_callbacks_api/events/signature_verification_result.rb +0 -14
- data/lib/webhooks_and_callbacks_api/events/unknown_event.rb +0 -32
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_a_handler.rb +0 -67
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_b_handler.rb +0 -86
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_c_handler.rb +0 -79
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_handler.rb +0 -67
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_no_verification_handler.rb +0 -39
- data/lib/webhooks_and_callbacks_api/exceptions/error_exception.rb +0 -57
- data/lib/webhooks_and_callbacks_api/http/auth/bearer_auth.rb +0 -53
- data/lib/webhooks_and_callbacks_api/models/address.rb +0 -114
- data/lib/webhooks_and_callbacks_api/models/audit_log_event.rb +0 -115
- data/lib/webhooks_and_callbacks_api/models/create_order_request.rb +0 -131
- data/lib/webhooks_and_callbacks_api/models/email_notification_callback.rb +0 -97
- data/lib/webhooks_and_callbacks_api/models/event.rb +0 -52
- data/lib/webhooks_and_callbacks_api/models/event_type.rb +0 -26
- data/lib/webhooks_and_callbacks_api/models/event_type1.rb +0 -26
- data/lib/webhooks_and_callbacks_api/models/event_type2.rb +0 -26
- data/lib/webhooks_and_callbacks_api/models/event_type3.rb +0 -26
- data/lib/webhooks_and_callbacks_api/models/fulfillment_callback.rb +0 -411
- data/lib/webhooks_and_callbacks_api/models/fulfillment_status.rb +0 -40
- data/lib/webhooks_and_callbacks_api/models/fulfillment_statuss.rb +0 -40
- data/lib/webhooks_and_callbacks_api/models/inventory_stock_decrease_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/inventory_stock_depleted_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/inventory_stock_increase_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/notification_callback.rb +0 -119
- data/lib/webhooks_and_callbacks_api/models/oauth_scope_oauth_acg.rb +0 -44
- data/lib/webhooks_and_callbacks_api/models/order.rb +0 -161
- data/lib/webhooks_and_callbacks_api/models/order_created_event.rb +0 -314
- data/lib/webhooks_and_callbacks_api/models/order_item.rb +0 -102
- data/lib/webhooks_and_callbacks_api/models/order_updated_event.rb +0 -100
- data/lib/webhooks_and_callbacks_api/models/payment_callback.rb +0 -167
- data/lib/webhooks_and_callbacks_api/models/payment_completed_event.rb +0 -98
- data/lib/webhooks_and_callbacks_api/models/payment_status.rb +0 -40
- data/lib/webhooks_and_callbacks_api/models/payment_status_created_event.rb +0 -89
- data/lib/webhooks_and_callbacks_api/models/payment_status_updated_event.rb +0 -89
- data/lib/webhooks_and_callbacks_api/models/primitive_collection_event.rb +0 -98
- data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request.rb +0 -40
- data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request1.rb +0 -40
- data/lib/webhooks_and_callbacks_api/models/sms_notification_callback.rb +0 -95
- data/lib/webhooks_and_callbacks_api/models/status.rb +0 -44
- data/lib/webhooks_and_callbacks_api/models/status1.rb +0 -36
- data/lib/webhooks_and_callbacks_api/models/status2.rb +0 -36
- data/lib/webhooks_and_callbacks_api/models/system_alert_notification_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/system_maintenance_notification_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/system_performance_notification_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/user_action_notification_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/user_preference_notification_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/user_status_notification_event.rb +0 -90
- data/lib/webhooks_and_callbacks_api/models/webhook.rb +0 -142
- data/lib/webhooks_and_callbacks_api/models/webhook_registration.rb +0 -103
- data/lib/webhooks_and_callbacks_api/models/webhook_update.rb +0 -105
- data/lib/webhooks_and_callbacks_api/utilities/union_type_lookup.rb +0 -172
- data/lib/webhooks_and_callbacks_api.rb +0 -122
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
# 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
|
+
@_oauth_client_id = petstore_auth_credentials.oauth_client_id unless
|
|
20
|
+
petstore_auth_credentials.nil? || petstore_auth_credentials.oauth_client_id.nil?
|
|
21
|
+
@_oauth_redirect_uri = petstore_auth_credentials.oauth_redirect_uri unless
|
|
22
|
+
petstore_auth_credentials.nil? || petstore_auth_credentials.oauth_redirect_uri.nil?
|
|
23
|
+
@_oauth_token = petstore_auth_credentials.oauth_token unless
|
|
24
|
+
petstore_auth_credentials.nil? || petstore_auth_credentials.oauth_token.nil?
|
|
25
|
+
@_oauth_scopes = petstore_auth_credentials.oauth_scopes unless
|
|
26
|
+
petstore_auth_credentials.nil? || petstore_auth_credentials.oauth_scopes.nil?
|
|
27
|
+
@_o_auth_api = OauthAuthorizationApi.new(config)
|
|
28
|
+
auth_params[:Authorization] = "Bearer #{@_oauth_token.access_token}" unless @_oauth_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
|
+
!@_oauth_token.nil? && !token_expired?(@_oauth_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::AUTH_SERVER)
|
|
47
|
+
auth_url += '/authorize'
|
|
48
|
+
query_params = {
|
|
49
|
+
'response_type' => 'code',
|
|
50
|
+
'client_id' => @_oauth_client_id,
|
|
51
|
+
'redirect_uri' => @_oauth_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 :oauth_client_id, :oauth_redirect_uri, :oauth_token,
|
|
72
|
+
:oauth_scopes
|
|
73
|
+
|
|
74
|
+
def initialize(oauth_client_id:, oauth_redirect_uri:, oauth_token: nil,
|
|
75
|
+
oauth_scopes: nil)
|
|
76
|
+
raise ArgumentError, 'oauth_client_id cannot be nil' if oauth_client_id.nil?
|
|
77
|
+
raise ArgumentError, 'oauth_redirect_uri cannot be nil' if oauth_redirect_uri.nil?
|
|
78
|
+
|
|
79
|
+
@oauth_client_id = oauth_client_id
|
|
80
|
+
@oauth_redirect_uri = oauth_redirect_uri
|
|
81
|
+
@oauth_token = oauth_token
|
|
82
|
+
@oauth_scopes = oauth_scopes
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def self.from_env
|
|
86
|
+
oauth_client_id = ENV['PETSTORE_AUTH_OAUTH_CLIENT_ID']
|
|
87
|
+
oauth_redirect_uri = ENV['PETSTORE_AUTH_OAUTH_REDIRECT_URI']
|
|
88
|
+
oauth_scopes = ENV['PETSTORE_AUTH_OAUTH_SCOPES']
|
|
89
|
+
all_nil = [
|
|
90
|
+
oauth_client_id,
|
|
91
|
+
oauth_redirect_uri
|
|
92
|
+
].all?(&:nil?)
|
|
93
|
+
return nil if all_nil
|
|
94
|
+
|
|
95
|
+
new(oauth_client_id: oauth_client_id,
|
|
96
|
+
oauth_redirect_uri: oauth_redirect_uri, oauth_scopes: oauth_scopes)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def clone_with(oauth_client_id: nil, oauth_redirect_uri: nil,
|
|
100
|
+
oauth_token: nil, oauth_scopes: nil)
|
|
101
|
+
oauth_client_id ||= self.oauth_client_id
|
|
102
|
+
oauth_redirect_uri ||= self.oauth_redirect_uri
|
|
103
|
+
oauth_token ||= self.oauth_token
|
|
104
|
+
oauth_scopes ||= self.oauth_scopes
|
|
105
|
+
|
|
106
|
+
PetstoreAuthCredentials.new(oauth_client_id: oauth_client_id,
|
|
107
|
+
oauth_redirect_uri: oauth_redirect_uri,
|
|
108
|
+
oauth_token: oauth_token,
|
|
109
|
+
oauth_scopes: oauth_scopes)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by
|
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
7
|
# HttpCallBack allows defining callables for pre and post API calls.
|
|
8
8
|
class HttpCallBack < CoreLibrary::HttpCallback
|
|
9
9
|
end
|
data/lib/{webhooks_and_callbacks_api → swagger_petstore_open_api30}/http/http_method_enum.rb
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by
|
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
7
|
# HTTP Methods Enumeration.
|
|
8
8
|
class HttpMethodEnum < CoreLibrary::HttpMethod
|
|
9
9
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by
|
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
7
|
# Represents a single Http Request.
|
|
8
8
|
class HttpRequest < CoreLibrary::HttpRequest
|
|
9
9
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by
|
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
7
|
# Http response received.
|
|
8
8
|
class HttpResponse < CoreLibrary::HttpResponse
|
|
9
9
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by
|
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
7
|
##
|
|
8
8
|
# ProxySettings encapsulates HTTP proxy configuration for Faraday,
|
|
9
9
|
# including optional basic authentication.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by
|
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
7
|
# Initializes a new instance of RequestLoggingConfiguration.
|
|
8
8
|
class RequestLoggingConfiguration < CoreLibrary::ApiRequestLoggingConfiguration
|
|
9
9
|
# @param log_body [Boolean] Indicates whether the message body should be logged. Default is false.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by
|
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
7
7
|
# Represents the generic logger facade
|
|
8
8
|
class AbstractLogger < Logger
|
|
9
9
|
# Logs a message with a specified log level and additional parameters.
|
|
@@ -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
3
|
# This file was automatically generated by
|
|
4
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
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# swagger_petstore_open_api30
|
|
2
2
|
#
|
|
3
3
|
# This file was automatically generated by
|
|
4
4
|
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
5
|
|
|
6
|
-
module
|
|
7
|
-
#
|
|
8
|
-
class
|
|
6
|
+
module SwaggerPetstoreOpenApi30
|
|
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 [
|
|
14
|
-
attr_accessor :
|
|
13
|
+
# @return [Integer]
|
|
14
|
+
attr_accessor :id
|
|
15
15
|
|
|
16
16
|
# TODO: Write general description for this method
|
|
17
|
-
# @return [
|
|
18
|
-
attr_accessor :
|
|
17
|
+
# @return [String]
|
|
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['
|
|
24
|
-
@_hash['
|
|
23
|
+
@_hash['id'] = 'id'
|
|
24
|
+
@_hash['name'] = 'name'
|
|
25
25
|
@_hash
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
# An array for optional fields
|
|
29
29
|
def self.optionals
|
|
30
30
|
%w[
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
id
|
|
32
|
+
name
|
|
33
33
|
]
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -38,12 +38,12 @@ module WebhooksAndCallbacksApi
|
|
|
38
38
|
[]
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
def initialize(
|
|
41
|
+
def initialize(id: SKIP, name: SKIP, additional_properties: nil)
|
|
42
42
|
# Add additional model properties to the instance
|
|
43
43
|
additional_properties = {} if additional_properties.nil?
|
|
44
44
|
|
|
45
|
-
@
|
|
46
|
-
@
|
|
45
|
+
@id = id unless id == SKIP
|
|
46
|
+
@name = name unless name == SKIP
|
|
47
47
|
@additional_properties = additional_properties
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -52,8 +52,8 @@ module WebhooksAndCallbacksApi
|
|
|
52
52
|
return nil unless hash
|
|
53
53
|
|
|
54
54
|
# Extract variables from the hash.
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
id = hash.key?('id') ? hash['id'] : SKIP
|
|
56
|
+
name = hash.key?('name') ? hash['name'] : SKIP
|
|
57
57
|
|
|
58
58
|
# Create a new hash for additional properties, removing known properties.
|
|
59
59
|
new_hash = hash.reject { |k, _| names.value?(k) }
|
|
@@ -63,33 +63,43 @@ module WebhooksAndCallbacksApi
|
|
|
63
63
|
)
|
|
64
64
|
|
|
65
65
|
# Create object from extracted values.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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)
|
|
69
78
|
end
|
|
70
79
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def self.validate(value)
|
|
74
|
-
return true if value.instance_of? self
|
|
80
|
+
def to_xml_element(doc, root_name)
|
|
81
|
+
root = doc.create_element(root_name)
|
|
75
82
|
|
|
76
|
-
|
|
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)
|
|
77
87
|
|
|
78
|
-
|
|
88
|
+
root
|
|
79
89
|
end
|
|
80
90
|
|
|
81
91
|
# Provides a human-readable string representation of the object.
|
|
82
92
|
def to_s
|
|
83
93
|
class_name = self.class.name.split('::').last
|
|
84
|
-
"<#{class_name}
|
|
94
|
+
"<#{class_name} id: #{@id}, name: #{@name}, additional_properties:"\
|
|
85
95
|
" #{@additional_properties}>"
|
|
86
96
|
end
|
|
87
97
|
|
|
88
98
|
# Provides a debugging-friendly string with detailed object information.
|
|
89
99
|
def inspect
|
|
90
100
|
class_name = self.class.name.split('::').last
|
|
91
|
-
"<#{class_name}
|
|
92
|
-
"
|
|
101
|
+
"<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, additional_properties:"\
|
|
102
|
+
" #{@additional_properties}>"
|
|
93
103
|
end
|
|
94
104
|
end
|
|
95
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
|