Class: NewStoreApi::EasypostAdapterConfigController
- Inherits:
-
BaseController
- Object
- BaseController
- NewStoreApi::EasypostAdapterConfigController
- Defined in:
- lib/new_store_api/controllers/easypost_adapter_config_controller.rb
Overview
EasypostAdapterConfigController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#destroy_easypost_adapter_config ⇒ void
Deletes the shipping configuration of the retailer that is integrated with the EasyPost adapter.
-
#replace_easypost_adapter_config(body: nil) ⇒ EasypostAdapterConfig
Creates or updates the shipping configuration of the retailer that is integrated with the EasyPost adapter.
-
#show_easypost_adapter_config ⇒ EasypostAdapterConfig
Retrieves the shipping configuration of the retailer that is integrated with the EasyPost adapter.
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
#destroy_easypost_adapter_config ⇒ void
This method returns an undefined value.
Deletes the shipping configuration of the retailer that is integrated with the EasyPost adapter.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/new_store_api/controllers/easypost_adapter_config_controller.rb', line 12 def destroy_easypost_adapter_config @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/fulfillment/adapters/config', Server::API) .auth(Single.new('oauth'))) .response(new_response_handler .is_response_void(true)) .execute end |
#replace_easypost_adapter_config(body: nil) ⇒ EasypostAdapterConfig
Creates or updates the shipping configuration of the retailer that is integrated with the EasyPost adapter. Any current data in the existing configuration is overwritten using this request. A few notes on this configuration:
- When an account has a large number of carrier accounts, please do associate a Fulfillment Node to a Carrier Account. Not doing so will result in long response time, waste of resources, extra easypost charges and possibly order injection issues.
- Once the easypost API Key has been set, it is forbidden to change it. This is to prevent options that were already generated to become completely invalid in case the api key isn't from the same account. If you really need to change this key, please open a case in the NewStore Support Portal and we will discuss the best way to do that. description here
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/new_store_api/controllers/easypost_adapter_config_controller.rb', line 58 def replace_easypost_adapter_config(body: nil) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/fulfillment/adapters/config', 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(EasypostAdapterConfig.method(:from_hash))) .execute end |
#show_easypost_adapter_config ⇒ EasypostAdapterConfig
Retrieves the shipping configuration of the retailer that is integrated with the EasyPost adapter. Credentials are redacted but you can still push the configuration using the PUT endpoint with the REDACTED value: we will use the current value. A new value will be validated before saving the configuration.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/new_store_api/controllers/easypost_adapter_config_controller.rb', line 29 def show_easypost_adapter_config @api_call .request(new_request_builder(HttpMethodEnum::GET, '/fulfillment/adapters/config', 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(EasypostAdapterConfig.method(:from_hash))) .execute end |