wesley-key-sdk 4.2.0 → 4.3.1
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 +34 -47
- data/bin/console +4 -4
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/api_helper.rb +2 -2
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/apis/base_api.rb +3 -3
- data/lib/webhooks_and_callbacks_api/apis/orders_api.rb +34 -0
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/client.rb +15 -34
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/configuration.rb +20 -30
- data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_a_handler.rb +66 -0
- data/lib/webhooks_and_callbacks_api/events/callbacks/callbacks_b_handler.rb +78 -0
- data/lib/webhooks_and_callbacks_api/events/signature_verification_failure.rb +33 -0
- data/lib/webhooks_and_callbacks_api/events/signature_verification_result.rb +14 -0
- data/lib/webhooks_and_callbacks_api/events/unknown_event.rb +32 -0
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_a_handler.rb +67 -0
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_b_handler.rb +86 -0
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_c_handler.rb +79 -0
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_handler.rb +67 -0
- data/lib/webhooks_and_callbacks_api/events/webhooks/webhooks_no_verification_handler.rb +39 -0
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/exceptions/api_exception.rb +2 -2
- data/lib/webhooks_and_callbacks_api/exceptions/error_exception.rb +57 -0
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/api_response.rb +2 -2
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/auth/api_key.rb +15 -15
- data/lib/webhooks_and_callbacks_api/http/auth/bearer_auth.rb +53 -0
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/http_call_back.rb +2 -2
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/http_method_enum.rb +2 -2
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/http_request.rb +2 -2
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/http_response.rb +2 -2
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/http/proxy_settings.rb +2 -2
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/logging/configuration/api_logging_configuration.rb +2 -2
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/logging/sdk_logger.rb +2 -2
- data/lib/webhooks_and_callbacks_api/models/address.rb +114 -0
- data/lib/webhooks_and_callbacks_api/models/audit_log_event.rb +115 -0
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/models/base_model.rb +2 -2
- data/lib/webhooks_and_callbacks_api/models/create_order_request.rb +131 -0
- data/lib/{swagger_petstore_open_api30/models/tag.rb → webhooks_and_callbacks_api/models/delivery_details.rb} +35 -36
- data/lib/webhooks_and_callbacks_api/models/email_notification_callback.rb +97 -0
- data/lib/webhooks_and_callbacks_api/models/event.rb +52 -0
- data/lib/webhooks_and_callbacks_api/models/event_type.rb +26 -0
- data/lib/webhooks_and_callbacks_api/models/event_type1.rb +26 -0
- data/lib/webhooks_and_callbacks_api/models/event_type2.rb +26 -0
- data/lib/webhooks_and_callbacks_api/models/event_type3.rb +26 -0
- data/lib/webhooks_and_callbacks_api/models/fulfillment_callback.rb +411 -0
- data/lib/webhooks_and_callbacks_api/models/fulfillment_status.rb +40 -0
- data/lib/webhooks_and_callbacks_api/models/fulfillment_statuss.rb +40 -0
- data/lib/webhooks_and_callbacks_api/models/inventory_stock_decrease_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/inventory_stock_depleted_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/inventory_stock_increase_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/notification_callback.rb +119 -0
- data/lib/webhooks_and_callbacks_api/models/oauth_scope_oauth_acg.rb +44 -0
- data/lib/webhooks_and_callbacks_api/models/order.rb +161 -0
- data/lib/webhooks_and_callbacks_api/models/order_created_event.rb +314 -0
- data/lib/webhooks_and_callbacks_api/models/order_item.rb +102 -0
- data/lib/webhooks_and_callbacks_api/models/order_updated_event.rb +100 -0
- data/lib/{swagger_petstore_open_api30/models/category.rb → webhooks_and_callbacks_api/models/package.rb} +29 -39
- data/lib/webhooks_and_callbacks_api/models/payment_callback.rb +167 -0
- data/lib/webhooks_and_callbacks_api/models/payment_completed_event.rb +98 -0
- data/lib/webhooks_and_callbacks_api/models/payment_status.rb +40 -0
- data/lib/webhooks_and_callbacks_api/models/payment_status_created_event.rb +89 -0
- data/lib/webhooks_and_callbacks_api/models/payment_status_updated_event.rb +89 -0
- data/lib/webhooks_and_callbacks_api/models/primitive_collection_event.rb +98 -0
- data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request.rb +40 -0
- data/lib/webhooks_and_callbacks_api/models/root_level_primitive_one_of_event_request1.rb +40 -0
- data/lib/webhooks_and_callbacks_api/models/sms_notification_callback.rb +95 -0
- data/lib/webhooks_and_callbacks_api/models/status.rb +44 -0
- data/lib/webhooks_and_callbacks_api/models/status1.rb +36 -0
- data/lib/webhooks_and_callbacks_api/models/status2.rb +36 -0
- data/lib/webhooks_and_callbacks_api/models/system_alert_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/system_maintenance_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/system_performance_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/user_action_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/user_preference_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/user_status_notification_event.rb +90 -0
- data/lib/webhooks_and_callbacks_api/models/webhook.rb +142 -0
- data/lib/webhooks_and_callbacks_api/models/webhook_registration.rb +103 -0
- data/lib/webhooks_and_callbacks_api/models/webhook_update.rb +105 -0
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/utilities/date_time_helper.rb +2 -2
- data/lib/{swagger_petstore_open_api30 → webhooks_and_callbacks_api}/utilities/file_wrapper.rb +2 -2
- data/lib/webhooks_and_callbacks_api/utilities/union_type_lookup.rb +172 -0
- data/lib/webhooks_and_callbacks_api.rb +122 -0
- metadata +78 -37
- data/lib/swagger_petstore_open_api30/apis/pet_api.rb +0 -287
- data/lib/swagger_petstore_open_api30/apis/store_api.rb +0 -131
- data/lib/swagger_petstore_open_api30/apis/user_api.rb +0 -233
- data/lib/swagger_petstore_open_api30/exceptions/oauth_provider_exception.rb +0 -64
- data/lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb +0 -112
- data/lib/swagger_petstore_open_api30/models/api_response.rb +0 -118
- data/lib/swagger_petstore_open_api30/models/oauth_provider_error.rb +0 -62
- data/lib/swagger_petstore_open_api30/models/oauth_scope_petstore_auth.rb +0 -36
- data/lib/swagger_petstore_open_api30/models/oauth_token.rb +0 -125
- data/lib/swagger_petstore_open_api30/models/order.rb +0 -167
- data/lib/swagger_petstore_open_api30/models/order_status.rb +0 -40
- data/lib/swagger_petstore_open_api30/models/pet.rb +0 -168
- data/lib/swagger_petstore_open_api30/models/pet_status.rb +0 -40
- data/lib/swagger_petstore_open_api30/models/user.rb +0 -182
- data/lib/swagger_petstore_open_api30/utilities/xml_utilities.rb +0 -12
- data/lib/swagger_petstore_open_api30.rb +0 -62
|
@@ -1,131 +0,0 @@
|
|
|
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
|
-
# StoreApi
|
|
8
|
-
class StoreApi < BaseApi
|
|
9
|
-
# Returns a map of status codes to quantities.
|
|
10
|
-
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
11
|
-
def get_inventory
|
|
12
|
-
@api_call
|
|
13
|
-
.request(new_request_builder(HttpMethodEnum::GET,
|
|
14
|
-
'/store/inventory',
|
|
15
|
-
Server::DEFAULT)
|
|
16
|
-
.auth(Single.new('api_key')))
|
|
17
|
-
.response(new_response_handler
|
|
18
|
-
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
|
19
|
-
.deserialize_into(proc do |response| response&.to_i end)
|
|
20
|
-
.is_api_response(true)
|
|
21
|
-
.is_primitive_response(true)
|
|
22
|
-
.local_error('default',
|
|
23
|
-
'Unexpected error',
|
|
24
|
-
APIException))
|
|
25
|
-
.execute
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# Place a new order in the store.
|
|
29
|
-
# @param [Integer] id Optional parameter: TODO: type description here
|
|
30
|
-
# @param [Integer] pet_id Optional parameter: TODO: type description here
|
|
31
|
-
# @param [Integer] quantity Optional parameter: TODO: type description
|
|
32
|
-
# here
|
|
33
|
-
# @param [DateTime] ship_date Optional parameter: TODO: type description
|
|
34
|
-
# here
|
|
35
|
-
# @param [OrderStatus] status Optional parameter: Order Status
|
|
36
|
-
# @param [TrueClass | FalseClass] complete Optional parameter: TODO: type
|
|
37
|
-
# description here
|
|
38
|
-
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
39
|
-
def place_order(id: nil,
|
|
40
|
-
pet_id: nil,
|
|
41
|
-
quantity: nil,
|
|
42
|
-
ship_date: nil,
|
|
43
|
-
status: nil,
|
|
44
|
-
complete: nil)
|
|
45
|
-
@api_call
|
|
46
|
-
.request(new_request_builder(HttpMethodEnum::POST,
|
|
47
|
-
'/store/order',
|
|
48
|
-
Server::DEFAULT)
|
|
49
|
-
.form_param(new_parameter(id, key: 'id'))
|
|
50
|
-
.form_param(new_parameter(pet_id, key: 'petId'))
|
|
51
|
-
.form_param(new_parameter(quantity, key: 'quantity'))
|
|
52
|
-
.form_param(new_parameter(ship_date, key: 'shipDate'))
|
|
53
|
-
.form_param(new_parameter(status, key: 'status'))
|
|
54
|
-
.form_param(new_parameter(complete, key: 'complete'))
|
|
55
|
-
.header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
|
|
56
|
-
.header_param(new_parameter('application/json', key: 'accept')))
|
|
57
|
-
.response(new_response_handler
|
|
58
|
-
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
59
|
-
.deserialize_into(Order.method(:from_hash))
|
|
60
|
-
.is_api_response(true)
|
|
61
|
-
.local_error('400',
|
|
62
|
-
'Invalid input',
|
|
63
|
-
APIException)
|
|
64
|
-
.local_error('422',
|
|
65
|
-
'Validation exception',
|
|
66
|
-
APIException)
|
|
67
|
-
.local_error('default',
|
|
68
|
-
'Unexpected error',
|
|
69
|
-
APIException))
|
|
70
|
-
.execute
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
# For valid response try integer IDs with value <= 5 or > 10. Other values
|
|
74
|
-
# will generate exceptions.
|
|
75
|
-
# @param [Integer] order_id Required parameter: ID of order that needs to be
|
|
76
|
-
# fetched
|
|
77
|
-
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
78
|
-
def get_order_by_id(order_id)
|
|
79
|
-
@api_call
|
|
80
|
-
.request(new_request_builder(HttpMethodEnum::GET,
|
|
81
|
-
'/store/order/{orderId}',
|
|
82
|
-
Server::DEFAULT)
|
|
83
|
-
.template_param(new_parameter(order_id, key: 'orderId')
|
|
84
|
-
.is_required(true)
|
|
85
|
-
.should_encode(true))
|
|
86
|
-
.header_param(new_parameter('application/json', key: 'accept')))
|
|
87
|
-
.response(new_response_handler
|
|
88
|
-
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
89
|
-
.deserialize_into(Order.method(:from_hash))
|
|
90
|
-
.is_api_response(true)
|
|
91
|
-
.local_error('400',
|
|
92
|
-
'Invalid ID supplied',
|
|
93
|
-
APIException)
|
|
94
|
-
.local_error('404',
|
|
95
|
-
'Order not found',
|
|
96
|
-
APIException)
|
|
97
|
-
.local_error('default',
|
|
98
|
-
'Unexpected error',
|
|
99
|
-
APIException))
|
|
100
|
-
.execute
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
# For valid response try integer IDs with value < 1000. Anything above 1000
|
|
104
|
-
# or non-integers will generate API errors.
|
|
105
|
-
# @param [Integer] order_id Required parameter: ID of the order that needs
|
|
106
|
-
# to be deleted
|
|
107
|
-
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
108
|
-
def delete_order(order_id)
|
|
109
|
-
@api_call
|
|
110
|
-
.request(new_request_builder(HttpMethodEnum::DELETE,
|
|
111
|
-
'/store/order/{orderId}',
|
|
112
|
-
Server::DEFAULT)
|
|
113
|
-
.template_param(new_parameter(order_id, key: 'orderId')
|
|
114
|
-
.is_required(true)
|
|
115
|
-
.should_encode(true)))
|
|
116
|
-
.response(new_response_handler
|
|
117
|
-
.is_response_void(true)
|
|
118
|
-
.is_api_response(true)
|
|
119
|
-
.local_error('400',
|
|
120
|
-
'Invalid ID supplied',
|
|
121
|
-
APIException)
|
|
122
|
-
.local_error('404',
|
|
123
|
-
'Order not found',
|
|
124
|
-
APIException)
|
|
125
|
-
.local_error('default',
|
|
126
|
-
'Unexpected error',
|
|
127
|
-
APIException))
|
|
128
|
-
.execute
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
end
|
|
@@ -1,233 +0,0 @@
|
|
|
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
|
-
# UserApi
|
|
8
|
-
class UserApi < BaseApi
|
|
9
|
-
# This can only be done by the logged in user.
|
|
10
|
-
# @param [Integer] id Optional parameter: TODO: type description here
|
|
11
|
-
# @param [String] username Optional parameter: TODO: type description here
|
|
12
|
-
# @param [String] first_name Optional parameter: TODO: type description
|
|
13
|
-
# here
|
|
14
|
-
# @param [String] last_name Optional parameter: TODO: type description
|
|
15
|
-
# here
|
|
16
|
-
# @param [String] email Optional parameter: TODO: type description here
|
|
17
|
-
# @param [String] password Optional parameter: TODO: type description here
|
|
18
|
-
# @param [String] phone Optional parameter: TODO: type description here
|
|
19
|
-
# @param [Integer] user_status Optional parameter: User Status
|
|
20
|
-
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
21
|
-
def create_user(id: nil,
|
|
22
|
-
username: nil,
|
|
23
|
-
first_name: nil,
|
|
24
|
-
last_name: nil,
|
|
25
|
-
email: nil,
|
|
26
|
-
password: nil,
|
|
27
|
-
phone: nil,
|
|
28
|
-
user_status: nil)
|
|
29
|
-
@api_call
|
|
30
|
-
.request(new_request_builder(HttpMethodEnum::POST,
|
|
31
|
-
'/user',
|
|
32
|
-
Server::DEFAULT)
|
|
33
|
-
.form_param(new_parameter(id, key: 'id'))
|
|
34
|
-
.form_param(new_parameter(username, key: 'username'))
|
|
35
|
-
.form_param(new_parameter(first_name, key: 'firstName'))
|
|
36
|
-
.form_param(new_parameter(last_name, key: 'lastName'))
|
|
37
|
-
.form_param(new_parameter(email, key: 'email'))
|
|
38
|
-
.form_param(new_parameter(password, key: 'password'))
|
|
39
|
-
.form_param(new_parameter(phone, key: 'phone'))
|
|
40
|
-
.form_param(new_parameter(user_status, key: 'userStatus'))
|
|
41
|
-
.header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
|
|
42
|
-
.header_param(new_parameter('application/json', key: 'accept')))
|
|
43
|
-
.response(new_response_handler
|
|
44
|
-
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
45
|
-
.deserialize_into(User.method(:from_hash))
|
|
46
|
-
.is_api_response(true)
|
|
47
|
-
.local_error('default',
|
|
48
|
-
'Unexpected error',
|
|
49
|
-
APIException))
|
|
50
|
-
.execute
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# Creates list of users with given input array.
|
|
54
|
-
# @param [Array[User]] body Optional parameter: TODO: type description
|
|
55
|
-
# here
|
|
56
|
-
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
57
|
-
def create_users_with_list_input(body: nil)
|
|
58
|
-
@api_call
|
|
59
|
-
.request(new_request_builder(HttpMethodEnum::POST,
|
|
60
|
-
'/user/createWithList',
|
|
61
|
-
Server::DEFAULT)
|
|
62
|
-
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
63
|
-
.body_param(new_parameter(body))
|
|
64
|
-
.header_param(new_parameter('application/json', key: 'accept'))
|
|
65
|
-
.body_serializer(proc do |param| param.to_json unless param.nil? end))
|
|
66
|
-
.response(new_response_handler
|
|
67
|
-
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
68
|
-
.deserialize_into(User.method(:from_hash))
|
|
69
|
-
.is_api_response(true)
|
|
70
|
-
.local_error('default',
|
|
71
|
-
'Unexpected error',
|
|
72
|
-
APIException))
|
|
73
|
-
.execute
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
# Log into the system.
|
|
77
|
-
# @param [String] username Optional parameter: The user name for login
|
|
78
|
-
# @param [String] password Optional parameter: The password for login in
|
|
79
|
-
# clear text
|
|
80
|
-
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
81
|
-
def login_user(username: nil,
|
|
82
|
-
password: nil)
|
|
83
|
-
@api_call
|
|
84
|
-
.request(new_request_builder(HttpMethodEnum::GET,
|
|
85
|
-
'/user/login',
|
|
86
|
-
Server::DEFAULT)
|
|
87
|
-
.query_param(new_parameter(username, key: 'username'))
|
|
88
|
-
.query_param(new_parameter(password, key: 'password'))
|
|
89
|
-
.header_param(new_parameter('application/xml', key: 'accept')))
|
|
90
|
-
.response(new_response_handler
|
|
91
|
-
.deserializer(XmlUtilities.method(:deserialize_xml))
|
|
92
|
-
.deserialize_into(String)
|
|
93
|
-
.is_xml_response(true)
|
|
94
|
-
.xml_attribute(XmlAttributes.new
|
|
95
|
-
.root_element_name('response'))
|
|
96
|
-
.is_api_response(true)
|
|
97
|
-
.is_primitive_response(true)
|
|
98
|
-
.local_error('400',
|
|
99
|
-
'Invalid username/password supplied',
|
|
100
|
-
APIException)
|
|
101
|
-
.local_error('default',
|
|
102
|
-
'Unexpected error',
|
|
103
|
-
APIException))
|
|
104
|
-
.execute
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
# Log user out of the system.
|
|
108
|
-
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
109
|
-
def logout_user
|
|
110
|
-
@api_call
|
|
111
|
-
.request(new_request_builder(HttpMethodEnum::GET,
|
|
112
|
-
'/user/logout',
|
|
113
|
-
Server::DEFAULT))
|
|
114
|
-
.response(new_response_handler
|
|
115
|
-
.is_response_void(true)
|
|
116
|
-
.is_api_response(true)
|
|
117
|
-
.local_error('default',
|
|
118
|
-
'Unexpected error',
|
|
119
|
-
APIException))
|
|
120
|
-
.execute
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
# Get user detail based on username.
|
|
124
|
-
# @param [String] usersname Required parameter: The username that needs to
|
|
125
|
-
# be processed
|
|
126
|
-
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
127
|
-
def get_user_by_name(usersname)
|
|
128
|
-
@api_call
|
|
129
|
-
.request(new_request_builder(HttpMethodEnum::GET,
|
|
130
|
-
'/user/{usersname}',
|
|
131
|
-
Server::DEFAULT)
|
|
132
|
-
.template_param(new_parameter(usersname, key: 'usersname')
|
|
133
|
-
.is_required(true)
|
|
134
|
-
.should_encode(true))
|
|
135
|
-
.header_param(new_parameter('application/json', key: 'accept')))
|
|
136
|
-
.response(new_response_handler
|
|
137
|
-
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
138
|
-
.deserialize_into(User.method(:from_hash))
|
|
139
|
-
.is_api_response(true)
|
|
140
|
-
.local_error('400',
|
|
141
|
-
'Invalid username supplied',
|
|
142
|
-
APIException)
|
|
143
|
-
.local_error('404',
|
|
144
|
-
'User not found',
|
|
145
|
-
APIException)
|
|
146
|
-
.local_error('default',
|
|
147
|
-
'Unexpected error',
|
|
148
|
-
APIException))
|
|
149
|
-
.execute
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
# This can only be done by the logged in user.
|
|
153
|
-
# @param [String] usersname Required parameter: The username that needs to
|
|
154
|
-
# be processed
|
|
155
|
-
# @param [Integer] id Optional parameter: TODO: type description here
|
|
156
|
-
# @param [String] username Optional parameter: TODO: type description here
|
|
157
|
-
# @param [String] first_name Optional parameter: TODO: type description
|
|
158
|
-
# here
|
|
159
|
-
# @param [String] last_name Optional parameter: TODO: type description
|
|
160
|
-
# here
|
|
161
|
-
# @param [String] email Optional parameter: TODO: type description here
|
|
162
|
-
# @param [String] password Optional parameter: TODO: type description here
|
|
163
|
-
# @param [String] phone Optional parameter: TODO: type description here
|
|
164
|
-
# @param [Integer] user_status Optional parameter: User Status
|
|
165
|
-
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
166
|
-
def update_user(usersname,
|
|
167
|
-
id: nil,
|
|
168
|
-
username: nil,
|
|
169
|
-
first_name: nil,
|
|
170
|
-
last_name: nil,
|
|
171
|
-
email: nil,
|
|
172
|
-
password: nil,
|
|
173
|
-
phone: nil,
|
|
174
|
-
user_status: nil)
|
|
175
|
-
@api_call
|
|
176
|
-
.request(new_request_builder(HttpMethodEnum::PUT,
|
|
177
|
-
'/user/{usersname}',
|
|
178
|
-
Server::DEFAULT)
|
|
179
|
-
.template_param(new_parameter(usersname, key: 'usersname')
|
|
180
|
-
.is_required(true)
|
|
181
|
-
.should_encode(true))
|
|
182
|
-
.form_param(new_parameter(id, key: 'id'))
|
|
183
|
-
.form_param(new_parameter(username, key: 'username'))
|
|
184
|
-
.form_param(new_parameter(first_name, key: 'firstName'))
|
|
185
|
-
.form_param(new_parameter(last_name, key: 'lastName'))
|
|
186
|
-
.form_param(new_parameter(email, key: 'email'))
|
|
187
|
-
.form_param(new_parameter(password, key: 'password'))
|
|
188
|
-
.form_param(new_parameter(phone, key: 'phone'))
|
|
189
|
-
.form_param(new_parameter(user_status, key: 'userStatus'))
|
|
190
|
-
.header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type')))
|
|
191
|
-
.response(new_response_handler
|
|
192
|
-
.is_response_void(true)
|
|
193
|
-
.is_api_response(true)
|
|
194
|
-
.local_error('400',
|
|
195
|
-
'bad request',
|
|
196
|
-
APIException)
|
|
197
|
-
.local_error('404',
|
|
198
|
-
'user not found',
|
|
199
|
-
APIException)
|
|
200
|
-
.local_error('default',
|
|
201
|
-
'Unexpected error',
|
|
202
|
-
APIException))
|
|
203
|
-
.execute
|
|
204
|
-
end
|
|
205
|
-
|
|
206
|
-
# This can only be done by the logged in user.
|
|
207
|
-
# @param [String] usersname Required parameter: The username that needs to
|
|
208
|
-
# be processed
|
|
209
|
-
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
210
|
-
def delete_user(usersname)
|
|
211
|
-
@api_call
|
|
212
|
-
.request(new_request_builder(HttpMethodEnum::DELETE,
|
|
213
|
-
'/user/{usersname}',
|
|
214
|
-
Server::DEFAULT)
|
|
215
|
-
.template_param(new_parameter(usersname, key: 'usersname')
|
|
216
|
-
.is_required(true)
|
|
217
|
-
.should_encode(true)))
|
|
218
|
-
.response(new_response_handler
|
|
219
|
-
.is_response_void(true)
|
|
220
|
-
.is_api_response(true)
|
|
221
|
-
.local_error('400',
|
|
222
|
-
'Invalid username supplied',
|
|
223
|
-
APIException)
|
|
224
|
-
.local_error('404',
|
|
225
|
-
'User not found',
|
|
226
|
-
APIException)
|
|
227
|
-
.local_error('default',
|
|
228
|
-
'Unexpected error',
|
|
229
|
-
APIException))
|
|
230
|
-
.execute
|
|
231
|
-
end
|
|
232
|
-
end
|
|
233
|
-
end
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# swagger_petstore_open_api30
|
|
2
|
-
#
|
|
3
|
-
# This file was automatically generated by
|
|
4
|
-
# APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
-
|
|
6
|
-
module SwaggerPetstoreOpenApi30
|
|
7
|
-
# OAuth 2 Authorization endpoint exception.
|
|
8
|
-
class OauthProviderException < APIException
|
|
9
|
-
SKIP = Object.new
|
|
10
|
-
private_constant :SKIP
|
|
11
|
-
|
|
12
|
-
# Gets or sets error code.
|
|
13
|
-
# @return [OauthProviderError]
|
|
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,112 +0,0 @@
|
|
|
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,118 +0,0 @@
|
|
|
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
|