Class: CyberSourceMergedSpec::ReportingV3NetFundingsGet200Response

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

Overview

ReportingV3NetFundingsGet200Response Model.

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(start_time: SKIP, end_time: SKIP, net_funding_summaries: SKIP, total_purchases: SKIP, total_refunds: SKIP, total_fees: SKIP, total_chargebacks: SKIP, net_total: SKIP, additional_properties: nil) ⇒ ReportingV3NetFundingsGet200Response

Returns a new instance of ReportingV3NetFundingsGet200Response.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 86

def initialize(start_time: SKIP, end_time: SKIP,
               net_funding_summaries: SKIP, total_purchases: SKIP,
               total_refunds: SKIP, total_fees: SKIP,
               total_chargebacks: SKIP, net_total: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @start_time = start_time unless start_time == SKIP
  @end_time = end_time unless end_time == SKIP
  @net_funding_summaries = net_funding_summaries unless net_funding_summaries == SKIP
  @total_purchases = total_purchases unless total_purchases == SKIP
  @total_refunds = total_refunds unless total_refunds == SKIP
  @total_fees = total_fees unless total_fees == SKIP
  @total_chargebacks = total_chargebacks unless total_chargebacks == SKIP
  @net_total = net_total unless net_total == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#end_timeDateTime

Valid report End Date in ISO 8601 format Example date format:

  • yyyy-MM-dd'T'HH:mm:ss.SSSZZ

Returns:

  • (DateTime)


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

def end_time
  @end_time
end

#net_funding_summariesArray[NetFundingSummary]

List of Netfunding summary objects

Returns:



31
32
33
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 31

def net_funding_summaries
  @net_funding_summaries
end

#net_totalArray[NetTotal]

List of new total currency wise

Returns:



51
52
53
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 51

def net_total
  @net_total
end

#start_timeDateTime

Valid report Start Date in ISO 8601 format. Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor 14) Example:

  • yyyy-MM-dd'T'HH:mm:ss.SSSZZ

Returns:

  • (DateTime)


21
22
23
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 21

def start_time
  @start_time
end

#total_chargebacksArray[TotalChargeback]

List of total chargebacks currency wise

Returns:



47
48
49
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 47

def total_chargebacks
  @total_chargebacks
end

#total_feesArray[TotalFee]

List of total fees currency wise

Returns:



43
44
45
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 43

def total_fees
  @total_fees
end

#total_purchasesArray[TotalPurchase]

List of total purchases currency wise

Returns:



35
36
37
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 35

def total_purchases
  @total_purchases
end

#total_refundsArray[TotalRefund]

List of total refunds currency wise

Returns:



39
40
41
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 39

def total_refunds
  @total_refunds
end

Class Method Details

.from_element(root) ⇒ Object



208
209
210
211
212
213
214
215
216
217
218
219
220
221
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/reporting_v3_net_fundings_get200_response.rb', line 208

