Class: CyberSourceMergedSpec::ShippingDetails8

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/shipping_details8.rb

Overview

Contains shipping information not related to address.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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) ⇒ ShippingDetails8

Returns a new instance of ShippingDetails8.



66
67
68
69
70
71
72
73
74
# File 'lib/cyber_source_merged_spec/models/shipping_details8.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_wrapTrueClass | 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.

Returns:

  • (TrueClass | FalseClass)


19
20
21
# File 'lib/cyber_source_merged_spec/models/shipping_details8.rb', line 19

def gift_wrap
  @gift_wrap
end

#shipping_methodString

Shipping method for the product. Possible values:

  • lowcost: Lowest-cost service
  • sameday: Courier or same-day service
  • oneday: Next-day or overnight service
  • twoday: Two-day service
  • threeday: Three-day service
  • pickup: Store pick-up
  • other: Other shipping method
  • none: No shipping method because product is a service or subscription Klarna Advantage Plus additional values:
  • TO_DOOR: Delivery to door
  • TO_CURB: Delivery to curb
  • TO_MAILBOX: Delivery to mailbox
  • PICKUP_BOX: Pickup from box
  • PICKUP_POINT: Pickup from point
  • PICKUP_STORE: Pickup from store
  • PICKUP_WAREHOUSE: Pickup from warehouse
  • DIGITAL_EMAIL: Digital delivery via email
  • DIGITAL_DOWNLOAD: Digital download
  • DIGITAL_OTHER: Other digital delivery
  • PHYSICAL_OTHER: Other physical delivery

Returns:

  • (String)


43
44
45
# File 'lib/cyber_source_merged_spec/models/shipping_details8.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_details8.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_details8.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.
  ShippingDetails8.new(gift_wrap: gift_wrap,
                       shipping_method: shipping_method,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



46
47
48
49
50
51
# File 'lib/cyber_source_merged_spec/models/shipping_details8.rb', line 46

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['gift_wrap'] = 'giftWrap'
  @_hash['shipping_method'] = 'shippingMethod'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
# File 'lib/cyber_source_merged_spec/models/shipping_details8.rb', line 62

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
# File 'lib/cyber_source_merged_spec/models/shipping_details8.rb', line 54

def self.optionals
  %w[
    gift_wrap
    shipping_method
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



128
129
130
131
132
# File 'lib/cyber_source_merged_spec/models/shipping_details8.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_sObject

Provides a human-readable string representation of the object.



121
122
123
124
125
# File 'lib/cyber_source_merged_spec/models/shipping_details8.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_details8.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