Class: CyberSourceMergedSpec::OrderInformation35

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

Overview

Contains detailed order-level information.

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(amount_details: SKIP, pre_order: SKIP, pre_order_date: SKIP, cutoff_date_time: SKIP, reordered: SKIP, shipping_details: SKIP, ship_to: SKIP, returns_accepted: SKIP, line_items: SKIP, bill_to: SKIP, total_offers_count: SKIP, additional_properties: nil) ⇒ OrderInformation35

Returns a new instance of OrderInformation35.



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 115

def initialize(amount_details: SKIP, pre_order: SKIP, pre_order_date: SKIP,
               cutoff_date_time: SKIP, reordered: SKIP,
               shipping_details: SKIP, ship_to: SKIP,
               returns_accepted: SKIP, line_items: SKIP, bill_to: SKIP,
               total_offers_count: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @amount_details = amount_details unless amount_details == SKIP
  @pre_order = pre_order unless pre_order == SKIP
  @pre_order_date = pre_order_date unless pre_order_date == SKIP
  @cutoff_date_time = cutoff_date_time unless cutoff_date_time == SKIP
  @reordered = reordered unless reordered == SKIP
  @shipping_details = shipping_details unless shipping_details == SKIP
  @ship_to = ship_to unless ship_to == SKIP
  @returns_accepted = returns_accepted unless returns_accepted == SKIP
  @line_items = line_items unless line_items == SKIP
  @bill_to = bill_to unless bill_to == SKIP
  @total_offers_count = total_offers_count unless total_offers_count == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amount_detailsAmountDetails36

Contains currency and totalAmount for this order.

Returns:



14
15
16
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 14

def amount_details
  @amount_details
end

#bill_toBillTo64

This array contains detailed information about individual products in the order.

Returns:



69
70
71
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 69

def bill_to
  @bill_to
end

#cutoff_date_timeString

Starting date and time for an event or a journey that is independent of which transportation mechanism, in UTC. The cutoffDateTime will supersede travelInformation.departureTime if both are supplied in the request. Format: YYYY-MM-DDThh:mm:ssZ. Example 2016-08-11T22:47:57Z equals August 11, 2016, at 22:47:57 (10:47:57 p.m.). The T separates the date and the time. The Z indicates UTC.

Returns:

  • (String)


36
37
38
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 36

def cutoff_date_time
  @cutoff_date_time
end

#line_itemsArray[LineItem11]

This array contains detailed information about individual products in the order.

Returns:



64
65
66
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 64

def line_items
  @line_items
end

#pre_orderString

Indicates whether cardholder is placing an order with a future availability or release date. This field can contain one of these values:

  • MERCHANDISE_AVAILABLE: Merchandise available
  • FUTURE_AVAILABILITY: Future availability

Returns:

  • (String)


22
23
24
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 22

def pre_order
  @pre_order
end

#pre_order_dateString

Expected date that a pre-ordered purchase will be available. Format: YYYYMMDD

Returns:

  • (String)


27
28
29
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 27

def pre_order_date
  @pre_order_date
end

#reorderedTrueClass | FalseClass

Indicates whether the cardholder is reordering previously purchased merchandise. This field can contain one of these values:

  • false: First time ordered
  • true: Reordered

Returns:

  • (TrueClass | FalseClass)


44
45
46
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 44

def reordered
  @reordered
end

#returns_acceptedTrueClass | FalseClass

Boolean that indicates whether returns are accepted for this order. This field can contain one of the following values:

  • true: Returns are accepted for this order.
  • false: Returns are not accepted for this order.

Returns:

  • (TrueClass | FalseClass)


59
60
61
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 59

def returns_accepted
  @returns_accepted
end

#ship_toShipTo27

Contains shipping information not related to address.

Returns:



52
53
54
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 52

def ship_to
  @ship_to
end

#shipping_detailsShippingDetails8

Contains shipping information not related to address.

Returns:



48
49
50
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 48

def shipping_details
  @shipping_details
end

#total_offers_countString

Total number of articles/items in the order as a numeric decimal count. Possible values: 00 - 99

Returns:

  • (String)


74
75
76
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 74

def total_offers_count
  @total_offers_count
end

Class Method Details

.from_element(root) ⇒ Object



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 189

def self.from_element(root)
  amount_details = XmlUtilities.from_element(root, 'AmountDetails36',
                                             AmountDetails36)
  pre_order = XmlUtilities.from_element(root, 'preOrder', String)
  pre_order_date = XmlUtilities.from_element(root, 'preOrderDate', String)
  cutoff_date_time = XmlUtilities.from_element(root, 'cutoffDateTime',
                                               String)
  reordered = XmlUtilities.from_element(root, 'reordered', TrueClass)
  shipping_details = XmlUtilities.from_element(root, 'ShippingDetails8',
                                               ShippingDetails8)
  ship_to = XmlUtilities.from_element(root, 'ShipTo27', ShipTo27)
  returns_accepted = XmlUtilities.from_element(root, 'returnsAccepted',
                                               TrueClass)
  line_items = XmlUtilities.from_element_to_array(root, 'LineItem11',
                                                  LineItem11)
  bill_to = XmlUtilities.from_element(root, 'BillTo64', BillTo64)
  total_offers_count = XmlUtilities.from_element(root, 'totalOffersCount',
                                                 String)

  new(amount_details: amount_details,
      pre_order: pre_order,
      pre_order_date: pre_order_date,
      cutoff_date_time: cutoff_date_time,
      reordered: reordered,
      shipping_details: shipping_details,
      ship_to: ship_to,
      returns_accepted: returns_accepted,
      line_items: line_items,
      bill_to: bill_to,
      total_offers_count: total_offers_count,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 138

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  amount_details = AmountDetails36.from_hash(hash['amountDetails']) if hash['amountDetails']
  pre_order = hash.key?('preOrder') ? hash['preOrder'] : SKIP
  pre_order_date = hash.key?('preOrderDate') ? hash['preOrderDate'] : SKIP
  cutoff_date_time =
    hash.key?('cutoffDateTime') ? hash['cutoffDateTime'] : SKIP
  reordered = hash.key?('reordered') ? hash['reordered'] : SKIP
  shipping_details = ShippingDetails8.from_hash(hash['shippingDetails']) if
    hash['shippingDetails']
  ship_to = ShipTo27.from_hash(hash['shipTo']) if hash['shipTo']
  returns_accepted =
    hash.key?('returnsAccepted') ? hash['returnsAccepted'] : SKIP
  # Parameter is an array, so we need to iterate through it
  line_items = nil
  unless hash['lineItems'].nil?
    line_items = []
    hash['lineItems'].each do |structure|
      line_items << (LineItem11.from_hash(structure) if structure)
    end
  end

  line_items = SKIP unless hash.key?('lineItems')
  bill_to = BillTo64.from_hash(hash['billTo']) if hash['billTo']
  total_offers_count =
    hash.key?('totalOffersCount') ? hash['totalOffersCount'] : 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.
  OrderInformation35.new(amount_details: amount_details,
                         pre_order: pre_order,
                         pre_order_date: pre_order_date,
                         cutoff_date_time: cutoff_date_time,
                         reordered: reordered,
                         shipping_details: shipping_details,
                         ship_to: ship_to,
                         returns_accepted: returns_accepted,
                         line_items: line_items,
                         bill_to: bill_to,
                         total_offers_count: total_offers_count,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 77

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amount_details'] = 'amountDetails'
  @_hash['pre_order'] = 'preOrder'
  @_hash['pre_order_date'] = 'preOrderDate'
  @_hash['cutoff_date_time'] = 'cutoffDateTime'
  @_hash['reordered'] = 'reordered'
  @_hash['shipping_details'] = 'shippingDetails'
  @_hash['ship_to'] = 'shipTo'
  @_hash['returns_accepted'] = 'returnsAccepted'
  @_hash['line_items'] = 'lineItems'
  @_hash['bill_to'] = 'billTo'
  @_hash['total_offers_count'] = 'totalOffersCount'
  @_hash
end

.nullablesObject

An array for nullable fields



111
112
113
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 111

def self.nullables
  []
end

.optionalsObject

An array for optional fields



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 94

def self.optionals
  %w[
    amount_details
    pre_order
    pre_order_date
    cutoff_date_time
    reordered
    shipping_details
    ship_to
    returns_accepted
    line_items
    bill_to
    total_offers_count
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



259
260
261
262
263
264
265
266
267
268
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 259

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} amount_details: #{@amount_details.inspect}, pre_order:"\
  " #{@pre_order.inspect}, pre_order_date: #{@pre_order_date.inspect}, cutoff_date_time:"\
  " #{@cutoff_date_time.inspect}, reordered: #{@reordered.inspect}, shipping_details:"\
  " #{@shipping_details.inspect}, ship_to: #{@ship_to.inspect}, returns_accepted:"\
  " #{@returns_accepted.inspect}, line_items: #{@line_items.inspect}, bill_to:"\
  " #{@bill_to.inspect}, total_offers_count: #{@total_offers_count.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



248
249
250
251
252
253
254
255
256
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 248

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} amount_details: #{@amount_details}, pre_order: #{@pre_order},"\
  " pre_order_date: #{@pre_order_date}, cutoff_date_time: #{@cutoff_date_time}, reordered:"\
  " #{@reordered}, shipping_details: #{@shipping_details}, ship_to: #{@ship_to},"\
  " returns_accepted: #{@returns_accepted}, line_items: #{@line_items}, bill_to: #{@bill_to},"\
  " total_offers_count: #{@total_offers_count}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/cyber_source_merged_spec/models/order_information35.rb', line 222

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'AmountDetails36',
                                 amount_details)
  XmlUtilities.add_as_subelement(doc, root, 'preOrder', pre_order)
  XmlUtilities.add_as_subelement(doc, root, 'preOrderDate', pre_order_date)
  XmlUtilities.add_as_subelement(doc, root, 'cutoffDateTime',
                                 cutoff_date_time)
  XmlUtilities.add_as_subelement(doc, root, 'reordered', reordered)
  XmlUtilities.add_as_subelement(doc, root, 'ShippingDetails8',
                                 shipping_details)
  XmlUtilities.add_as_subelement(doc, root, 'ShipTo27', ship_to)
  XmlUtilities.add_as_subelement(doc, root, 'returnsAccepted',
                                 returns_accepted)
  XmlUtilities.add_array_as_subelement(doc, root, 'LineItem11', line_items)
  XmlUtilities.add_as_subelement(doc, root, 'BillTo64', bill_to)
  XmlUtilities.add_as_subelement(doc, root, 'totalOffersCount',
                                 total_offers_count)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end