Class: CyberSourceMergedSpec::ShippingDetails5
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::ShippingDetails5
- Defined in:
- lib/cyber_source_merged_spec/models/shipping_details5.rb
Overview
ShippingDetails5 Model.
Instance Attribute Summary collapse
-
#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(shipping_method: SKIP, additional_properties: nil) ⇒ ShippingDetails5
constructor
A new instance of ShippingDetails5.
-
#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(shipping_method: SKIP, additional_properties: nil) ⇒ ShippingDetails5
Returns a new instance of ShippingDetails5.
55 56 57 58 59 60 61 |
# File 'lib/cyber_source_merged_spec/models/shipping_details5.rb', line 55 def initialize(shipping_method: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @shipping_method = shipping_method unless shipping_method == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#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
34 35 36 |
# File 'lib/cyber_source_merged_spec/models/shipping_details5.rb', line 34 def shipping_method @shipping_method end |
Class Method Details
.from_element(root) ⇒ Object
83 84 85 86 87 88 89 |
# File 'lib/cyber_source_merged_spec/models/shipping_details5.rb', line 83 def self.from_element(root) shipping_method = XmlUtilities.from_element(root, 'shippingMethod', String) new(shipping_method: shipping_method, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/cyber_source_merged_spec/models/shipping_details5.rb', line 64 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. 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. ShippingDetails5.new(shipping_method: shipping_method, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 |
# File 'lib/cyber_source_merged_spec/models/shipping_details5.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['shipping_method'] = 'shippingMethod' @_hash end |
.nullables ⇒ Object
An array for nullable fields
51 52 53 |
# File 'lib/cyber_source_merged_spec/models/shipping_details5.rb', line 51 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 |
# File 'lib/cyber_source_merged_spec/models/shipping_details5.rb', line 44 def self.optionals %w[ shipping_method ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
110 111 112 113 114 |
# File 'lib/cyber_source_merged_spec/models/shipping_details5.rb', line 110 def inspect class_name = self.class.name.split('::').last "<#{class_name} shipping_method: #{@shipping_method.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
103 104 105 106 107 |
# File 'lib/cyber_source_merged_spec/models/shipping_details5.rb', line 103 def to_s class_name = self.class.name.split('::').last "<#{class_name} shipping_method: #{@shipping_method}, additional_properties:"\ " #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/cyber_source_merged_spec/models/shipping_details5.rb', line 91 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'shippingMethod', shipping_method) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |