Class: NewStoreApi::FulfillmentConfigRoutingRules
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::FulfillmentConfigRoutingRules
- Defined in:
- lib/new_store_api/models/fulfillment_config_routing_rules.rb
Overview
Mirrors fulfillment_config FulfillmentConfigRoutingRules (routing ruleset).
Instance Attribute Summary collapse
-
#location_groups ⇒ Hash[String, Object]
Location group identifiers mapped to ordered location IDs.
-
#preferred_locations ⇒ Hash[String, Object]
Preferred location IDs within each location group, tried before others in the group.
-
#routes ⇒ Array[FulfillmentConfigRoute]
Routing rules specification.
-
#sl_levels_priority ⇒ Array[String]
Service levels in priority order (first is preferred).
-
#zip_code_regions ⇒ Hash[String, Object]
Zip code region identifiers mapped to zip code patterns.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(location_groups = nil, routes = nil, sl_levels_priority = nil, zip_code_regions = nil, preferred_locations = SKIP) ⇒ FulfillmentConfigRoutingRules
constructor
A new instance of FulfillmentConfigRoutingRules.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(location_groups = nil, routes = nil, sl_levels_priority = nil, zip_code_regions = nil, preferred_locations = SKIP) ⇒ FulfillmentConfigRoutingRules
Returns a new instance of FulfillmentConfigRoutingRules.
58 59 60 61 62 63 64 65 66 |
# File 'lib/new_store_api/models/fulfillment_config_routing_rules.rb', line 58 def initialize(location_groups = nil, routes = nil, sl_levels_priority = nil, zip_code_regions = nil, preferred_locations = SKIP) @location_groups = location_groups @preferred_locations = preferred_locations unless preferred_locations == SKIP @routes = routes @sl_levels_priority = sl_levels_priority @zip_code_regions = zip_code_regions end |
Instance Attribute Details
#location_groups ⇒ Hash[String, Object]
Location group identifiers mapped to ordered location IDs.
14 15 16 |
# File 'lib/new_store_api/models/fulfillment_config_routing_rules.rb', line 14 def location_groups @location_groups end |
#preferred_locations ⇒ Hash[String, Object]
Preferred location IDs within each location group, tried before others in the group.
19 20 21 |
# File 'lib/new_store_api/models/fulfillment_config_routing_rules.rb', line 19 def preferred_locations @preferred_locations end |
#routes ⇒ Array[FulfillmentConfigRoute]
Routing rules specification.
23 24 25 |
# File 'lib/new_store_api/models/fulfillment_config_routing_rules.rb', line 23 def routes @routes end |
#sl_levels_priority ⇒ Array[String]
Service levels in priority order (first is preferred).
27 28 29 |
# File 'lib/new_store_api/models/fulfillment_config_routing_rules.rb', line 27 def sl_levels_priority @sl_levels_priority end |
#zip_code_regions ⇒ Hash[String, Object]
Zip code region identifiers mapped to zip code patterns.
31 32 33 |
# File 'lib/new_store_api/models/fulfillment_config_routing_rules.rb', line 31 def zip_code_regions @zip_code_regions end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/new_store_api/models/fulfillment_config_routing_rules.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. location_groups = hash.key?('location_groups') ? hash['location_groups'] : nil # Parameter is an array, so we need to iterate through it routes = nil unless hash['routes'].nil? routes = [] hash['routes'].each do |structure| routes << (FulfillmentConfigRoute.from_hash(structure) if structure) end end routes = nil unless hash.key?('routes') sl_levels_priority = hash.key?('sl_levels_priority') ? hash['sl_levels_priority'] : nil zip_code_regions = hash.key?('zip_code_regions') ? hash['zip_code_regions'] : nil preferred_locations = hash.key?('preferred_locations') ? hash['preferred_locations'] : SKIP # Create object from extracted values. FulfillmentConfigRoutingRules.new(location_groups, routes, sl_levels_priority, zip_code_regions, preferred_locations) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 41 42 |
# File 'lib/new_store_api/models/fulfillment_config_routing_rules.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['location_groups'] = 'location_groups' @_hash['preferred_locations'] = 'preferred_locations' @_hash['routes'] = 'routes' @_hash['sl_levels_priority'] = 'sl_levels_priority' @_hash['zip_code_regions'] = 'zip_code_regions' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 55 56 |
# File 'lib/new_store_api/models/fulfillment_config_routing_rules.rb', line 52 def self.nullables %w[ preferred_locations ] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 |
# File 'lib/new_store_api/models/fulfillment_config_routing_rules.rb', line 45 def self.optionals %w[ preferred_locations ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
109 110 111 112 113 114 |
# File 'lib/new_store_api/models/fulfillment_config_routing_rules.rb', line 109 def inspect class_name = self.class.name.split('::').last "<#{class_name} location_groups: #{@location_groups.inspect}, preferred_locations:"\ " #{@preferred_locations.inspect}, routes: #{@routes.inspect}, sl_levels_priority:"\ " #{@sl_levels_priority.inspect}, zip_code_regions: #{@zip_code_regions.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
101 102 103 104 105 106 |
# File 'lib/new_store_api/models/fulfillment_config_routing_rules.rb', line 101 def to_s class_name = self.class.name.split('::').last "<#{class_name} location_groups: #{@location_groups}, preferred_locations:"\ " #{@preferred_locations}, routes: #{@routes}, sl_levels_priority: #{@sl_levels_priority},"\ " zip_code_regions: #{@zip_code_regions}>" end |