Class: CyberSourceMergedSpec::ShippingDetails
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::ShippingDetails
- Defined in:
- lib/cyber_source_merged_spec/models/shipping_details.rb
Overview
Contains shipping information not related to address.
Instance Attribute Summary collapse
-
#gift_wrap ⇒ TrueClass | FalseClass
Boolean that indicates whether the customer requested gift wrapping for this purchase.
-
#ship_from_postal_code ⇒ String
Postal code for the address from which the goods are shipped, which is used to establish nexus.
-
#shipping_carrier ⇒ String
Name of the shipping carrier/company handling the delivery.
-
#shipping_method ⇒ String
Shipping method for the product.
Class Method Summary collapse
- .from_element(root) ⇒ Object
-
.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(gift_wrap: SKIP, shipping_method: SKIP, ship_from_postal_code: SKIP, shipping_carrier: SKIP, additional_properties: nil) ⇒ ShippingDetails
constructor
A new instance of ShippingDetails.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_xml_element(doc, root_name) ⇒ 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(gift_wrap: SKIP, shipping_method: SKIP, ship_from_postal_code: SKIP, shipping_carrier: SKIP, additional_properties: nil) ⇒ ShippingDetails
Returns a new instance of ShippingDetails.
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/cyber_source_merged_spec/models/shipping_details.rb', line 90 def initialize(gift_wrap: SKIP, shipping_method: SKIP, ship_from_postal_code: SKIP, shipping_carrier: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @gift_wrap = gift_wrap unless gift_wrap == SKIP @shipping_method = shipping_method unless shipping_method == SKIP @ship_from_postal_code = ship_from_postal_code unless ship_from_postal_code == SKIP @shipping_carrier = shipping_carrier unless shipping_carrier == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#gift_wrap ⇒ TrueClass | FalseClass
Boolean that indicates whether the customer requested gift wrapping for this purchase. This field can contain one of the following values:
- true: The customer requested gift wrapping.
- false: The customer did not request gift wrapping.
19 20 21 |
# File 'lib/cyber_source_merged_spec/models/shipping_details.rb', line 19 def gift_wrap @gift_wrap end |
#ship_from_postal_code ⇒ String
Postal code for the address from which the goods are shipped, which is
used to establish nexus. The default is
the postal code associated with your CyberSource account.
The postal code must consist of 5 to 9 digits. When the billing country is
the U.S., the 9-digit postal code
must follow this format:
[5 digits][dash][4 digits]
Example 12345-6789
When the billing country is Canada, the 6-digit postal code must follow
this format:
[alpha][numeric][alpha][space] [numeric][alpha][numeric]
Example A1B 2C3
This field is frequently used for Level II and Level III transactions.
59 60 61 |
# File 'lib/cyber_source_merged_spec/models/shipping_details.rb', line 59 def ship_from_postal_code @ship_from_postal_code end |
#shipping_carrier ⇒ String
Name of the shipping carrier/company handling the delivery.
63 64 65 |
# File 'lib/cyber_source_merged_spec/models/shipping_details.rb', line 63 def shipping_carrier @shipping_carrier end |
#shipping_method ⇒ String
Shipping method for the product. Possible values:
lowcost: Lowest-cost servicesameday: Courier or same-day serviceoneday: Next-day or overnight servicetwoday: Two-day servicethreeday: Three-day servicepickup: Store pick-upother: Other shipping methodnone: No shipping method because product is a service or subscription Klarna Advantage Plus additional values:TO_DOOR: Delivery to doorTO_CURB: Delivery to curbTO_MAILBOX: Delivery to mailboxPICKUP_BOX: Pickup from boxPICKUP_POINT: Pickup from pointPICKUP_STORE: Pickup from storePICKUP_WAREHOUSE: Pickup from warehouseDIGITAL_EMAIL: Digital delivery via emailDIGITAL_DOWNLOAD: Digital downloadDIGITAL_OTHER: Other digital deliveryPHYSICAL_OTHER: Other physical delivery
43 44 45 |
# File 'lib/cyber_source_merged_spec/models/shipping_details.rb', line 43 def shipping_method @shipping_method end |
Class Method Details
.from_element(root) ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/cyber_source_merged_spec/models/shipping_details.rb', line 131 def self.from_element(root) gift_wrap = XmlUtilities.from_element(root, 'giftWrap', TrueClass) shipping_method = XmlUtilities.from_element(root, 'shippingMethod', String) ship_from_postal_code = XmlUtilities.from_element(root, 'shipFromPostalCode', String) shipping_carrier = XmlUtilities.from_element(root, 'shippingCarrier', String) new(gift_wrap: gift_wrap, shipping_method: shipping_method, ship_from_postal_code: ship_from_postal_code, shipping_carrier: shipping_carrier, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/cyber_source_merged_spec/models/shipping_details.rb', line 104 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. gift_wrap = hash.key?('giftWrap') ? hash['giftWrap'] : SKIP shipping_method = hash.key?('shippingMethod') ? hash['shippingMethod'] : SKIP ship_from_postal_code = hash.key?('shipFromPostalCode') ? hash['shipFromPostalCode'] : SKIP shipping_carrier = hash.key?('shippingCarrier') ? hash['shippingCarrier'] : SKIP # 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. ShippingDetails.new(gift_wrap: gift_wrap, shipping_method: shipping_method, ship_from_postal_code: ship_from_postal_code, shipping_carrier: shipping_carrier, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
66 67 68 69 70 71 72 73 |
# File 'lib/cyber_source_merged_spec/models/shipping_details.rb', line 66 def self.names @_hash = {} if @_hash.nil? @_hash['gift_wrap'] = 'giftWrap' @_hash['shipping_method'] = 'shippingMethod' @_hash['ship_from_postal_code'] = 'shipFromPostalCode' @_hash['shipping_carrier'] = 'shippingCarrier' @_hash end |
.nullables ⇒ Object
An array for nullable fields
86 87 88 |
# File 'lib/cyber_source_merged_spec/models/shipping_details.rb', line 86 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
76 77 78 79 80 81 82 83 |
# File 'lib/cyber_source_merged_spec/models/shipping_details.rb', line 76 def self.optionals %w[ gift_wrap shipping_method ship_from_postal_code shipping_carrier ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
173 174 175 176 177 178 179 |
# File 'lib/cyber_source_merged_spec/models/shipping_details.rb', line 173 def inspect class_name = self.class.name.split('::').last "<#{class_name} gift_wrap: #{@gift_wrap.inspect}, shipping_method:"\ " #{@shipping_method.inspect}, ship_from_postal_code: #{@ship_from_postal_code.inspect},"\ " shipping_carrier: #{@shipping_carrier.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
165 166 167 168 169 170 |
# File 'lib/cyber_source_merged_spec/models/shipping_details.rb', line 165 def to_s class_name = self.class.name.split('::').last "<#{class_name} gift_wrap: #{@gift_wrap}, shipping_method: #{@shipping_method},"\ " ship_from_postal_code: #{@ship_from_postal_code}, shipping_carrier: #{@shipping_carrier},"\ " additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/cyber_source_merged_spec/models/shipping_details.rb', line 148 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'giftWrap', gift_wrap) XmlUtilities.add_as_subelement(doc, root, 'shippingMethod', shipping_method) XmlUtilities.add_as_subelement(doc, root, 'shipFromPostalCode', ship_from_postal_code) XmlUtilities.add_as_subelement(doc, root, 'shippingCarrier', shipping_carrier) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |