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(body) ⇒ void
This can only be done by the logged in user.
-
#create_users_with_array_input(body) ⇒ void
Creates list of users with given input array.
-
#create_users_with_list_input(body) ⇒ void
Creates list of users with given input array.
-
#delete_user(username) ⇒ void
This can only be done by the logged in user.
-
#get_user_by_name(username) ⇒ User
Get user by user name fetched.
-
#login_user(username, password) ⇒ String
Logs user into the system clear text.
-
#logout_user ⇒ void
Logs out current logged in user session.
-
#update_user(username, 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(body) ⇒ void
This method returns an undefined value.
This can only be done by the logged in user.
130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 130 def create_user(body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/user', Server::DEFAULT) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end)) .response(new_response_handler .is_response_void(true)) .execute end |
#create_users_with_array_input(body) ⇒ void
This method returns an undefined value.
Creates list of users with given input array
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 12 def create_users_with_array_input(body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/user/createWithArray', Server::DEFAULT) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end)) .response(new_response_handler .is_response_void(true)) .execute end |
#create_users_with_list_input(body) ⇒ void
This method returns an undefined value.
Creates list of users with given input array
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 55 def create_users_with_list_input(body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/user/createWithList', Server::DEFAULT) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end)) .response(new_response_handler .is_response_void(true)) .execute end |
#delete_user(username) ⇒ void
This method returns an undefined value.
This can only be done by the logged in user. deleted
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 147 def delete_user(username) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/user/{username}', Server::DEFAULT) .template_param(new_parameter(username, key: 'username') .should_encode(true))) .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) ⇒ User
Get user by user name fetched. Use user1 for testing.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 107 def get_user_by_name(username) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/user/{username}', Server::DEFAULT) .template_param(new_parameter(username, key: 'username') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(User.method(:from_hash)) .local_error('400', 'Invalid username supplied', APIException) .local_error('404', 'User not found', APIException)) .execute end |
#login_user(username, password) ⇒ String
Logs user into the system clear text
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 85 def login_user(username, password) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/user/login', Server::DEFAULT) .query_param(new_parameter(username, key: 'username')) .query_param(new_parameter(password, key: 'password'))) .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 ⇒ void
This method returns an undefined value.
Logs out current logged in user session
70 71 72 73 74 75 76 77 78 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 70 def logout_user new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/user/logout', Server::DEFAULT)) .response(new_response_handler .is_response_void(true)) .execute end |
#update_user(username, body) ⇒ void
This method returns an undefined value.
This can only be done by the logged in user. updated
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/swagger_petstore/controllers/user_controller.rb', line 30 def update_user(username, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/user/{username}', Server::DEFAULT) .template_param(new_parameter(username, key: 'username') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end)) .response(new_response_handler .is_response_void(true) .local_error('400', 'Invalid user supplied', APIException) .local_error('404', 'User not found', APIException)) .execute end |