Class: NewStoreApi::RoutingController

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

Overview

RoutingController

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_routing_options(body: nil) ⇒ RoutingOptionsResponse

Generate Routing Options given the following parameters description here

Parameters:

Returns:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/new_store_api/controllers/routing_controller.rb', line 42

def create_routing_options(body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v0/routing/options',
                                 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(RoutingOptionsResponse.method(:from_hash)))
    .execute
end

#list_order_routing_insights(order_id) ⇒ RoutingInsights

Get insights on routing and shipment details for orders being processed in the NewStore platform. This includes details such as:

  • Items in the order
  • The fulfillment location that is assigned to fulfill orders
  • The time when the shipment was dispatched from the fulfillment location
  • Order routing strategies
  • Service levels Data is retained up to 45 days for successfully routed order items. Until order items have been successfully routed, related data is retained indefinitely. external order ID

Parameters:

  • order_id (String)

    Required parameter: A sales order UUID or

Returns:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/new_store_api/controllers/routing_controller.rb', line 23

def list_order_routing_insights(order_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v0/routing/insights/order/{order_id}',
                                 Server::API)
               .template_param(new_parameter(order_id, key: 'order_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(RoutingInsights.method(:from_hash)))
    .execute
end