Class: WalmartApIs::ShippingService
- Defined in:
- lib/walmart_ap_is/models/shipping_service.rb
Overview
ShippingService Model.
Instance Attribute Summary collapse
-
#carrier_name ⇒ CarrierName
TODO: Write general description for this method.
-
#earliest_estimated_delivery_date ⇒ DateTime
TODO: Write general description for this method.
-
#latest_estimated_delivery_date ⇒ DateTime
TODO: Write general description for this method.
-
#rate ⇒ Money
TODO: Write general description for this method.
-
#ship_date ⇒ DateTime
TODO: Write general description for this method.
-
#shipping_service_id ⇒ String
TODO: Write general description for this method.
-
#shipping_service_name ⇒ String
TODO: Write general description for this method.
-
#shipping_service_offer_id ⇒ String
TODO: Write general description for this method.
-
#shipping_service_options ⇒ ShippingServiceOptions
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_service_id:, carrier_name:, shipping_service_offer_id:, shipping_service_name: SKIP, ship_date: SKIP, earliest_estimated_delivery_date: SKIP, latest_estimated_delivery_date: SKIP, rate: SKIP, shipping_service_options: SKIP, additional_properties: nil) ⇒ ShippingService
constructor
A new instance of ShippingService.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_earliest_estimated_delivery_date ⇒ Object
- #to_custom_latest_estimated_delivery_date ⇒ Object
- #to_custom_ship_date ⇒ Object
-
#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_service_id:, carrier_name:, shipping_service_offer_id:, shipping_service_name: SKIP, ship_date: SKIP, earliest_estimated_delivery_date: SKIP, latest_estimated_delivery_date: SKIP, rate: SKIP, shipping_service_options: SKIP, additional_properties: nil) ⇒ ShippingService
Returns a new instance of ShippingService.
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 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 82 def initialize(shipping_service_id:, carrier_name:, shipping_service_offer_id:, shipping_service_name: SKIP, ship_date: SKIP, earliest_estimated_delivery_date: SKIP, latest_estimated_delivery_date: SKIP, rate: SKIP, shipping_service_options: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @shipping_service_id = shipping_service_id @carrier_name = carrier_name @shipping_service_name = shipping_service_name unless shipping_service_name == SKIP @shipping_service_offer_id = shipping_service_offer_id @ship_date = ship_date unless ship_date == SKIP unless earliest_estimated_delivery_date == SKIP @earliest_estimated_delivery_date = earliest_estimated_delivery_date end unless latest_estimated_delivery_date == SKIP @latest_estimated_delivery_date = latest_estimated_delivery_date end @rate = rate unless rate == SKIP @shipping_service_options = unless == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#carrier_name ⇒ CarrierName
TODO: Write general description for this method
19 20 21 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 19 def carrier_name @carrier_name end |
#earliest_estimated_delivery_date ⇒ DateTime
TODO: Write general description for this method
35 36 37 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 35 def earliest_estimated_delivery_date @earliest_estimated_delivery_date end |
#latest_estimated_delivery_date ⇒ DateTime
TODO: Write general description for this method
39 40 41 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 39 def latest_estimated_delivery_date @latest_estimated_delivery_date end |
#rate ⇒ Money
TODO: Write general description for this method
43 44 45 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 43 def rate @rate end |
#ship_date ⇒ DateTime
TODO: Write general description for this method
31 32 33 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 31 def ship_date @ship_date end |
#shipping_service_id ⇒ String
TODO: Write general description for this method
15 16 17 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 15 def shipping_service_id @shipping_service_id end |
#shipping_service_name ⇒ String
TODO: Write general description for this method
23 24 25 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 23 def shipping_service_name @shipping_service_name end |
#shipping_service_offer_id ⇒ String
TODO: Write general description for this method
27 28 29 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 27 def shipping_service_offer_id @shipping_service_offer_id end |
#shipping_service_options ⇒ ShippingServiceOptions
TODO: Write general description for this method
47 48 49 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 47 def @shipping_service_options end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 109 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. shipping_service_id = hash.key?('shippingServiceId') ? hash['shippingServiceId'] : nil carrier_name = hash.key?('carrierName') ? hash['carrierName'] : nil shipping_service_offer_id = hash.key?('shippingServiceOfferId') ? hash['shippingServiceOfferId'] : nil shipping_service_name = hash.key?('shippingServiceName') ? hash['shippingServiceName'] : SKIP ship_date = if hash.key?('shipDate') (DateTimeHelper.from_rfc3339(hash['shipDate']) if hash['shipDate']) else SKIP end earliest_estimated_delivery_date = if hash.key?('earliestEstimatedDeliveryDate') (DateTimeHelper.from_rfc3339(hash['earliestEstimatedDeliveryDate']) if hash['earliestEstimatedDeliveryDate']) else SKIP end latest_estimated_delivery_date = if hash.key?('latestEstimatedDeliveryDate') (DateTimeHelper.from_rfc3339(hash['latestEstimatedDeliveryDate']) if hash['latestEstimatedDeliveryDate']) else SKIP end rate = Money.from_hash(hash['rate']) if hash['rate'] = ShippingServiceOptions.from_hash(hash['shippingServiceOptions']) if hash['shippingServiceOptions'] # 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. ShippingService.new(shipping_service_id: shipping_service_id, carrier_name: carrier_name, shipping_service_offer_id: shipping_service_offer_id, shipping_service_name: shipping_service_name, ship_date: ship_date, earliest_estimated_delivery_date: earliest_estimated_delivery_date, latest_estimated_delivery_date: latest_estimated_delivery_date, rate: rate, shipping_service_options: , additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 50 def self.names @_hash = {} if @_hash.nil? @_hash['shipping_service_id'] = 'shippingServiceId' @_hash['carrier_name'] = 'carrierName' @_hash['shipping_service_name'] = 'shippingServiceName' @_hash['shipping_service_offer_id'] = 'shippingServiceOfferId' @_hash['ship_date'] = 'shipDate' @_hash['earliest_estimated_delivery_date'] = 'earliestEstimatedDeliveryDate' @_hash['latest_estimated_delivery_date'] = 'latestEstimatedDeliveryDate' @_hash['rate'] = 'rate' @_hash['shipping_service_options'] = 'shippingServiceOptions' @_hash end |
.nullables ⇒ Object
An array for nullable fields
78 79 80 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 78 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 66 def self.optionals %w[ shipping_service_name ship_date earliest_estimated_delivery_date latest_estimated_delivery_date rate shipping_service_options ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 184 def inspect class_name = self.class.name.split('::').last "<#{class_name} shipping_service_id: #{@shipping_service_id.inspect}, carrier_name:"\ " #{@carrier_name.inspect}, shipping_service_name: #{@shipping_service_name.inspect},"\ " shipping_service_offer_id: #{@shipping_service_offer_id.inspect}, ship_date:"\ " #{@ship_date.inspect}, earliest_estimated_delivery_date:"\ " #{@earliest_estimated_delivery_date.inspect}, latest_estimated_delivery_date:"\ " #{@latest_estimated_delivery_date.inspect}, rate: #{@rate.inspect},"\ " shipping_service_options: #{@shipping_service_options.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_earliest_estimated_delivery_date ⇒ Object
163 164 165 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 163 def to_custom_earliest_estimated_delivery_date DateTimeHelper.to_rfc3339(earliest_estimated_delivery_date) end |
#to_custom_latest_estimated_delivery_date ⇒ Object
167 168 169 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 167 def to_custom_latest_estimated_delivery_date DateTimeHelper.to_rfc3339(latest_estimated_delivery_date) end |
#to_custom_ship_date ⇒ Object
159 160 161 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 159 def to_custom_ship_date DateTimeHelper.to_rfc3339(ship_date) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
172 173 174 175 176 177 178 179 180 181 |
# File 'lib/walmart_ap_is/models/shipping_service.rb', line 172 def to_s class_name = self.class.name.split('::').last "<#{class_name} shipping_service_id: #{@shipping_service_id}, carrier_name:"\ " #{@carrier_name}, shipping_service_name: #{@shipping_service_name},"\ " shipping_service_offer_id: #{@shipping_service_offer_id}, ship_date: #{@ship_date},"\ " earliest_estimated_delivery_date: #{@earliest_estimated_delivery_date},"\ " latest_estimated_delivery_date: #{@latest_estimated_delivery_date}, rate: #{@rate},"\ " shipping_service_options: #{@shipping_service_options}, additional_properties:"\ " #{@additional_properties}>" end |