Class: NewStoreApi::PackageTypesController
- Inherits:
-
BaseController
- Object
- BaseController
- NewStoreApi::PackageTypesController
- Defined in:
- lib/new_store_api/controllers/package_types_controller.rb
Overview
PackageTypesController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#create_package_type(body) ⇒ Object
🚧 BETA: This endpoint is in beta and may change.
- #destroy_package_type(package_type_id) ⇒ void
🚧 BETA: This endpoint is in beta and may change.- #list_package_types ⇒ PackageTypesResponse
🚧 BETA: This endpoint is in beta and may change.- #show_package_type(package_type_id) ⇒ PackageTypeResponse
🚧 BETA: This endpoint is in beta and may change.- #update_package_type(package_type_id, body) ⇒ PackageTypeResponse
🚧 BETA: This endpoint is in beta and may change.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_package_type(body) ⇒ Object
🚧 BETA: This endpoint is in beta and may change.Creates a new package type for the tenant. Once created, the package type will be available for associates to select during the packing flow in alphabetical order in the Associate App. Returns a 201 with the new package type's ID in the Location header. description here
See API Lifecycle Documentation for details.51 52 53 54 55 56 57 58 59 60 61 62 63 64
# File 'lib/new_store_api/controllers/package_types_controller.rb', line 51 def create_package_type(body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/fulfillment/package-types', 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(:json_deserialize))) .execute end
#destroy_package_type(package_type_id) ⇒ void
This method returns an undefined value.
🚧 BETA: This endpoint is in beta and may change.Deletes an existing package type. Once deleted, the package type will no longer be available for associates to select during the packing flow in the Associate App. Package types are available in alphabetical order when listed. description here
See API Lifecycle Documentation for details.82 83 84 85 86 87 88 89 90 91 92 93
# File 'lib/new_store_api/controllers/package_types_controller.rb', line 82 def destroy_package_type(package_type_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/fulfillment/package-types/{package_type_id}', Server::API) .template_param(new_parameter(package_type_id, key: 'package_type_id') .should_encode(true)) .auth(Single.new('oauth'))) .response(new_response_handler .is_response_void(true)) .execute end
#list_package_types ⇒ PackageTypesResponse
🚧 BETA: This endpoint is in beta and may change.Returns all configured package types sorted by alphabetical order. These define the packages available for an associate to choose from during the packing flow in the Associate App.
See API Lifecycle Documentation for details.22 23 24 25 26 27 28 29 30 31 32 33
# File 'lib/new_store_api/controllers/package_types_controller.rb', line 22 def list_package_types @api_call .request(new_request_builder(HttpMethodEnum::GET, '/fulfillment/package-types', Server::API) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oauth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(PackageTypesResponse.method(:from_hash))) .execute end
#show_package_type(package_type_id) ⇒ PackageTypeResponse
🚧 BETA: This endpoint is in beta and may change.Returns a single package type by its ID. Package types are available in alphabetical order when listed. description here
See API Lifecycle Documentation for details.109 110 111 112 113 114 115 116 117 118 119 120 121 122
# File 'lib/new_store_api/controllers/package_types_controller.rb', line 109 def show_package_type(package_type_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/fulfillment/package-types/{package_type_id}', Server::API) .template_param(new_parameter(package_type_id, key: 'package_type_id') .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(PackageTypeResponse.method(:from_hash))) .execute end
#update_package_type(package_type_id, body) ⇒ PackageTypeResponse
🚧 BETA: This endpoint is in beta and may change.Partially updates an existing package type. Only the provided fields will be updated; omitted fields remain unchanged. Package types are available in alphabetical order when listed. description here description here
See API Lifecycle Documentation for details.141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
# File 'lib/new_store_api/controllers/package_types_controller.rb', line 141 def update_package_type(package_type_id, body) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/fulfillment/package-types/{package_type_id}', Server::API) .template_param(new_parameter(package_type_id, key: 'package_type_id') .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(PackageTypeResponse.method(:from_hash))) .execute end
- #destroy_package_type(package_type_id) ⇒ void