Class: CyberSourceMergedSpec::ReportingV3ChargebackDetailsGet200Response

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

Overview

ReportingV3ChargebackDetailsGet200Response 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(organization_id: SKIP, start_time: SKIP, end_time: SKIP, chargeback_details: SKIP, additional_properties: nil) ⇒ ReportingV3ChargebackDetailsGet200Response

Returns a new instance of ReportingV3ChargebackDetailsGet200Response.



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

def initialize(organization_id: SKIP, start_time: SKIP, end_time: SKIP,
               chargeback_details: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @organization_id = organization_id unless organization_id == SKIP
  @start_time = start_time unless start_time == SKIP
  @end_time = end_time unless end_time == SKIP
  @chargeback_details = chargeback_details unless chargeback_details == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#chargeback_detailsArray[ChargebackDetail]

List of Chargeback Details list.

Returns:



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

def chargeback_details
  @chargeback_details
end

#end_timeDateTime

Report Start Date (ISO 8601 Extended)

Returns:

  • (DateTime)


23
24
25
# File 'lib/cyber_source_merged_spec/models/reporting_v3_chargeback_details_get200_response.rb', line 23

def end_time
  @end_time
end

#organization_idString

Organization Id

Returns:

  • (String)


15
16
17
# File 'lib/cyber_source_merged_spec/models/reporting_v3_chargeback_details_get200_response.rb', line 15

def organization_id
  @organization_id
end

#start_timeDateTime

Report Start Date (ISO 8601 Extended)

Returns:

  • (DateTime)


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

def start_time
  @start_time
end

Class Method Details

.from_element(root) ⇒ Object



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/cyber_source_merged_spec/models/reporting_v3_chargeback_details_get200_response.rb', line 117

def self.from_element(root)
  organization_id = XmlUtilities.from_attribute(root, 'MerchantId', String)
  start_time = XmlUtilities.from_attribute(root, 'ReportStartDate', String,
                                           datetime_format: 'rfc3339')
  end_time = XmlUtilities.from_attribute(root, 'ReportEndDate', String,
                                         datetime_format: 'rfc3339')
  chargeback_details = XmlUtilities.from_element_to_array(root, 'Request',
                                                          ChargebackDetail)

  new(organization_id: organization_id,
      start_time: start_time,
      end_time: end_time,
      chargeback_details: chargeback_details,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/cyber_source_merged_spec/models/reporting_v3_chargeback_details_get200_response.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  organization_id =
    hash.key?('organizationId') ? hash['organizationId'] : SKIP
  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
  chargeback_details = nil
  unless hash['chargebackDetails'].nil?
    chargeback_details = []
    hash['chargebackDetails'].each do |structure|
      chargeback_details << (ChargebackDetail.from_hash(structure) if structure)
    end
  end

  chargeback_details = SKIP unless hash.key?('chargebackDetails')

  # 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.
  ReportingV3ChargebackDetailsGet200Response.new(organization_id: organization_id,
                                                 start_time: start_time,
                                                 end_time: end_time,
                                                 chargeback_details: chargeback_details,
                                                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/cyber_source_merged_spec/models/reporting_v3_chargeback_details_get200_response.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['organization_id'] = 'organizationId'
  @_hash['start_time'] = 'startTime'
  @_hash['end_time'] = 'endTime'
  @_hash['chargeback_details'] = 'chargebackDetails'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/cyber_source_merged_spec/models/reporting_v3_chargeback_details_get200_response.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
47
# File 'lib/cyber_source_merged_spec/models/reporting_v3_chargeback_details_get200_response.rb', line 40

def self.optionals
  %w[
    organization_id
    start_time
    end_time
    chargeback_details
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



158
159
160
161
162
163
# File 'lib/cyber_source_merged_spec/models/reporting_v3_chargeback_details_get200_response.rb', line 158

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} organization_id: #{@organization_id.inspect}, start_time:"\
  " #{@start_time.inspect}, end_time: #{@end_time.inspect}, chargeback_details:"\
  " #{@chargeback_details.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_end_timeObject



113
114
115
# File 'lib/cyber_source_merged_spec/models/reporting_v3_chargeback_details_get200_response.rb', line 113

def to_custom_end_time
  DateTimeHelper.to_rfc3339(end_time)
end

#to_custom_start_timeObject



109
110
111
# File 'lib/cyber_source_merged_spec/models/reporting_v3_chargeback_details_get200_response.rb', line 109

def to_custom_start_time
  DateTimeHelper.to_rfc3339(start_time)
end

#to_sObject

Provides a human-readable string representation of the object.



150
151
152
153
154
155
# File 'lib/cyber_source_merged_spec/models/reporting_v3_chargeback_details_get200_response.rb', line 150

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} organization_id: #{@organization_id}, start_time: #{@start_time}, end_time:"\
  " #{@end_time}, chargeback_details: #{@chargeback_details}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/cyber_source_merged_spec/models/reporting_v3_chargeback_details_get200_response.rb', line 133

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

  XmlUtilities.add_as_attribute(root, 'MerchantId', organization_id)
  XmlUtilities.add_as_attribute(root, 'ReportStartDate', start_time,
                                datetime_format: 'rfc3339')
  XmlUtilities.add_as_attribute(root, 'ReportEndDate', end_time,
                                datetime_format: 'rfc3339')
  XmlUtilities.add_array_as_subelement(doc, root, 'Request',
                                       chargeback_details)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end