Class: NewStoreApi::RoutingConfigController

Inherits:
BaseController show all
Defined in:
lib/new_store_api/controllers/routing_config_controller.rb

Overview

RoutingConfigController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

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_automatic_rerouting_setting(body: nil) ⇒ void

This method returns an undefined value.

Sets the configuration that determines if on hold orders are routed to fulfillment locations automatically when stock becomes available in these locations. description here

Parameters:



123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 123

def create_automatic_rerouting_setting(body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v0/config/routing/enable_automatic_rerouting',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end

#create_cancellation_policy_settings(body: nil) ⇒ void

This method returns an undefined value.

Sets the configuration based on which it is determined if orders in your business are canceled automatically in case of a conflict. The configuration also contains the reasons for which orders can be canceled automatically. For more information about the properties, see the guide. description here

Parameters:



85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 85

def create_cancellation_policy_settings(body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v0/config/routing/cancel_on_conflict',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end

#create_capacity_based_routing_settings(body) ⇒ void

This method returns an undefined value.

Sets the current configuration that determines if orders are routed to fulfillment locations based on a capacity aware algorithm. description here

Parameters:



158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 158

def create_capacity_based_routing_settings(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v0/config/routing/enable_capacity_based_routing',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end

#create_external_atp_settings(body: nil) ⇒ void

This method returns an undefined value.

Specifies if ATP is requested from an external source or from NewStore. If set to true, NewStore uses ATP from an external availability source such as an external OMS. If not set or set to false, NewStore retrieves ATP based on the stock on hand for the products. description here

Parameters:



290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 290

def create_external_atp_settings(body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v0/config/routing/uses_external_atp',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end

#create_external_fulfillment_settings(body: nil) ⇒ void

This method returns an undefined value.

Enables the configuration to allow you to update the status for fulfillment requests that were processed outside of the NewStore platform, because of possible issues with fulfillment or shipping status updates. For more information, see the [guide](https://docs.newstore.com/docs/monitoring-orders#updating-the-ship ment-status-for-external-orders). type description here

Parameters:



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 40

def create_external_fulfillment_settings(body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v0/config/routing/can_update_ffr_processed_externally',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end

#create_rejected_rerouting_settings(body: nil) ⇒ void

This method returns an undefined value.

Sets the configuration that determines if orders will be automatically routed to fulfillment locations where stock has become available, even if these locations had rejected the order fulfillment request earlier, due to insufficient stock at these locations. description here

Parameters:



203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 203

def create_rejected_rerouting_settings(body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v0/config/routing/reroute_to_rejected_fulfillment_nodes',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end

#create_shipment_limits(body) ⇒ void

This method returns an undefined value.

Upsert a shipment limit for a (currency,service_level) pair. An order will be marked as a conflict if any limit on limit_exceeded_when is reached. It is not allowed to have two limits with the same shipment_count_gt value. The order_amount_lt of a given limit should be greater than or equal to others limits with smaller shipment_count_gt. description here

Parameters:



331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 331

def create_shipment_limits(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v0/routing/shipments_limit',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end

#create_shipping_offer_update_settings(body: nil) ⇒ void

This method returns an undefined value.

Sets the configuration that allows NewStore to skip updating shipping offers when orders are routed to a warehouse or DC for fulfillment. We recommend setting this configuration to true. description here

Parameters:



247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 247

def create_shipping_offer_update_settings(body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v0/config/routing/skip_shipping_offer_update_for_dc_orders',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end

#list_shipment_limitsShipmentLimitsResponse

List all shipments limits. This method is limited to return a maximum of 10.000 shipments limits per tenant.

Returns:



307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 307

def list_shipment_limits
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v0/routing/shipments_limit',
                                 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(ShipmentLimitsResponse.method(:from_hash)))
    .execute
end

#show_automatic_rerouting_settingAutomaticReroutingSettings

Retrieves the current configuration that determines if on hold orders are routed to fulfillment locations automatically when stock becomes available in these locations.

Returns:



104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 104

def show_automatic_rerouting_setting
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v0/config/routing/enable_automatic_rerouting',
                                 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(AutomaticReroutingSettings.method(:from_hash)))
    .execute
end

#show_cancellation_policy_settingsCancellationPolicySettings

Retrieves the configuration based on which it is determined if orders in your business are canceled automatically in case of a conflict. The configuration also contains the reasons for which orders can be canceled automatically. For more information about the properties, see the guide.

Returns:



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 62

def show_cancellation_policy_settings
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v0/config/routing/cancel_on_conflict',
                                 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(CancellationPolicySettings.method(:from_hash)))
    .execute
end

#show_capacity_based_routing_settingsCapacityBasedRoutingSettings

Retrieves the current configuration that determines if orders are routed to fulfillment locations based on a capacity aware algorithm.

Returns:



140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 140

def show_capacity_based_routing_settings
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v0/config/routing/enable_capacity_based_routing',
                                 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(CapacityBasedRoutingSettings.method(:from_hash)))
    .execute
end

#show_external_atp_settingsExternalAtpSettings

Specifies if ATP is requested from an external source or from NewStore. If set to true, NewStore uses ATP from an external availability source such as an external OMS. If not set or set to false, NewStore retrieves ATP based on the stock on hand) for the products.

Returns:



268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 268

def show_external_atp_settings
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v0/config/routing/uses_external_atp',
                                 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(ExternalAtpSettings.method(:from_hash)))
    .execute
end

#show_external_fulfillment_settingsExternalFulfillmentSettingsResponse

Retrieves the current configuration to determine if you can update the status for fulfillment requests that were processed outside of the NewStore platform, because of possible issues with fulfillment or shipping status updates. For more information, see the [guide](https://docs.newstore.com/docs/monitoring-orders#updating-the-ship ment-status-for-external-orders).

Returns:



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 17

def show_external_fulfillment_settings
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v0/config/routing/can_update_ffr_processed_externally',
                                 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(ExternalFulfillmentSettingsResponse.method(:from_hash)))
    .execute
end

#show_rejected_rerouting_settingsRejectedReroutingSettings

Retrieves the configuration that determines if orders will be automatically routed to fulfillment locations where stock has become available, even if these locations had rejected the order fulfillment request earlier, due to insufficient stock at these locations.

Returns:



180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 180

def show_rejected_rerouting_settings
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v0/config/routing/reroute_to_rejected_fulfillment_nodes',
                                 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(RejectedReroutingSettings.method(:from_hash)))
    .execute
end

#show_shipping_offer_update_settingsShippingOfferUpdateSettings

Retrieves the current configuration, which determines if NewStore skips updating shipping offers when orders are routed to a warehouse or DC for fulfillment. By default, this is set to true. We recommend setting this configuration to true. Please be aware that having this value set to true can cause a fulfillment request routed to DC to have an empty shipping provider field if the tenant is also configured, skipping soft routing on an order injection.

Returns:



227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/new_store_api/controllers/routing_config_controller.rb', line 227

def show_shipping_offer_update_settings
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v0/config/routing/skip_shipping_offer_update_for_dc_orders',
                                 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(ShippingOfferUpdateSettings.method(:from_hash)))
    .execute
end