Class: NewStoreApi::StoresController
- Inherits:
-
BaseController
- Object
- BaseController
- NewStoreApi::StoresController
- Defined in:
- lib/new_store_api/controllers/stores_controller.rb
Overview
StoresController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#create_store(body) ⇒ StoreV1Dto
🚧 BETA: This endpoint is in beta and may change.
- #destroy_store(store_id) ⇒ void
🚧 BETA: This endpoint is in beta and may change.- #list_stores(limit, start_at: nil, include_cashboxes: false, country_codes: nil) ⇒ StoreListV1Dto
List stores for the given query.
- #show_store(store_id) ⇒ StoreV1Dto
Get store for the given store identifier.
- #update_store(store_id, body) ⇒ StoreV1Dto
Updates a store for the given store identifier.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent
Constructor Details
This class inherits a constructor from NewStoreApi::BaseController
Instance Method Details
#create_store(body) ⇒ StoreV1Dto
🚧 BETA: This endpoint is in beta and may change.Create store for the given store identifier. here
See API Lifecycle Documentation for details.54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
# File 'lib/new_store_api/controllers/stores_controller.rb', line 54 def create_store(body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/stores', Server::API) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('oauth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(StoreV1Dto.method(:from_hash))) .execute end
#destroy_store(store_id) ⇒ void
This method returns an undefined value.
🚧 BETA: This endpoint is in beta and may change.Delete store for the given store identifier.
See API Lifecycle Documentation for details.82 83 84 85 86 87 88 89 90 91 92 93
# File 'lib/new_store_api/controllers/stores_controller.rb', line 82 def destroy_store(store_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/stores/{storeId}', Server::API) .template_param(new_parameter(store_id, key: 'storeId') .should_encode(true)) .auth(Single.new('oauth'))) .response(new_response_handler .is_response_void(true)) .execute end
#list_stores(limit, start_at: nil, include_cashboxes: false, country_codes: nil) ⇒ StoreListV1Dto
List stores for the given query. results. page. * The value of
next_page_keyfield from the response payload can be used for retrieving the next page. Include cashboxes belonging to the store in the result. filter by.20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
# File 'lib/new_store_api/controllers/stores_controller.rb', line 20 def list_stores(limit, start_at: nil, include_cashboxes: false, country_codes: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/stores', Server::API) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(start_at, key: 'start_at')) .query_param(new_parameter(include_cashboxes, key: 'include_cashboxes')) .query_param(new_parameter(country_codes, key: 'country_codes')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oauth')) .array_serialization_format(ArraySerializationFormat::PLAIN)) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(StoreListV1Dto.method(:from_hash))) .execute end
#show_store(store_id) ⇒ StoreV1Dto
Get store for the given store identifier.
98 99 100 101 102 103 104 105 106 107 108 109 110 111
# File 'lib/new_store_api/controllers/stores_controller.rb', line 98 def show_store(store_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/stores/{storeId}', Server::API) .template_param(new_parameter(store_id, key: 'storeId') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oauth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(StoreV1Dto.method(:from_hash))) .execute end
#update_store(store_id, body) ⇒ StoreV1Dto
Updates a store for the given store identifier. here
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
# File 'lib/new_store_api/controllers/stores_controller.rb', line 118 def update_store(store_id, body) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/stores/{storeId}', Server::API) .template_param(new_parameter(store_id, key: 'storeId') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('oauth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(StoreV1Dto.method(:from_hash))) .execute end
- #destroy_store(store_id) ⇒ void