Class: CyberSourceMergedSpec::ReportingV3PaymentBatchSummariesGet200Response

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

Overview

ReportingV3PaymentBatchSummariesGet200Response 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, payment_batch_summaries: SKIP, additional_properties: nil) ⇒ ReportingV3PaymentBatchSummariesGet200Response

Returns a new instance of ReportingV3PaymentBatchSummariesGet200Response.



48
49
50
51
52
53
54
55
56
57
# File 'lib/cyber_source_merged_spec/models/reporting_v3_payment_batch_summaries_get200_response.rb', line 48

def initialize(start_time: SKIP, end_time: SKIP,
               payment_batch_summaries: 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
  @payment_batch_summaries = payment_batch_summaries unless payment_batch_summaries == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#end_timeDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def end_time
  @end_time
end

#payment_batch_summariesArray[PaymentBatchSummary]

TODO: Write general description for this method

Returns:



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

def payment_batch_summaries
  @payment_batch_summaries
end

#start_timeDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def start_time
  @start_time
end

Class Method Details

.from_element(root) ⇒ Object



107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/cyber_source_merged_spec/models/reporting_v3_payment_batch_summaries_get200_response.rb', line 107

def self.from_element(root)
  start_time = XmlUtilities.from_element(root, 'startTime', String,
                                         datetime_format: 'rfc3339')
  end_time = XmlUtilities.from_element(root, 'endTime', String,
                                       datetime_format: 'rfc3339')
  payment_batch_summaries = XmlUtilities.from_element_to_array(
    root, 'PaymentBatchSummary', PaymentBatchSummary
  )

  new(start_time: start_time,
      end_time: end_time,
      payment_batch_summaries: payment_batch_summaries,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



60
61
62
63
64
65
66
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
# File 'lib/cyber_source_merged_spec/models/reporting_v3_payment_batch_summaries_get200_response.rb', line 60

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
  payment_batch_summaries = nil
  unless hash['paymentBatchSummaries'].nil?
    payment_batch_summaries = []
    hash['paymentBatchSummaries'].each do |structure|
      payment_batch_summaries << (PaymentBatchSummary.from_hash(structure) if structure)
    end
  end

  payment_batch_summaries = SKIP unless hash.key?('paymentBatchSummaries')

  # 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.
  ReportingV3PaymentBatchSummariesGet200Response.new(start_time: start_time,
                                                     end_time: end_time,
                                                     payment_batch_summaries: payment_batch_summaries,
                                                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
# File 'lib/cyber_source_merged_spec/models/reporting_v3_payment_batch_summaries_get200_response.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['start_time'] = 'startTime'
  @_hash['end_time'] = 'endTime'
  @_hash['payment_batch_summaries'] = 'paymentBatchSummaries'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



35
36
37
38
39
40
41
# File 'lib/cyber_source_merged_spec/models/reporting_v3_payment_batch_summaries_get200_response.rb', line 35

def self.optionals
  %w[
    start_time
    end_time
    payment_batch_summaries
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



146
147
148
149
150
151
# File 'lib/cyber_source_merged_spec/models/reporting_v3_payment_batch_summaries_get200_response.rb', line 146

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

#to_custom_end_timeObject



103
104
105
# File 'lib/cyber_source_merged_spec/models/reporting_v3_payment_batch_summaries_get200_response.rb', line 103

def to_custom_end_time
  DateTimeHelper.to_rfc3339(end_time)
end

#to_custom_start_timeObject



99
100
101
# File 'lib/cyber_source_merged_spec/models/reporting_v3_payment_batch_summaries_get200_response.rb', line 99

def to_custom_start_time
  DateTimeHelper.to_rfc3339(start_time)
end

#to_sObject

Provides a human-readable string representation of the object.



138
139
140
141
142
143
# File 'lib/cyber_source_merged_spec/models/reporting_v3_payment_batch_summaries_get200_response.rb', line 138

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

#to_xml_element(doc, root_name) ⇒ Object



122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/cyber_source_merged_spec/models/reporting_v3_payment_batch_summaries_get200_response.rb', line 122

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

  XmlUtilities.add_as_subelement(doc, root, 'startTime', start_time,
                                 datetime_format: 'rfc3339')
  XmlUtilities.add_as_subelement(doc, root, 'endTime', end_time,
                                 datetime_format: 'rfc3339')
  XmlUtilities.add_array_as_subelement(doc, root, 'PaymentBatchSummary',
                                       payment_batch_summaries)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end