Class: SwaggerPetstore::StoreController
- Inherits:
-
BaseController
- Object
- BaseController
- SwaggerPetstore::StoreController
- Defined in:
- lib/swagger_petstore/controllers/store_controller.rb
Overview
StoreController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#delete_order(order_id, accept) ⇒ void
For valid response try integer IDs with positive integer value.
-
#get_inventory(accept) ⇒ Response20011
Returns a map of status codes to quantities.
-
#get_order_by_id(order_id, accept) ⇒ Response2007
For valid response try integer IDs with value >= 1 and <= 10.
-
#place_order(accept, body) ⇒ Response2007
Place an order for a pet.
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
#delete_order(order_id, accept) ⇒ void
This method returns an undefined value.
For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors to be deleted
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/swagger_petstore/controllers/store_controller.rb', line 67 def delete_order(order_id, accept) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/store/order/{orderId}', Server::SERVER_1) .template_param(new_parameter(order_id, key: 'orderId') .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 ID supplied', APIException) .local_error('404', 'Order not found', APIException)) .execute end |
#get_inventory(accept) ⇒ Response20011
Returns a map of status codes to quantities
91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/swagger_petstore/controllers/store_controller.rb', line 91 def get_inventory(accept) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/store/inventory', Server::SERVER_1) .header_param(new_parameter(accept, key: 'Accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Response20011.method(:from_hash))) .execute end |
#get_order_by_id(order_id, accept) ⇒ Response2007
For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions fetched
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/swagger_petstore/controllers/store_controller.rb', line 39 def get_order_by_id(order_id, accept) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/store/order/{orderId}', Server::SERVER_1) .template_param(new_parameter(order_id, key: 'orderId') .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(Response2007.method(:from_hash)) .local_error('400', 'Invalid ID supplied', APIException) .local_error('404', 'Order not found', APIException)) .execute end |
#place_order(accept, body) ⇒ Response2007
Place an order for a pet
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/swagger_petstore/controllers/store_controller.rb', line 13 def place_order(accept, body) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/store/order', 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(:custom_type_deserializer)) .deserialize_into(Response2007.method(:from_hash)) .local_error('400', 'Invalid Order', APIException)) .execute end |