CalculatorApimatic 1.0.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 +7 -0
- data/LICENSE +28 -0
- data/README.md +113 -0
- data/lib/swagger_petstore/api_helper.rb +10 -0
- data/lib/swagger_petstore/client.rb +76 -0
- data/lib/swagger_petstore/configuration.rb +129 -0
- data/lib/swagger_petstore/controllers/base_controller.rb +65 -0
- data/lib/swagger_petstore/controllers/pet_controller.rb +204 -0
- data/lib/swagger_petstore/controllers/store_controller.rb +97 -0
- data/lib/swagger_petstore/controllers/user_controller.rb +185 -0
- data/lib/swagger_petstore/exceptions/api_exception.rb +10 -0
- data/lib/swagger_petstore/exceptions/o_auth_provider_exception.rb +48 -0
- data/lib/swagger_petstore/http/http_call_back.rb +10 -0
- data/lib/swagger_petstore/http/http_method_enum.rb +10 -0
- data/lib/swagger_petstore/http/http_request.rb +10 -0
- data/lib/swagger_petstore/http/http_response.rb +10 -0
- data/lib/swagger_petstore/models/api_response.rb +70 -0
- data/lib/swagger_petstore/models/base_model.rb +58 -0
- data/lib/swagger_petstore/models/category.rb +60 -0
- data/lib/swagger_petstore/models/o_auth_provider_error_enum.rb +39 -0
- data/lib/swagger_petstore/models/o_auth_scope_enum.rb +17 -0
- data/lib/swagger_petstore/models/o_auth_token.rb +100 -0
- data/lib/swagger_petstore/models/order.rb +109 -0
- data/lib/swagger_petstore/models/pet.rb +107 -0
- data/lib/swagger_petstore/models/status1_enum.rb +20 -0
- data/lib/swagger_petstore/models/status2_enum.rb +20 -0
- data/lib/swagger_petstore/models/status_enum.rb +20 -0
- data/lib/swagger_petstore/models/tag.rb +60 -0
- data/lib/swagger_petstore/models/user.rb +120 -0
- data/lib/swagger_petstore/utilities/date_time_helper.rb +11 -0
- data/lib/swagger_petstore/utilities/file_wrapper.rb +16 -0
- data/lib/swagger_petstore.rb +54 -0
- metadata +117 -0
@@ -0,0 +1,97 @@
|
|
1
|
+
# swagger_petstore
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SwaggerPetstore
|
7
|
+
# StoreController
|
8
|
+
class StoreController < BaseController
|
9
|
+
# Place an order for a pet
|
10
|
+
# @param [Order] body Required parameter: order placed for purchasing the
|
11
|
+
# pet
|
12
|
+
# @return [Order] response from the API call
|
13
|
+
def place_order(body)
|
14
|
+
new_api_call_builder
|
15
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
16
|
+
'/store/order',
|
17
|
+
Server::SERVER1)
|
18
|
+
.body_param(new_parameter(body))
|
19
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
20
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
21
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
22
|
+
.auth(Single.new('global')))
|
23
|
+
.response(new_response_handler
|
24
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
25
|
+
.deserialize_into(Order.method(:from_hash))
|
26
|
+
.local_error('400',
|
27
|
+
'Invalid Order',
|
28
|
+
APIException))
|
29
|
+
.execute
|
30
|
+
end
|
31
|
+
|
32
|
+
# For valid response try integer IDs with value >= 1 and <= 10. Other values
|
33
|
+
# will generated exceptions
|
34
|
+
# @param [Integer] order_id Required parameter: ID of pet that needs to be
|
35
|
+
# fetched
|
36
|
+
# @return [Order] response from the API call
|
37
|
+
def get_order_by_id(order_id)
|
38
|
+
new_api_call_builder
|
39
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
40
|
+
'/store/order/{orderId}',
|
41
|
+
Server::SERVER1)
|
42
|
+
.template_param(new_parameter(order_id, key: 'orderId')
|
43
|
+
.should_encode(true))
|
44
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
45
|
+
.auth(Single.new('global')))
|
46
|
+
.response(new_response_handler
|
47
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
48
|
+
.deserialize_into(Order.method(:from_hash))
|
49
|
+
.local_error('400',
|
50
|
+
'Invalid ID supplied',
|
51
|
+
APIException)
|
52
|
+
.local_error('404',
|
53
|
+
'Order not found',
|
54
|
+
APIException))
|
55
|
+
.execute
|
56
|
+
end
|
57
|
+
|
58
|
+
# For valid response try integer IDs with positive integer value. Negative
|
59
|
+
# or non-integer values will generate API errors
|
60
|
+
# @param [Integer] order_id Required parameter: ID of the order that needs
|
61
|
+
# to be deleted
|
62
|
+
# @return [void] response from the API call
|
63
|
+
def delete_order(order_id)
|
64
|
+
new_api_call_builder
|
65
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
66
|
+
'/store/order/{orderId}',
|
67
|
+
Server::SERVER1)
|
68
|
+
.template_param(new_parameter(order_id, key: 'orderId')
|
69
|
+
.should_encode(true))
|
70
|
+
.auth(Single.new('global')))
|
71
|
+
.response(new_response_handler
|
72
|
+
.is_response_void(true)
|
73
|
+
.local_error('400',
|
74
|
+
'Invalid ID supplied',
|
75
|
+
APIException)
|
76
|
+
.local_error('404',
|
77
|
+
'Order not found',
|
78
|
+
APIException))
|
79
|
+
.execute
|
80
|
+
end
|
81
|
+
|
82
|
+
# Returns a map of status codes to quantities
|
83
|
+
# @return [Hash of Integer] response from the API call
|
84
|
+
def get_inventory
|
85
|
+
new_api_call_builder
|
86
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
87
|
+
'/store/inventory',
|
88
|
+
Server::SERVER1)
|
89
|
+
.auth(Single.new('global')))
|
90
|
+
.response(new_response_handler
|
91
|
+
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
92
|
+
.deserialize_into(proc do |response| response.to_i end)
|
93
|
+
.is_primitive_response(true))
|
94
|
+
.execute
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,185 @@
|
|
1
|
+
# swagger_petstore
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SwaggerPetstore
|
7
|
+
# UserController
|
8
|
+
class UserController < BaseController
|
9
|
+
# Creates list of users with given input array
|
10
|
+
# @param [List of User] body Required parameter: List of user object
|
11
|
+
# @return [void] response from the API call
|
12
|
+
def create_users_with_array_input(body)
|
13
|
+
new_api_call_builder
|
14
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
15
|
+
'/user/createWithArray',
|
16
|
+
Server::SERVER1)
|
17
|
+
.body_param(new_parameter(body))
|
18
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
19
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
20
|
+
.auth(Single.new('global')))
|
21
|
+
.response(new_response_handler
|
22
|
+
.is_response_void(true)
|
23
|
+
.local_error('default',
|
24
|
+
'successful operation',
|
25
|
+
APIException))
|
26
|
+
.execute
|
27
|
+
end
|
28
|
+
|
29
|
+
# Creates list of users with given input array
|
30
|
+
# @param [List of User] body Required parameter: List of user object
|
31
|
+
# @return [void] response from the API call
|
32
|
+
def create_users_with_list_input(body)
|
33
|
+
new_api_call_builder
|
34
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
35
|
+
'/user/createWithList',
|
36
|
+
Server::SERVER1)
|
37
|
+
.body_param(new_parameter(body))
|
38
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
39
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
40
|
+
.auth(Single.new('global')))
|
41
|
+
.response(new_response_handler
|
42
|
+
.is_response_void(true)
|
43
|
+
.local_error('default',
|
44
|
+
'successful operation',
|
45
|
+
APIException))
|
46
|
+
.execute
|
47
|
+
end
|
48
|
+
|
49
|
+
# Get user by user name
|
50
|
+
# @param [String] username Required parameter: The name that needs to be
|
51
|
+
# fetched. Use user1 for testing.
|
52
|
+
# @return [User] response from the API call
|
53
|
+
def get_user_by_name(username)
|
54
|
+
new_api_call_builder
|
55
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
56
|
+
'/user/{username}',
|
57
|
+
Server::SERVER1)
|
58
|
+
.template_param(new_parameter(username, key: 'username')
|
59
|
+
.should_encode(true))
|
60
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
61
|
+
.auth(Single.new('global')))
|
62
|
+
.response(new_response_handler
|
63
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
64
|
+
.deserialize_into(User.method(:from_hash))
|
65
|
+
.local_error('400',
|
66
|
+
'Invalid username supplied',
|
67
|
+
APIException)
|
68
|
+
.local_error('404',
|
69
|
+
'User not found',
|
70
|
+
APIException))
|
71
|
+
.execute
|
72
|
+
end
|
73
|
+
|
74
|
+
# This can only be done by the logged in user.
|
75
|
+
# @param [String] username Required parameter: name that need to be
|
76
|
+
# updated
|
77
|
+
# @param [User] body Required parameter: Updated user object
|
78
|
+
# @return [void] response from the API call
|
79
|
+
def update_user(username,
|
80
|
+
body)
|
81
|
+
new_api_call_builder
|
82
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
83
|
+
'/user/{username}',
|
84
|
+
Server::SERVER1)
|
85
|
+
.template_param(new_parameter(username, key: 'username')
|
86
|
+
.should_encode(true))
|
87
|
+
.body_param(new_parameter(body))
|
88
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
89
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
90
|
+
.auth(Single.new('global')))
|
91
|
+
.response(new_response_handler
|
92
|
+
.is_response_void(true)
|
93
|
+
.local_error('400',
|
94
|
+
'Invalid user supplied',
|
95
|
+
APIException)
|
96
|
+
.local_error('404',
|
97
|
+
'User not found',
|
98
|
+
APIException))
|
99
|
+
.execute
|
100
|
+
end
|
101
|
+
|
102
|
+
# This can only be done by the logged in user.
|
103
|
+
# @param [String] username Required parameter: The name that needs to be
|
104
|
+
# deleted
|
105
|
+
# @return [void] response from the API call
|
106
|
+
def delete_user(username)
|
107
|
+
new_api_call_builder
|
108
|
+
.request(new_request_builder(HttpMethodEnum::DELETE,
|
109
|
+
'/user/{username}',
|
110
|
+
Server::SERVER1)
|
111
|
+
.template_param(new_parameter(username, key: 'username')
|
112
|
+
.should_encode(true))
|
113
|
+
.auth(Single.new('global')))
|
114
|
+
.response(new_response_handler
|
115
|
+
.is_response_void(true)
|
116
|
+
.local_error('400',
|
117
|
+
'Invalid username supplied',
|
118
|
+
APIException)
|
119
|
+
.local_error('404',
|
120
|
+
'User not found',
|
121
|
+
APIException))
|
122
|
+
.execute
|
123
|
+
end
|
124
|
+
|
125
|
+
# Logs user into the system
|
126
|
+
# @param [String] username Required parameter: The user name for login
|
127
|
+
# @param [String] password Required parameter: The password for login in
|
128
|
+
# clear text
|
129
|
+
# @return [String] response from the API call
|
130
|
+
def login_user(username,
|
131
|
+
password)
|
132
|
+
new_api_call_builder
|
133
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
134
|
+
'/user/login',
|
135
|
+
Server::SERVER1)
|
136
|
+
.query_param(new_parameter(username, key: 'username'))
|
137
|
+
.query_param(new_parameter(password, key: 'password'))
|
138
|
+
.auth(Single.new('global')))
|
139
|
+
.response(new_response_handler
|
140
|
+
.deserializer(APIHelper.method(:deserialize_primitive_types))
|
141
|
+
.deserialize_into(proc do |response| response.to_s end)
|
142
|
+
.is_primitive_response(true)
|
143
|
+
.local_error('400',
|
144
|
+
'Invalid username/password supplied',
|
145
|
+
APIException))
|
146
|
+
.execute
|
147
|
+
end
|
148
|
+
|
149
|
+
# Logs out current logged in user session
|
150
|
+
# @return [void] response from the API call
|
151
|
+
def logout_user
|
152
|
+
new_api_call_builder
|
153
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
154
|
+
'/user/logout',
|
155
|
+
Server::SERVER1)
|
156
|
+
.auth(Single.new('global')))
|
157
|
+
.response(new_response_handler
|
158
|
+
.is_response_void(true)
|
159
|
+
.local_error('default',
|
160
|
+
'successful operation',
|
161
|
+
APIException))
|
162
|
+
.execute
|
163
|
+
end
|
164
|
+
|
165
|
+
# This can only be done by the logged in user.
|
166
|
+
# @param [User] body Required parameter: Created user object
|
167
|
+
# @return [void] response from the API call
|
168
|
+
def create_user(body)
|
169
|
+
new_api_call_builder
|
170
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
171
|
+
'/user',
|
172
|
+
Server::SERVER1)
|
173
|
+
.body_param(new_parameter(body))
|
174
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
175
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
176
|
+
.auth(Single.new('global')))
|
177
|
+
.response(new_response_handler
|
178
|
+
.is_response_void(true)
|
179
|
+
.local_error('default',
|
180
|
+
'successful operation',
|
181
|
+
APIException))
|
182
|
+
.execute
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# swagger_petstore
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SwaggerPetstore
|
7
|
+
# Class for exceptions when there is a network error, status code error, etc.
|
8
|
+
class APIException < CoreLibrary::ApiException
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# swagger_petstore
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SwaggerPetstore
|
7
|
+
# OAuth 2 Authorization endpoint exception.
|
8
|
+
class OAuthProviderException < APIException
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# Gets or sets error code.
|
13
|
+
# @return [OAuthProviderErrorEnum]
|
14
|
+
attr_accessor :error
|
15
|
+
|
16
|
+
# Gets or sets human-readable text providing additional information on
|
17
|
+
# error.
|
18
|
+
# Used to assist the client developer in understanding the error that
|
19
|
+
# occurred.
|
20
|
+
# @return [String]
|
21
|
+
attr_accessor :error_description
|
22
|
+
|
23
|
+
# Gets or sets a URI identifying a human-readable web page with information
|
24
|
+
# about the error, used to provide the client developer with additional
|
25
|
+
# information about the error.
|
26
|
+
# @return [String]
|
27
|
+
attr_accessor :error_uri
|
28
|
+
|
29
|
+
# The constructor.
|
30
|
+
# @param [String] The reason for raising an exception.
|
31
|
+
# @param [HttpResponse] 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] The deserialized response sent by the server in the
|
40
|
+
# response body.
|
41
|
+
def unbox(hash)
|
42
|
+
@error = hash.key?('error') ? hash['error'] : nil
|
43
|
+
@error_description =
|
44
|
+
hash.key?('error_description') ? hash['error_description'] : SKIP
|
45
|
+
@error_uri = hash.key?('error_uri') ? hash['error_uri'] : SKIP
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# swagger_petstore
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SwaggerPetstore
|
7
|
+
# HttpCallBack allows defining callables for pre and post API calls.
|
8
|
+
class HttpCallBack < CoreLibrary::HttpCallback
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# swagger_petstore
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SwaggerPetstore
|
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,
|
48
|
+
type = SKIP,
|
49
|
+
message = SKIP)
|
50
|
+
@code = code unless code == SKIP
|
51
|
+
@type = type unless type == SKIP
|
52
|
+
@message = message unless message == SKIP
|
53
|
+
end
|
54
|
+
|
55
|
+
# Creates an instance of the object from a hash.
|
56
|
+
def self.from_hash(hash)
|
57
|
+
return nil unless hash
|
58
|
+
|
59
|
+
# Extract variables from the hash.
|
60
|
+
code = hash.key?('code') ? hash['code'] : SKIP
|
61
|
+
type = hash.key?('type') ? hash['type'] : SKIP
|
62
|
+
message = hash.key?('message') ? hash['message'] : SKIP
|
63
|
+
|
64
|
+
# Create object from extracted values.
|
65
|
+
ApiResponse.new(code,
|
66
|
+
type,
|
67
|
+
message)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# swagger_petstore
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SwaggerPetstore
|
7
|
+
# Base model.
|
8
|
+
class BaseModel < CoreLibrary::BaseModel
|
9
|
+
# Returns a Hash representation of the current object.
|
10
|
+
def to_hash
|
11
|
+
hash = {}
|
12
|
+
instance_variables.each do |name|
|
13
|
+
value = instance_variable_get(name)
|
14
|
+
name = name[1..]
|
15
|
+
key = self.class.names.key?(name) ? self.class.names[name] : name
|
16
|
+
|
17
|
+
optional_fields = self.class.optionals
|
18
|
+
nullable_fields = self.class.nullables
|
19
|
+
if value.nil?
|
20
|
+
next unless nullable_fields.include?(name)
|
21
|
+
|
22
|
+
if !optional_fields.include?(name) && !nullable_fields.include?(name)
|
23
|
+
raise ArgumentError,
|
24
|
+
"`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
hash[key] = nil
|
29
|
+
unless value.nil?
|
30
|
+
if respond_to?("to_#{name}")
|
31
|
+
if (value.instance_of? Array) || (value.instance_of? Hash)
|
32
|
+
params = [hash, key]
|
33
|
+
hash[key] = send("to_#{name}", *params)
|
34
|
+
else
|
35
|
+
hash[key] = send("to_#{name}")
|
36
|
+
end
|
37
|
+
elsif value.instance_of? Array
|
38
|
+
hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
39
|
+
elsif value.instance_of? Hash
|
40
|
+
hash[key] = {}
|
41
|
+
value.each do |k, v|
|
42
|
+
hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
|
43
|
+
end
|
44
|
+
else
|
45
|
+
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
hash
|
50
|
+
end
|
51
|
+
|
52
|
+
# Returns a JSON representation of the curent object.
|
53
|
+
def to_json(options = {})
|
54
|
+
hash = to_hash
|
55
|
+
hash.to_json(options)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# swagger_petstore
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SwaggerPetstore
|
7
|
+
# Category Model.
|
8
|
+
class Category < 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 [String]
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
# A mapping from model property names to API property names.
|
21
|
+
def self.names
|
22
|
+
@_hash = {} if @_hash.nil?
|
23
|
+
@_hash['id'] = 'id'
|
24
|
+
@_hash['name'] = 'name'
|
25
|
+
@_hash
|
26
|
+
end
|
27
|
+
|
28
|
+
# An array for optional fields
|
29
|
+
def self.optionals
|
30
|
+
%w[
|
31
|
+
id
|
32
|
+
name
|
33
|
+
]
|
34
|
+
end
|
35
|
+
|
36
|
+
# An array for nullable fields
|
37
|
+
def self.nullables
|
38
|
+
[]
|
39
|
+
end
|
40
|
+
|
41
|
+
def initialize(id = SKIP,
|
42
|
+
name = SKIP)
|
43
|
+
@id = id unless id == SKIP
|
44
|
+
@name = name unless name == SKIP
|
45
|
+
end
|
46
|
+
|
47
|
+
# Creates an instance of the object from a hash.
|
48
|
+
def self.from_hash(hash)
|
49
|
+
return nil unless hash
|
50
|
+
|
51
|
+
# Extract variables from the hash.
|
52
|
+
id = hash.key?('id') ? hash['id'] : SKIP
|
53
|
+
name = hash.key?('name') ? hash['name'] : SKIP
|
54
|
+
|
55
|
+
# Create object from extracted values.
|
56
|
+
Category.new(id,
|
57
|
+
name)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# swagger_petstore
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://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
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# swagger_petstore
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module SwaggerPetstore
|
7
|
+
# OAuth 2 scopes supported by the API
|
8
|
+
class OAuthScopeEnum
|
9
|
+
O_AUTH_SCOPE_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
|
+
end
|
17
|
+
end
|