Class: CyberSourceMergedSpec::PaymentBatchSummary

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

Overview

PaymentBatchSummary 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(currency_code: SKIP, payment_sub_type_description: SKIP, start_time: SKIP, end_time: SKIP, sales_count: SKIP, sales_amount: SKIP, credit_count: SKIP, credit_amount: SKIP, account_name: SKIP, account_id: SKIP, merchant_id: SKIP, merchant_name: SKIP, additional_properties: nil) ⇒ PaymentBatchSummary

Returns a new instance of PaymentBatchSummary.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/cyber_source_merged_spec/models/payment_batch_summary.rb', line 102

def initialize(currency_code: SKIP, payment_sub_type_description: SKIP,
               start_time: SKIP, end_time: SKIP, sales_count: SKIP,
               sales_amount: SKIP, credit_count: SKIP, credit_amount: SKIP,
               account_name: SKIP, account_id: SKIP, merchant_id: SKIP,
               merchant_name: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @currency_code = currency_code unless currency_code == SKIP
  unless payment_sub_type_description == SKIP
    @payment_sub_type_description =
      payment_sub_type_description
  end
  @start_time = start_time unless start_time == SKIP
  @end_time = end_time unless end_time == SKIP
  @sales_count = sales_count unless sales_count == SKIP
  @sales_amount = sales_amount unless sales_amount == SKIP
  @credit_count = credit_count unless credit_count == SKIP
  @credit_amount = credit_amount unless credit_amount == SKIP
  @account_name =  unless  == SKIP
  @account_id =  unless  == SKIP
  @merchant_id = merchant_id unless merchant_id == SKIP
  @merchant_name = merchant_name unless merchant_name == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def 
  @account_id
end

#account_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def 
  @account_name
end

#credit_amountString

TODO: Write general description for this method

Returns:

  • (String)


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

def credit_amount
  @credit_amount
end

#credit_countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def credit_count
  @credit_count
end

#currency_codeString

TODO: Write general description for this method

Returns:

  • (String)


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

def currency_code
  @currency_code
end

#end_timeDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def end_time
  @end_time
end

#merchant_idString

TODO: Write general description for this method

Returns:

  • (String)


55
56
57
# File 'lib/cyber_source_merged_spec/models/payment_batch_summary.rb', line 55

def merchant_id
  @merchant_id
end

#merchant_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def merchant_name
  @merchant_name
end

#payment_sub_type_descriptionString

TODO: Write general description for this method

Returns:

  • (String)


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

def payment_sub_type_description
  @payment_sub_type_description
end

#sales_amountString

TODO: Write general description for this method

Returns:

  • (String)


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

def sales_amount
  @sales_amount
end

#sales_countInteger

TODO: Write general description for this method

Returns:

  • (Integer)


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

def sales_count
  @sales_count
end

#start_timeDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def start_time
  @start_time
end

Class Method Details

.from_element(root) ⇒ Object



186
187
188
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
# File 'lib/cyber_source_merged_spec/models/payment_batch_summary.rb', line 186

def self.from_element(root)
  currency_code = XmlUtilities.from_element(root, 'currencyCode', String)
  payment_sub_type_description = XmlUtilities.from_element(
    root, 'paymentSubTypeDescription', String
  )
  start_time = XmlUtilities.from_element(root, 'startTime', String,
                                         datetime_format: 'rfc3339')
  end_time = XmlUtilities.from_element(root, 'endTime', String,
                                       datetime_format: 'rfc3339')
  sales_count = XmlUtilities.from_element(root, 'salesCount', Integer)
  sales_amount = XmlUtilities.from_element(root, 'salesAmount', String)
  credit_count = XmlUtilities.from_element(root, 'creditCount', Integer)
  credit_amount = XmlUtilities.from_element(root, 'creditAmount', String)
   = XmlUtilities.from_element(root, 'accountName', String)
   = XmlUtilities.from_element(root, 'accountId', String)
  merchant_id = XmlUtilities.from_element(root, 'merchantId', String)
  merchant_name = XmlUtilities.from_element(root, 'merchantName', String)

  new(currency_code: currency_code,
      payment_sub_type_description: payment_sub_type_description,
      start_time: start_time,
      end_time: end_time,
      sales_count: sales_count,
      sales_amount: sales_amount,
      credit_count: credit_count,
      credit_amount: credit_amount,
      account_name: ,
      account_id: ,
      merchant_id: merchant_id,
      merchant_name: merchant_name,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/cyber_source_merged_spec/models/payment_batch_summary.rb', line 129

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  currency_code = hash.key?('currencyCode') ? hash['currencyCode'] : SKIP
  payment_sub_type_description =
    hash.key?('paymentSubTypeDescription') ? hash['paymentSubTypeDescription'] : 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
  sales_count = hash.key?('salesCount') ? hash['salesCount'] : SKIP
  sales_amount = hash.key?('salesAmount') ? hash['salesAmount'] : SKIP
  credit_count = hash.key?('creditCount') ? hash['creditCount'] : SKIP
  credit_amount = hash.key?('creditAmount') ? hash['creditAmount'] : SKIP
   = hash.key?('accountName') ? hash['accountName'] : SKIP
   = hash.key?('accountId') ? hash['accountId'] : SKIP
  merchant_id = hash.key?('merchantId') ? hash['merchantId'] : SKIP
  merchant_name = hash.key?('merchantName') ? hash['merchantName'] : 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.
  PaymentBatchSummary.new(currency_code: currency_code,
                          payment_sub_type_description: payment_sub_type_description,
                          start_time: start_time,
                          end_time: end_time,
                          sales_count: sales_count,
                          sales_amount: sales_amount,
                          credit_count: credit_count,
                          credit_amount: credit_amount,
                          account_name: ,
                          account_id: ,
                          merchant_id: merchant_id,
                          merchant_name: merchant_name,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['currency_code'] = 'currencyCode'
  @_hash['payment_sub_type_description'] = 'paymentSubTypeDescription'
  @_hash['start_time'] = 'startTime'
  @_hash['end_time'] = 'endTime'
  @_hash['sales_count'] = 'salesCount'
  @_hash['sales_amount'] = 'salesAmount'
  @_hash['credit_count'] = 'creditCount'
  @_hash['credit_amount'] = 'creditAmount'
  @_hash['account_name'] = 'accountName'
  @_hash['account_id'] = 'accountId'
  @_hash['merchant_id'] = 'merchantId'
  @_hash['merchant_name'] = 'merchantName'
  @_hash
end

.nullablesObject

An array for nullable fields



98
99
100
# File 'lib/cyber_source_merged_spec/models/payment_batch_summary.rb', line 98

def self.nullables
  []
end

.optionalsObject

An array for optional fields



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/cyber_source_merged_spec/models/payment_batch_summary.rb', line 80

def self.optionals
  %w[
    currency_code
    payment_sub_type_description
    start_time
    end_time
    sales_count
    sales_amount
    credit_count
    credit_amount
    account_name
    account_id
    merchant_id
    merchant_name
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} currency_code: #{@currency_code.inspect}, payment_sub_type_description:"\
  " #{@payment_sub_type_description.inspect}, start_time: #{@start_time.inspect}, end_time:"\
  " #{@end_time.inspect}, sales_count: #{@sales_count.inspect}, sales_amount:"\
  " #{@sales_amount.inspect}, credit_count: #{@credit_count.inspect}, credit_amount:"\
  " #{@credit_amount.inspect}, account_name: #{@account_name.inspect}, account_id:"\
  " #{@account_id.inspect}, merchant_id: #{@merchant_id.inspect}, merchant_name:"\
  " #{@merchant_name.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_end_timeObject



182
183
184
# File 'lib/cyber_source_merged_spec/models/payment_batch_summary.rb', line 182

def to_custom_end_time
  DateTimeHelper.to_rfc3339(end_time)
end

#to_custom_start_timeObject



178
179
180
# File 'lib/cyber_source_merged_spec/models/payment_batch_summary.rb', line 178

def to_custom_start_time
  DateTimeHelper.to_rfc3339(start_time)
end

#to_sObject

Provides a human-readable string representation of the object.



244
245
246
247
248
249
250
251
252
# File 'lib/cyber_source_merged_spec/models/payment_batch_summary.rb', line 244

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} currency_code: #{@currency_code}, payment_sub_type_description:"\
  " #{@payment_sub_type_description}, start_time: #{@start_time}, end_time: #{@end_time},"\
  " sales_count: #{@sales_count}, sales_amount: #{@sales_amount}, credit_count:"\
  " #{@credit_count}, credit_amount: #{@credit_amount}, account_name: #{@account_name},"\
  " account_id: #{@account_id}, merchant_id: #{@merchant_id}, merchant_name:"\
  " #{@merchant_name}, additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/cyber_source_merged_spec/models/payment_batch_summary.rb', line 219

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

  XmlUtilities.add_as_subelement(doc, root, 'currencyCode', currency_code)
  XmlUtilities.add_as_subelement(doc, root, 'paymentSubTypeDescription',
                                 payment_sub_type_description)
  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_as_subelement(doc, root, 'salesCount', sales_count)
  XmlUtilities.add_as_subelement(doc, root, 'salesAmount', sales_amount)
  XmlUtilities.add_as_subelement(doc, root, 'creditCount', credit_count)
  XmlUtilities.add_as_subelement(doc, root, 'creditAmount', credit_amount)
  XmlUtilities.add_as_subelement(doc, root, 'accountName', )
  XmlUtilities.add_as_subelement(doc, root, 'accountId', )
  XmlUtilities.add_as_subelement(doc, root, 'merchantId', merchant_id)
  XmlUtilities.add_as_subelement(doc, root, 'merchantName', merchant_name)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end