Class: NewStoreApi::RoutingRulesetController
- Inherits:
-
BaseController
- Object
- BaseController
- NewStoreApi::RoutingRulesetController
- Defined in:
- lib/new_store_api/controllers/routing_ruleset_controller.rb
Overview
RoutingRulesetController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#replace_routing_ruleset(body, if_match: nil) ⇒ PutRoutingRulesetResponse
This endpoint is used to initially seed the routing rules or to replace it completely Note: - You have the option of defining route entries with a single
countryor multiplecountriesby providing the optionalContent-Typeheader with your desired payload version. -
#show_routing_ruleset ⇒ RoutingRuleset1
Retrieves the current 'Routing Rule V2'.
-
#show_routing_ruleset_section(section) ⇒ FulfillmentConfigGetRoutingRulesSectionSampleResponse | FulfillmentConfigGetRoutingRulesSectionSampleResponse1 | FulfillmentConfigGetRoutingRulesSectionSampleResponse2 | FulfillmentConfigGetRoutingRulesSectionSampleResponse3
Retrieves a section of the current 'Routing Rule V2'.
-
#update_routing_ruleset(if_match: nil, body: nil) ⇒ PutRoutingRulesetResponse
A convenience endpoint is where you use JSON patch to change parts of routing rules.
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
#replace_routing_ruleset(body, if_match: nil) ⇒ PutRoutingRulesetResponse
This endpoint is used to initially seed the routing rules or to replace it completely Note:
- You have the option of defining route entries with a single
countryor multiplecountriesby providing the optionalContent-Typeheader with your desired payload version. - If you'd like to define multiple countries set the Content-Type header
to application/json; version=1.
Select the appropriate Content-Type in the the request schema drop-down to
see the schema for supporting
multiple countries.
here
ruleset the client expects to replace, as returned in the
ETagheader of a previous GET response. When provided, the replacement is applied only if the current ruleset's entity tag matches, enabling optimistic-concurrency control. The header is ignored when no ruleset exists yet (initial seeding).
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/new_store_api/controllers/routing_ruleset_controller.rb', line 92 def replace_routing_ruleset(body, if_match: nil) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/v0/routing/ruleset', Server::API) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter(if_match, key: 'If-Match')) .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(PutRoutingRulesetResponse.method(:from_hash))) .execute end |
#show_routing_ruleset ⇒ RoutingRuleset1
Retrieves the current 'Routing Rule V2'. If customer using V1, this endpoint maps the V1 configuration to V2 and returns a 200 OK.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/new_store_api/controllers/routing_ruleset_controller.rb', line 13 def show_routing_ruleset @api_call .request(new_request_builder(HttpMethodEnum::GET, '/v0/routing/ruleset', 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(RoutingRuleset1.method(:from_hash))) .execute end |
#show_routing_ruleset_section(section) ⇒ FulfillmentConfigGetRoutingRulesSectionSampleResponse | FulfillmentConfigGetRoutingRulesSectionSampleResponse1 | FulfillmentConfigGetRoutingRulesSectionSampleResponse2 | FulfillmentConfigGetRoutingRulesSectionSampleResponse3
Retrieves a section of the current 'Routing Rule V2'. If customer using V1, this endpoint is of no use, and will return the error. retrieve
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/new_store_api/controllers/routing_ruleset_controller.rb', line 116 def show_routing_ruleset_section(section) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/v0/routing/ruleset/{section}', Server::API) .template_param(new_parameter(section, key: 'section') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oauth'))) .response(new_response_handler .deserializer(proc do |response, should_symbolize| APIHelper.deserialize_union_type( UnionTypeLookUp.get(:FulfillmentConfigGetRoutingRulesSectionSampleResponse4), response, should_symbolize, true ) end)) .execute end |
#update_routing_ruleset(if_match: nil, body: nil) ⇒ PutRoutingRulesetResponse
A convenience endpoint is where you use JSON patch to change parts of routing rules. Note:
- You have the option of defining route entries with a single
countryor multiplecountriesby providing the optionalContent-Typeheader with your desired payload version. - If you'd like to define multiple countries set the Content-Type header to application/json; version=1. Select the appropriate Content-Type in the the request schema drop-down to see the schema for supporting multiple countries.
- To use payload version 1 via the PATCH operation you need to update the
route entries from
countrytocountriesvia PUT endpoint for compatibility. ruleset the client expects to update, as returned in theETagheader of a previous GET response. When provided, the update is applied only if the current ruleset's entity tag matches, enabling optimistic-concurrency control. parameter: TODO: type description here
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/new_store_api/controllers/routing_ruleset_controller.rb', line 49 def update_routing_ruleset(if_match: nil, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/v0/routing/ruleset', Server::API) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter(if_match, key: 'If-Match')) .body_param(new_parameter(body) .validator(proc do |value| UnionTypeLookUp.get(:FulfillmentConfigJsonPatchRequest) .validate(value) end)) .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(PutRoutingRulesetResponse.method(:from_hash))) .execute end |