Class: WalmartApIs::FulfillmentPreview
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- WalmartApIs::FulfillmentPreview
- Defined in:
- lib/walmart_ap_is/models/fulfillment_preview.rb
Overview
FulfillmentPreview Model.
Instance Attribute Summary collapse
-
#estimated_fees ⇒ Array[Fee]
TODO: Write general description for this method.
-
#fulfillment_preview_shipments ⇒ Array[FulfillmentPreviewShipment]
TODO: Write general description for this method.
-
#is_cod_capable ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#is_fulfillable ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#shipping_speed_category ⇒ ShippingSpeedCategory
TODO: Write general description for this method.
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(shipping_speed_category: SKIP, fulfillment_preview_shipments: SKIP, is_fulfillable: SKIP, is_cod_capable: SKIP, estimated_fees: SKIP, additional_properties: nil) ⇒ FulfillmentPreview
constructor
A new instance of FulfillmentPreview.
-
#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(shipping_speed_category: SKIP, fulfillment_preview_shipments: SKIP, is_fulfillable: SKIP, is_cod_capable: SKIP, estimated_fees: SKIP, additional_properties: nil) ⇒ FulfillmentPreview
Returns a new instance of FulfillmentPreview.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/walmart_ap_is/models/fulfillment_preview.rb', line 59 def initialize(shipping_speed_category: SKIP, fulfillment_preview_shipments: SKIP, is_fulfillable: SKIP, is_cod_capable: SKIP, estimated_fees: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @shipping_speed_category = shipping_speed_category unless shipping_speed_category == SKIP unless fulfillment_preview_shipments == SKIP @fulfillment_preview_shipments = fulfillment_preview_shipments end @is_fulfillable = is_fulfillable unless is_fulfillable == SKIP @is_cod_capable = is_cod_capable unless is_cod_capable == SKIP @estimated_fees = estimated_fees unless estimated_fees == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#estimated_fees ⇒ Array[Fee]
TODO: Write general description for this method
30 31 32 |
# File 'lib/walmart_ap_is/models/fulfillment_preview.rb', line 30 def estimated_fees @estimated_fees end |
#fulfillment_preview_shipments ⇒ Array[FulfillmentPreviewShipment]
TODO: Write general description for this method
18 19 20 |
# File 'lib/walmart_ap_is/models/fulfillment_preview.rb', line 18 def fulfillment_preview_shipments @fulfillment_preview_shipments end |
#is_cod_capable ⇒ TrueClass | FalseClass
TODO: Write general description for this method
26 27 28 |
# File 'lib/walmart_ap_is/models/fulfillment_preview.rb', line 26 def is_cod_capable @is_cod_capable end |
#is_fulfillable ⇒ TrueClass | FalseClass
TODO: Write general description for this method
22 23 24 |
# File 'lib/walmart_ap_is/models/fulfillment_preview.rb', line 22 def is_fulfillable @is_fulfillable end |
#shipping_speed_category ⇒ ShippingSpeedCategory
TODO: Write general description for this method
14 15 16 |
# File 'lib/walmart_ap_is/models/fulfillment_preview.rb', line 14 def shipping_speed_category @shipping_speed_category end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/walmart_ap_is/models/fulfillment_preview.rb', line 78 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. shipping_speed_category = hash.key?('shippingSpeedCategory') ? hash['shippingSpeedCategory'] : SKIP # Parameter is an array, so we need to iterate through it fulfillment_preview_shipments = nil unless hash['fulfillmentPreviewShipments'].nil? fulfillment_preview_shipments = [] hash['fulfillmentPreviewShipments'].each do |structure| fulfillment_preview_shipments << (FulfillmentPreviewShipment.from_hash(structure) if structure) end end fulfillment_preview_shipments = SKIP unless hash.key?('fulfillmentPreviewShipments') is_fulfillable = hash.key?('isFulfillable') ? hash['isFulfillable'] : SKIP is_cod_capable = hash.key?('isCODCapable') ? hash['isCODCapable'] : SKIP # Parameter is an array, so we need to iterate through it estimated_fees = nil unless hash['estimatedFees'].nil? estimated_fees = [] hash['estimatedFees'].each do |structure| estimated_fees << (Fee.from_hash(structure) if structure) end end estimated_fees = SKIP unless hash.key?('estimatedFees') # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. FulfillmentPreview.new(shipping_speed_category: shipping_speed_category, fulfillment_preview_shipments: fulfillment_preview_shipments, is_fulfillable: is_fulfillable, is_cod_capable: is_cod_capable, estimated_fees: estimated_fees, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/walmart_ap_is/models/fulfillment_preview.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['shipping_speed_category'] = 'shippingSpeedCategory' @_hash['fulfillment_preview_shipments'] = 'fulfillmentPreviewShipments' @_hash['is_fulfillable'] = 'isFulfillable' @_hash['is_cod_capable'] = 'isCODCapable' @_hash['estimated_fees'] = 'estimatedFees' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/walmart_ap_is/models/fulfillment_preview.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 52 |
# File 'lib/walmart_ap_is/models/fulfillment_preview.rb', line 44 def self.optionals %w[ shipping_speed_category fulfillment_preview_shipments is_fulfillable is_cod_capable estimated_fees ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
133 134 135 136 137 138 139 |
# File 'lib/walmart_ap_is/models/fulfillment_preview.rb', line 133 def inspect class_name = self.class.name.split('::').last "<#{class_name} shipping_speed_category: #{@shipping_speed_category.inspect},"\ " fulfillment_preview_shipments: #{@fulfillment_preview_shipments.inspect}, is_fulfillable:"\ " #{@is_fulfillable.inspect}, is_cod_capable: #{@is_cod_capable.inspect}, estimated_fees:"\ " #{@estimated_fees.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
124 125 126 127 128 129 130 |
# File 'lib/walmart_ap_is/models/fulfillment_preview.rb', line 124 def to_s class_name = self.class.name.split('::').last "<#{class_name} shipping_speed_category: #{@shipping_speed_category},"\ " fulfillment_preview_shipments: #{@fulfillment_preview_shipments}, is_fulfillable:"\ " #{@is_fulfillable}, is_cod_capable: #{@is_cod_capable}, estimated_fees:"\ " #{@estimated_fees}, additional_properties: #{@additional_properties}>" end |