Class: SwaggerPetstore::UserController
- Inherits:
-
BaseController
- Object
- BaseController
- SwaggerPetstore::UserController
- Defined in:
- lib/swagger_petstore/controllers/user_controller.rb
Overview
UserController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#create_user(accept, body) ⇒ Mixed
This can only be done by the logged in user.
-
#create_users_with_array_input(accept, body) ⇒ Mixed
Creates list of users with given input array Example:.
-
#create_users_with_list_input(accept, body) ⇒ Mixed
Creates list of users with given input array Example:.
-
#delete_user(username, accept) ⇒ void
This can only be done by the logged in user.
-
#get_user_by_name(username, accept) ⇒ Response20012
Get user by user name fetched.
-
#login_user(username, password, accept) ⇒ String
Logs user into the system clear text.
-
#logout_user(accept) ⇒ Mixed
Logs out current logged in user session.
-
#update_user(username, accept, body) ⇒ void
This can only be done by the logged in user.
Methods inherited from BaseController
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent
Constructor Details
This class inherits a constructor from SwaggerPetstore::BaseController
Instance Method Details
#create_user(accept, body) ⇒ Mixed
This can only be done by the logged in user.
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 181 def create_user(accept, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/user', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter(accept, key: 'Accept')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:dynamic_deserializer))) .execute end |
#create_users_with_array_input(accept, body) ⇒ Mixed
Creates list of users with given input array Example:
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 14 def create_users_with_array_input(accept, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/user/createWithArray', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter(accept, key: 'Accept')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:dynamic_deserializer))) .execute end |
#create_users_with_list_input(accept, body) ⇒ Mixed
Creates list of users with given input array Example:
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 35 def create_users_with_list_input(accept, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/user/createWithList', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter(accept, key: 'Accept')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:dynamic_deserializer))) .execute end |
#delete_user(username, accept) ⇒ void
This method returns an undefined value.
This can only be done by the logged in user. deleted
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 114 def delete_user(username, accept) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/user/{username}', Server::SERVER_1) .template_param(new_parameter(username, key: 'username') .should_encode(true)) .header_param(new_parameter(accept, key: 'Accept')) .auth(Single.new('global'))) .response(new_response_handler .is_response_void(true) .local_error('400', 'Invalid username supplied', APIException) .local_error('404', 'User not found', APIException)) .execute end |
#get_user_by_name(username, accept) ⇒ Response20012
Get user by user name fetched. Use user1 for testing.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 56 def get_user_by_name(username, accept) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/user/{username}', Server::SERVER_1) .template_param(new_parameter(username, key: 'username') .should_encode(true)) .header_param(new_parameter(accept, key: 'Accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Response20012.method(:from_hash)) .local_error('400', 'Invalid username supplied', APIException) .local_error('404', 'User not found', APIException)) .execute end |
#login_user(username, password, accept) ⇒ String
Logs user into the system clear text
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 141 def login_user(username, password, accept) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/user/login', Server::SERVER_1) .query_param(new_parameter(username, key: 'username')) .query_param(new_parameter(password, key: 'password')) .header_param(new_parameter(accept, key: 'Accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:deserialize_primitive_types)) .deserialize_into(proc do |response| response.to_s end) .is_primitive_response(true) .local_error('400', 'Invalid username/password supplied', APIException)) .execute end |
#logout_user(accept) ⇒ Mixed
Logs out current logged in user session
165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 165 def logout_user(accept) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/user/logout', Server::SERVER_1) .header_param(new_parameter(accept, key: 'Accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:dynamic_deserializer))) .execute end |
#update_user(username, accept, body) ⇒ void
This method returns an undefined value.
This can only be done by the logged in user. updated
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 84 def update_user(username, accept, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/user/{username}', Server::SERVER_1) .template_param(new_parameter(username, key: 'username') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter(accept, key: 'Accept')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .is_response_void(true) .local_error('400', 'Invalid user supplied', APIException) .local_error('404', 'User not found', APIException)) .execute end |