Class: SwaggerPetstoreOpenApi30::StoreApi
- Defined in:
- lib/swagger_petstore_open_api30/apis/store_api.rb
Overview
StoreApi
Constant Summary
Constants inherited from BaseApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#delete_order(order_id) ⇒ ApiResponse
For valid response try integer IDs with value < 1000.
-
#get_inventory ⇒ ApiResponse
Returns a map of status codes to quantities.
-
#get_order_by_id(order_id) ⇒ ApiResponse
For valid response try integer IDs with value <= 5 or > 10.
-
#place_order(id: nil, pet_id: nil, quantity: nil, ship_date: nil, status: nil, complete: nil) ⇒ ApiResponse
Place a new order in the store.
Methods inherited from BaseApi
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from SwaggerPetstoreOpenApi30::BaseApi
Instance Method Details
#delete_order(order_id) ⇒ ApiResponse
For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors. to be deleted
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/swagger_petstore_open_api30/apis/store_api.rb', line 108 def delete_order(order_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/store/order/{orderId}', Server::DEFAULT) .template_param(new_parameter(order_id, key: 'orderId') .is_required(true) .should_encode(true))) .response(new_response_handler .is_response_void(true) .is_api_response(true) .local_error('400', 'Invalid ID supplied', APIException) .local_error('404', 'Order not found', APIException) .local_error('default', 'Unexpected error', APIException)) .execute end |
#get_inventory ⇒ ApiResponse
Returns a map of status codes to quantities.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/swagger_petstore_open_api30/apis/store_api.rb', line 11 def get_inventory @api_call .request(new_request_builder(HttpMethodEnum::GET, '/store/inventory', Server::DEFAULT) .auth(Single.new('api_key'))) .response(new_response_handler .deserializer(APIHelper.method(:deserialize_primitive_types)) .deserialize_into(proc do |response| response&.to_i end) .is_api_response(true) .is_primitive_response(true) .local_error('default', 'Unexpected error', APIException)) .execute end |
#get_order_by_id(order_id) ⇒ ApiResponse
For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. fetched
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/swagger_petstore_open_api30/apis/store_api.rb', line 78 def get_order_by_id(order_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/store/order/{orderId}', Server::DEFAULT) .template_param(new_parameter(order_id, key: 'orderId') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Order.method(:from_hash)) .is_api_response(true) .local_error('400', 'Invalid ID supplied', APIException) .local_error('404', 'Order not found', APIException) .local_error('default', 'Unexpected error', APIException)) .execute end |
#place_order(id: nil, pet_id: nil, quantity: nil, ship_date: nil, status: nil, complete: nil) ⇒ ApiResponse
Place a new order in the store. here here description here
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/swagger_petstore_open_api30/apis/store_api.rb', line 39 def place_order(id: nil, pet_id: nil, quantity: nil, ship_date: nil, status: nil, complete: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/store/order', Server::DEFAULT) .form_param(new_parameter(id, key: 'id')) .form_param(new_parameter(pet_id, key: 'petId')) .form_param(new_parameter(quantity, key: 'quantity')) .form_param(new_parameter(ship_date, key: 'shipDate')) .form_param(new_parameter(status, key: 'status')) .form_param(new_parameter(complete, key: 'complete')) .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type')) .header_param(new_parameter('application/json', key: 'accept'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Order.method(:from_hash)) .is_api_response(true) .local_error('400', 'Invalid input', APIException) .local_error('422', 'Validation exception', APIException) .local_error('default', 'Unexpected error', APIException)) .execute end |