def self.from_element(root)
  start_time = XmlUtilities.from_attribute(root, 'startTime', String,
                                           datetime_format: 'rfc3339')
  end_time = XmlUtilities.from_attribute(root, 'endTime', String,
                                         datetime_format: 'rfc3339')
  net_funding_summaries = XmlUtilities.from_element_to_array(
    root, 'NetFundingSummary', NetFundingSummary,
    wrapping_element_name: 'NetFundingSummaries'
  )
  total_purchases = XmlUtilities.from_element_to_array(
    root, 'Amount', TotalPurchase,
    wrapping_element_name: 'totalPurchases'
  )
  total_refunds = XmlUtilities.from_element_to_array(
    root, 'Amount', TotalRefund,
    wrapping_element_name: 'totalRefunds'
  )
  total_fees = XmlUtilities.from_element_to_array(
    root, 'Amount', TotalFee, wrapping_element_name: 'totalFees'
  )
  total_chargebacks = XmlUtilities.from_element_to_array(
    root, 'Amount', TotalChargeback,
    wrapping_element_name: 'totalChargebacks'
  )
  net_total = XmlUtilities.from_element_to_array(
    root, 'Amount', NetTotal, wrapping_element_name: 'netTotal'
  )

  new(start_time: start_time,
      end_time: end_time,
      net_funding_summaries: net_funding_summaries,
      total_purchases: total_purchases,
      total_refunds: total_refunds,
      total_fees: total_fees,
      total_chargebacks: total_chargebacks,
      net_total: net_total,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
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
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 106

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  start_time = if hash.key?('startTime')
                 (DateTimeHelper.from_rfc3339(hash['startTime']) if hash['startTime'])
               else
                 SKIP
               end
  end_time = if hash.key?('endTime')
               (DateTimeHelper.from_rfc3339(hash['endTime']) if hash['endTime'])
             else
               SKIP
             end
  # Parameter is an array, so we need to iterate through it
  net_funding_summaries = nil
  unless hash['netFundingSummaries'].nil?
    net_funding_summaries = []
    hash['netFundingSummaries'].each do |structure|
      net_funding_summaries << (NetFundingSummary.from_hash(structure) if structure)
    end
  end

  net_funding_summaries = SKIP unless hash.key?('netFundingSummaries')
  # Parameter is an array, so we need to iterate through it
  total_purchases = nil
  unless hash['totalPurchases'].nil?
    total_purchases = []
    hash['totalPurchases'].each do |structure|
      total_purchases << (TotalPurchase.from_hash(structure) if structure)
    end
  end

  total_purchases = SKIP unless hash.key?('totalPurchases')
  # Parameter is an array, so we need to iterate through it
  total_refunds = nil
  unless hash['totalRefunds'].nil?
    total_refunds = []
    hash['totalRefunds'].each do |structure|
      total_refunds << (TotalRefund.from_hash(structure) if structure)
    end
  end

  total_refunds = SKIP unless hash.key?('totalRefunds')
  # Parameter is an array, so we need to iterate through it
  total_fees = nil
  unless hash['totalFees'].nil?
    total_fees = []
    hash['totalFees'].each do |structure|
      total_fees << (TotalFee.from_hash(structure) if structure)
    end
  end

  total_fees = SKIP unless hash.key?('totalFees')
  # Parameter is an array, so we need to iterate through it
  total_chargebacks = nil
  unless hash['totalChargebacks'].nil?
    total_chargebacks = []
    hash['totalChargebacks'].each do |structure|
      total_chargebacks << (TotalChargeback.from_hash(structure) if structure)
    end
  end

  total_chargebacks = SKIP unless hash.key?('totalChargebacks')
  # Parameter is an array, so we need to iterate through it
  net_total = nil
  unless hash['netTotal'].nil?
    net_total = []
    hash['netTotal'].each do |structure|
      net_total << (NetTotal.from_hash(structure) if structure)
    end
  end

  net_total = SKIP unless hash.key?('netTotal')

  # 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.
  ReportingV3NetFundingsGet200Response.new(start_time: start_time,
                                           end_time: end_time,
                                           net_funding_summaries: net_funding_summaries,
                                           total_purchases: total_purchases,
                                           total_refunds: total_refunds,
                                           total_fees: total_fees,
                                           total_chargebacks: total_chargebacks,
                                           net_total: net_total,
                                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 54

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['start_time'] = 'startTime'
  @_hash['end_time'] = 'endTime'
  @_hash['net_funding_summaries'] = 'netFundingSummaries'
  @_hash['total_purchases'] = 'totalPurchases'
  @_hash['total_refunds'] = 'totalRefunds'
  @_hash['total_fees'] = 'totalFees'
  @_hash['total_chargebacks'] = 'totalChargebacks'
  @_hash['net_total'] = 'netTotal'
  @_hash
end

.nullablesObject

An array for nullable fields



82
83
84
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 82

def self.nullables
  []
end

.optionalsObject

An array for optional fields



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 68

def self.optionals
  %w[
    start_time
    end_time
    net_funding_summaries
    total_purchases
    total_refunds
    total_fees
    total_chargebacks
    net_total
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



290
291
292
293
294
295
296
297
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 290

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} start_time: #{@start_time.inspect}, end_time: #{@end_time.inspect},"\
  " net_funding_summaries: #{@net_funding_summaries.inspect}, total_purchases:"\
  " #{@total_purchases.inspect}, total_refunds: #{@total_refunds.inspect}, total_fees:"\
  " #{@total_fees.inspect}, total_chargebacks: #{@total_chargebacks.inspect}, net_total:"\
  " #{@net_total.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_end_timeObject



204
205
206
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 204

def to_custom_end_time
  DateTimeHelper.to_rfc3339(end_time)
end

#to_custom_start_timeObject



200
201
202
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 200

def to_custom_start_time
  DateTimeHelper.to_rfc3339(start_time)
end

#to_sObject

Provides a human-readable string representation of the object.



281
282
283
284
285
286
287
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 281

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} start_time: #{@start_time}, end_time: #{@end_time}, net_funding_summaries:"\
  " #{@net_funding_summaries}, total_purchases: #{@total_purchases}, total_refunds:"\
  " #{@total_refunds}, total_fees: #{@total_fees}, total_chargebacks: #{@total_chargebacks},"\
  " net_total: #{@net_total}, additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/cyber_source_merged_spec/models/reporting_v3_net_fundings_get200_response.rb', line 247

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

  XmlUtilities.add_as_attribute(root, 'startTime', start_time,
                                datetime_format: 'rfc3339')
  XmlUtilities.add_as_attribute(root, 'endTime', end_time,
                                datetime_format: 'rfc3339')
  XmlUtilities.add_array_as_subelement(
    doc, root, 'NetFundingSummary', net_funding_summaries,
    wrapping_element_name: 'NetFundingSummaries'
  )
  XmlUtilities.add_array_as_subelement(
    doc, root, 'Amount', total_purchases,
    wrapping_element_name: 'totalPurchases'
  )
  XmlUtilities.add_array_as_subelement(
    doc, root, 'Amount', total_refunds,
    wrapping_element_name: 'totalRefunds'
  )
  XmlUtilities.add_array_as_subelement(doc, root, 'Amount', total_fees,
                                       wrapping_element_name: 'totalFees')
  XmlUtilities.add_array_as_subelement(
    doc, root, 'Amount', total_chargebacks,
    wrapping_element_name: 'totalChargebacks'
  )
  XmlUtilities.add_array_as_subelement(doc, root, 'Amount', net_total,
                                       wrapping_element_name: 'netTotal')
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end