Class: CyberSourceMergedSpec::ShippingDetails9
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::ShippingDetails9
- Defined in:
- lib/cyber_source_merged_spec/models/shipping_details9.rb
Overview
ShippingDetails9 Model.
Instance Attribute Summary collapse
-
#gift_wrap ⇒ TrueClass | FalseClass
Boolean that indicates whether the customer requested gift wrapping for this purchase.
-
#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, additional_properties: nil) ⇒ ShippingDetails9
constructor
A new instance of ShippingDetails9.
-
#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, additional_properties: nil) ⇒ ShippingDetails9
Returns a new instance of ShippingDetails9.
66 67 68 69 70 71 72 73 74 |
# File 'lib/cyber_source_merged_spec/models/shipping_details9.rb', line 66 def initialize(gift_wrap: SKIP, shipping_method: 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 @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_details9.rb', line 19 def gift_wrap @gift_wrap 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_details9.rb', line 43 def shipping_method @shipping_method end |
Class Method Details
.from_element(root) ⇒ Object
98 99 100 101 102 103 104 105 106 |
# File 'lib/cyber_source_merged_spec/models/shipping_details9.rb', line 98 def self.from_element(root) gift_wrap = XmlUtilities.from_element(root, 'giftWrap', TrueClass) shipping_method = XmlUtilities.from_element(root, 'shippingMethod', String) new(gift_wrap: gift_wrap, shipping_method: shipping_method, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/cyber_source_merged_spec/models/shipping_details9.rb', line 77 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 # 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. ShippingDetails9.new(gift_wrap: gift_wrap, shipping_method: shipping_method, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
46 47 48 49 50 51 |
# File 'lib/cyber_source_merged_spec/models/shipping_details9.rb', line 46 def self.names @_hash = {} if @_hash.nil? @_hash['gift_wrap'] = 'giftWrap' @_hash['shipping_method'] = 'shippingMethod' @_hash end |
.nullables ⇒ Object
An array for nullable fields
62 63 64 |
# File 'lib/cyber_source_merged_spec/models/shipping_details9.rb', line 62 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 |
# File 'lib/cyber_source_merged_spec/models/shipping_details9.rb', line 54 def self.optionals %w[ gift_wrap shipping_method ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
128 129 130 131 132 |
# File 'lib/cyber_source_merged_spec/models/shipping_details9.rb', line 128 def inspect class_name = self.class.name.split('::').last "<#{class_name} gift_wrap: #{@gift_wrap.inspect}, shipping_method:"\ " #{@shipping_method.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
121 122 123 124 125 |
# File 'lib/cyber_source_merged_spec/models/shipping_details9.rb', line 121 def to_s class_name = self.class.name.split('::').last "<#{class_name} gift_wrap: #{@gift_wrap}, shipping_method: #{@shipping_method},"\ " additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/cyber_source_merged_spec/models/shipping_details9.rb', line 108 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, 'additional_properties', additional_properties) root end |