Class: CyberSourceMergedSpec::ReportingV3PurchaseRefundDetailsGet200Response

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

Overview

PurchaseAndRefundDetails

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(offset: SKIP, limit: SKIP, page_results: SKIP, request_details: SKIP, settlements: SKIP, authorizations: SKIP, fee_and_funding_details: SKIP, others: SKIP, settlement_statuses: SKIP, additional_properties: nil) ⇒ ReportingV3PurchaseRefundDetailsGet200Response

Returns a new instance of ReportingV3PurchaseRefundDetailsGet200Response.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/cyber_source_merged_spec/models/reporting_v3_purchase_refund_details_get200_response.rb', line 83

def initialize(offset: SKIP, limit: SKIP, page_results: SKIP,
               request_details: SKIP, settlements: SKIP,
               authorizations: SKIP, fee_and_funding_details: SKIP,
               others: SKIP, settlement_statuses: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @offset = offset unless offset == SKIP
  @limit = limit unless limit == SKIP
  @page_results = page_results unless page_results == SKIP
  @request_details = request_details unless request_details == SKIP
  @settlements = settlements unless settlements == SKIP
  @authorizations = authorizations unless authorizations == SKIP
  @fee_and_funding_details = fee_and_funding_details unless fee_and_funding_details == SKIP
  @others = others unless others == SKIP
  @settlement_statuses = settlement_statuses unless settlement_statuses == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#authorizationsArray[Authorization]

List of Authorization Info values

Returns:



34
35
36
# File 'lib/cyber_source_merged_spec/models/reporting_v3_purchase_refund_details_get200_response.rb', line 34

def authorizations
  @authorizations
end

#fee_and_funding_detailsArray[FeeAndFundingDetail]

List of Fee Funding Info values

Returns:



38
39
40
# File 'lib/cyber_source_merged_spec/models/reporting_v3_purchase_refund_details_get200_response.rb', line 38

def fee_and_funding_details
  @fee_and_funding_details
end

#limitInteger

TODO: Write general description for this method

Returns:

  • (Integer)


18
19
20
# File 'lib/cyber_source_merged_spec/models/reporting_v3_purchase_refund_details_get200_response.rb', line 18

def limit
  @limit
end

#offsetInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def offset
  @offset
end

#othersArray[Other]

List of Other Info values

Returns:



42
43
44
# File 'lib/cyber_source_merged_spec/models/reporting_v3_purchase_refund_details_get200_response.rb', line 42

def others
  @others
end

#page_resultsInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def page_results
  @page_results
end

#request_detailsArray[RequestDetail]

List of Request Info values

Returns:



26
27
28
# File 'lib/cyber_source_merged_spec/models/reporting_v3_purchase_refund_details_get200_response.rb', line 26

def request_details
  @request_details
end

#settlement_statusesArray[SettlementStatus]

List of Settlement Status Info values

Returns:



46
47
48
# File 'lib/cyber_source_merged_spec/models/reporting_v3_purchase_refund_details_get200_response.rb', line 46

def settlement_statuses
  @settlement_statuses
end

#settlementsArray[Settlement]

List of Settlement Info values

Returns:



30
31
32
# File 'lib/cyber_source_merged_spec/models/reporting_v3_purchase_refund_details_get200_response.rb', line 30

def settlements
  @settlements
end

Class Method Details

.from_element(root) ⇒ Object



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
221
# File 'lib/cyber_source_merged_spec/models/reporting_v3_purchase_refund_details_get200_response.rb', line 192

def self.from_element(root)
  offset = XmlUtilities.from_element(root, 'offset', Integer)
  limit = XmlUtilities.from_element(root, 'limit', Integer)
  page_results = XmlUtilities.from_element(root, 'pageResults', Integer)
  request_details = XmlUtilities.from_element_to_array(root,
                                                       'RequestDetail',
                                                       RequestDetail)
  settlements = XmlUtilities.from_element_to_array(root, 'Settlement',
                                                   Settlement)
  authorizations = XmlUtilities.from_element_to_array(root, 'Authorization',
                                                      Authorization)
  fee_and_funding_details = XmlUtilities.from_element_to_array(
    root, 'FeeAndFundingDetail', FeeAndFundingDetail
  )
  others = XmlUtilities.from_element_to_array(root, 'Other', Other)
  settlement_statuses = XmlUtilities.from_element_to_array(
    root, 'SettlementStatus', SettlementStatus
  )

  new(offset: offset,
      limit: limit,
      page_results: page_results,
      request_details: request_details,
      settlements: settlements,
      authorizations: authorizations,
      fee_and_funding_details: fee_and_funding_details,
      others: others,
      settlement_statuses: settlement_statuses,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



104
105
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
# File 'lib/cyber_source_merged_spec/models/reporting_v3_purchase_refund_details_get200_response.rb', line 104

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  offset = hash.key?('offset') ? hash['offset'] : SKIP
  limit = hash.key?('limit') ? hash['limit'] : SKIP
  page_results = hash.key?('pageResults') ? hash['pageResults'] : SKIP
  # Parameter is an array, so we need to iterate through it
  request_details = nil
  unless hash['requestDetails'].nil?
    request_details = []
    hash['requestDetails'].each do |structure|
      request_details << (RequestDetail.from_hash(structure) if structure)
    end
  end

  request_details = SKIP unless hash.key?('requestDetails')
  # Parameter is an array, so we need to iterate through it
  settlements = nil
  unless hash['settlements'].nil?
    settlements = []
    hash['settlements'].each do |structure|
      settlements << (Settlement.from_hash(structure) if structure)
    end
  end

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

  authorizations = SKIP unless hash.key?('authorizations')
  # Parameter is an array, so we need to iterate through it
  fee_and_funding_details = nil
  unless hash['feeAndFundingDetails'].nil?
    fee_and_funding_details = []
    hash['feeAndFundingDetails'].each do |structure|
      fee_and_funding_details << (FeeAndFundingDetail.from_hash(structure) if structure)
    end
  end

  fee_and_funding_details = SKIP unless hash.key?('feeAndFundingDetails')
  # Parameter is an array, so we need to iterate through it
  others = nil
  unless hash['others'].nil?
    others = []
    hash['others'].each do |structure|
      others << (Other.from_hash(structure) if structure)
    end
  end

  others = SKIP unless hash.key?('others')
  # Parameter is an array, so we need to iterate through it
  settlement_statuses = nil
  unless hash['settlementStatuses'].nil?
    settlement_statuses = []
    hash['settlementStatuses'].each do |structure|
      settlement_statuses << (SettlementStatus.from_hash(structure) if structure)
    end
  end

  settlement_statuses = SKIP unless hash.key?('settlementStatuses')

  # 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.
  ReportingV3PurchaseRefundDetailsGet200Response.new(offset: offset,
                                                     limit: limit,
                                                     page_results: page_results,
                                                     request_details: request_details,
                                                     settlements: settlements,
                                                     authorizations: authorizations,
                                                     fee_and_funding_details: fee_and_funding_details,
                                                     others: others,
                                                     settlement_statuses: settlement_statuses,
                                                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/cyber_source_merged_spec/models/reporting_v3_purchase_refund_details_get200_response.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['offset'] = 'offset'
  @_hash['limit'] = 'limit'
  @_hash['page_results'] = 'pageResults'
  @_hash['request_details'] = 'requestDetails'
  @_hash['settlements'] = 'settlements'
  @_hash['authorizations'] = 'authorizations'
  @_hash['fee_and_funding_details'] = 'feeAndFundingDetails'
  @_hash['others'] = 'others'
  @_hash['settlement_statuses'] = 'settlementStatuses'
  @_hash
end

.nullablesObject

An array for nullable fields



79
80
81
# File 'lib/cyber_source_merged_spec/models/reporting_v3_purchase_refund_details_get200_response.rb', line 79

def self.nullables
  []
end

.optionalsObject

An array for optional fields



64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/cyber_source_merged_spec/models/reporting_v3_purchase_refund_details_get200_response.rb', line 64

def self.optionals
  %w[
    offset
    limit
    page_results
    request_details
    settlements
    authorizations
    fee_and_funding_details
    others
    settlement_statuses
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



256
257
258
259
260
261
262
263
264
# File 'lib/cyber_source_merged_spec/models/reporting_v3_purchase_refund_details_get200_response.rb', line 256

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} offset: #{@offset.inspect}, limit: #{@limit.inspect}, page_results:"\
  " #{@page_results.inspect}, request_details: #{@request_details.inspect}, settlements:"\
  " #{@settlements.inspect}, authorizations: #{@authorizations.inspect},"\
  " fee_and_funding_details: #{@fee_and_funding_details.inspect}, others: #{@others.inspect},"\
  " settlement_statuses: #{@settlement_statuses.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



246
247
248
249
250
251
252
253
# File 'lib/cyber_source_merged_spec/models/reporting_v3_purchase_refund_details_get200_response.rb', line 246

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} offset: #{@offset}, limit: #{@limit}, page_results: #{@page_results},"\
  " request_details: #{@request_details}, settlements: #{@settlements}, authorizations:"\
  " #{@authorizations}, fee_and_funding_details: #{@fee_and_funding_details}, others:"\
  " #{@others}, settlement_statuses: #{@settlement_statuses}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



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

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

  XmlUtilities.add_as_subelement(doc, root, 'offset', offset)
  XmlUtilities.add_as_subelement(doc, root, 'limit', limit)
  XmlUtilities.add_as_subelement(doc, root, 'pageResults', page_results)
  XmlUtilities.add_array_as_subelement(doc, root, 'RequestDetail',
                                       request_details)
  XmlUtilities.add_array_as_subelement(doc, root, 'Settlement', settlements)
  XmlUtilities.add_array_as_subelement(doc, root, 'Authorization',
                                       authorizations)
  XmlUtilities.add_array_as_subelement(doc, root, 'FeeAndFundingDetail',
                                       fee_and_funding_details)
  XmlUtilities.add_array_as_subelement(doc, root, 'Other', others)
  XmlUtilities.add_array_as_subelement(doc, root, 'SettlementStatus',
                                       settlement_statuses)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end