biz_api 3.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +155 -0
  4. data/Rakefile +10 -0
  5. data/biz_api.gemspec +39 -0
  6. data/docs/AppInfo.md +22 -0
  7. data/docs/AuthRequest.md +26 -0
  8. data/docs/BizEvent.md +50 -0
  9. data/docs/BizEventsHelpdeskApi.md +157 -0
  10. data/docs/CartItem.md +28 -0
  11. data/docs/Creditor.md +26 -0
  12. data/docs/CtReceiptModelResponse.md +72 -0
  13. data/docs/Debtor.md +36 -0
  14. data/docs/DebtorPosition.md +24 -0
  15. data/docs/Details.md +22 -0
  16. data/docs/HomeApi.md +81 -0
  17. data/docs/IOTransactionsRESTAPIsApi.md +328 -0
  18. data/docs/Info.md +34 -0
  19. data/docs/InfoNotice.md +38 -0
  20. data/docs/InfoTransaction.md +26 -0
  21. data/docs/InfoTransactionView.md +38 -0
  22. data/docs/MBD.md +26 -0
  23. data/docs/MapEntry.md +20 -0
  24. data/docs/NoticeDetailResponse.md +20 -0
  25. data/docs/NoticeListItem.md +32 -0
  26. data/docs/NoticeListWrapResponse.md +18 -0
  27. data/docs/PageInfo.md +24 -0
  28. data/docs/PaidNoticeRESTAPIsApi.md +322 -0
  29. data/docs/Payer.md +36 -0
  30. data/docs/PaymentAuthorizationRequest.md +28 -0
  31. data/docs/PaymentInfo.md +50 -0
  32. data/docs/PaymentReceiptsRESTAPIsApi.md +161 -0
  33. data/docs/ProblemJson.md +22 -0
  34. data/docs/Psp.md +30 -0
  35. data/docs/Transaction.md +44 -0
  36. data/docs/TransactionDetailResponse.md +20 -0
  37. data/docs/TransactionDetails.md +28 -0
  38. data/docs/TransactionListItem.md +32 -0
  39. data/docs/TransactionListWrapResponse.md +20 -0
  40. data/docs/TransactionPsp.md +22 -0
  41. data/docs/Transfer.md +34 -0
  42. data/docs/TransferPA.md +32 -0
  43. data/docs/User.md +30 -0
  44. data/docs/UserDetail.md +20 -0
  45. data/docs/WalletInfo.md +24 -0
  46. data/docs/WalletItem.md +34 -0
  47. data/git_push.sh +57 -0
  48. data/lib/biz_api/api/biz_events_helpdesk_api.rb +156 -0
  49. data/lib/biz_api/api/home_api.rb +82 -0
  50. data/lib/biz_api/api/io_transactions_restapis_api.rb +334 -0
  51. data/lib/biz_api/api/paid_notice_restapis_api.rb +328 -0
  52. data/lib/biz_api/api/payment_receipts_restapis_api.rb +168 -0
  53. data/lib/biz_api/api_client.rb +394 -0
  54. data/lib/biz_api/api_error.rb +58 -0
  55. data/lib/biz_api/configuration.rb +333 -0
  56. data/lib/biz_api/models/app_info.rb +232 -0
  57. data/lib/biz_api/models/auth_request.rb +250 -0
  58. data/lib/biz_api/models/biz_event.rb +396 -0
  59. data/lib/biz_api/models/cart_item.rb +287 -0
  60. data/lib/biz_api/models/creditor.rb +250 -0
  61. data/lib/biz_api/models/ct_receipt_model_response.rb +552 -0
  62. data/lib/biz_api/models/debtor.rb +295 -0
  63. data/lib/biz_api/models/debtor_position.rb +241 -0
  64. data/lib/biz_api/models/details.rb +232 -0
  65. data/lib/biz_api/models/info.rb +286 -0
  66. data/lib/biz_api/models/info_notice.rb +392 -0
  67. data/lib/biz_api/models/info_transaction.rb +250 -0
  68. data/lib/biz_api/models/info_transaction_view.rb +350 -0
  69. data/lib/biz_api/models/map_entry.rb +223 -0
  70. data/lib/biz_api/models/mbd.rb +250 -0
  71. data/lib/biz_api/models/notice_detail_response.rb +225 -0
  72. data/lib/biz_api/models/notice_list_item.rb +326 -0
  73. data/lib/biz_api/models/notice_list_wrap_response.rb +223 -0
  74. data/lib/biz_api/models/page_info.rb +273 -0
  75. data/lib/biz_api/models/payer.rb +295 -0
  76. data/lib/biz_api/models/payment_authorization_request.rb +259 -0
  77. data/lib/biz_api/models/payment_info.rb +360 -0
  78. data/lib/biz_api/models/problem_json.rb +259 -0
  79. data/lib/biz_api/models/psp.rb +268 -0
  80. data/lib/biz_api/models/transaction.rb +331 -0
  81. data/lib/biz_api/models/transaction_detail_response.rb +225 -0
  82. data/lib/biz_api/models/transaction_details.rb +259 -0
  83. data/lib/biz_api/models/transaction_list_item.rb +277 -0
  84. data/lib/biz_api/models/transaction_list_wrap_response.rb +225 -0
  85. data/lib/biz_api/models/transaction_psp.rb +232 -0
  86. data/lib/biz_api/models/transfer.rb +288 -0
  87. data/lib/biz_api/models/transfer_pa.rb +345 -0
  88. data/lib/biz_api/models/user.rb +302 -0
  89. data/lib/biz_api/models/user_detail.rb +230 -0
  90. data/lib/biz_api/models/wallet_info.rb +241 -0
  91. data/lib/biz_api/models/wallet_item.rb +322 -0
  92. data/lib/biz_api/version.rb +15 -0
  93. data/lib/biz_api.rb +80 -0
  94. data/spec/api/biz_events_helpdesk_api_spec.rb +60 -0
  95. data/spec/api/home_api_spec.rb +47 -0
  96. data/spec/api/io_transactions_restapis_api_spec.rb +96 -0
  97. data/spec/api/paid_notice_restapis_api_spec.rb +93 -0
  98. data/spec/api/payment_receipts_restapis_api_spec.rb +62 -0
  99. data/spec/models/app_info_spec.rb +48 -0
  100. data/spec/models/auth_request_spec.rb +60 -0
  101. data/spec/models/biz_event_spec.rb +136 -0
  102. data/spec/models/cart_item_spec.rb +66 -0
  103. data/spec/models/creditor_spec.rb +60 -0
  104. data/spec/models/ct_receipt_model_response_spec.rb +198 -0
  105. data/spec/models/debtor_position_spec.rb +54 -0
  106. data/spec/models/debtor_spec.rb +90 -0
  107. data/spec/models/details_spec.rb +48 -0
  108. data/spec/models/info_notice_spec.rb +104 -0
  109. data/spec/models/info_spec.rb +84 -0
  110. data/spec/models/info_transaction_spec.rb +60 -0
  111. data/spec/models/info_transaction_view_spec.rb +104 -0
  112. data/spec/models/map_entry_spec.rb +42 -0
  113. data/spec/models/mbd_spec.rb +60 -0
  114. data/spec/models/notice_detail_response_spec.rb +42 -0
  115. data/spec/models/notice_list_item_spec.rb +78 -0
  116. data/spec/models/notice_list_wrap_response_spec.rb +36 -0
  117. data/spec/models/page_info_spec.rb +54 -0
  118. data/spec/models/payer_spec.rb +90 -0
  119. data/spec/models/payment_authorization_request_spec.rb +66 -0
  120. data/spec/models/payment_info_spec.rb +132 -0
  121. data/spec/models/problem_json_spec.rb +48 -0
  122. data/spec/models/psp_spec.rb +72 -0
  123. data/spec/models/transaction_detail_response_spec.rb +42 -0
  124. data/spec/models/transaction_details_spec.rb +66 -0
  125. data/spec/models/transaction_list_item_spec.rb +78 -0
  126. data/spec/models/transaction_list_wrap_response_spec.rb +42 -0
  127. data/spec/models/transaction_psp_spec.rb +48 -0
  128. data/spec/models/transaction_spec.rb +114 -0
  129. data/spec/models/transfer_pa_spec.rb +78 -0
  130. data/spec/models/transfer_spec.rb +84 -0
  131. data/spec/models/user_detail_spec.rb +42 -0
  132. data/spec/models/user_spec.rb +76 -0
  133. data/spec/models/wallet_info_spec.rb +54 -0
  134. data/spec/models/wallet_item_spec.rb +88 -0
  135. data/spec/spec_helper.rb +111 -0
  136. metadata +259 -0
@@ -0,0 +1,350 @@
1
+ =begin
2
+ #Biz-Events Service
3
+
4
+ #Microservice for exposing REST APIs about payment receipts.
5
+
6
+ The version of the OpenAPI document: 0.1.72
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module BizReceipts
17
+ class InfoTransactionView
18
+ attr_accessor :transaction_id
19
+
20
+ attr_accessor :auth_code
21
+
22
+ attr_accessor :rrn
23
+
24
+ attr_accessor :transaction_date
25
+
26
+ attr_accessor :psp_name
27
+
28
+ attr_accessor :wallet_info
29
+
30
+ attr_accessor :payment_method
31
+
32
+ attr_accessor :payer
33
+
34
+ attr_accessor :amount
35
+
36
+ attr_accessor :fee
37
+
38
+ attr_accessor :origin
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'transaction_id' => :'transactionId',
66
+ :'auth_code' => :'authCode',
67
+ :'rrn' => :'rrn',
68
+ :'transaction_date' => :'transactionDate',
69
+ :'psp_name' => :'pspName',
70
+ :'wallet_info' => :'walletInfo',
71
+ :'payment_method' => :'paymentMethod',
72
+ :'payer' => :'payer',
73
+ :'amount' => :'amount',
74
+ :'fee' => :'fee',
75
+ :'origin' => :'origin'
76
+ }
77
+ end
78
+
79
+ # Returns all the JSON keys this model knows about
80
+ def self.acceptable_attributes
81
+ attribute_map.values
82
+ end
83
+
84
+ # Attribute type mapping.
85
+ def self.openapi_types
86
+ {
87
+ :'transaction_id' => :'String',
88
+ :'auth_code' => :'String',
89
+ :'rrn' => :'String',
90
+ :'transaction_date' => :'String',
91
+ :'psp_name' => :'String',
92
+ :'wallet_info' => :'WalletInfo',
93
+ :'payment_method' => :'String',
94
+ :'payer' => :'UserDetail',
95
+ :'amount' => :'String',
96
+ :'fee' => :'String',
97
+ :'origin' => :'String'
98
+ }
99
+ end
100
+
101
+ # List of attributes with nullable: true
102
+ def self.openapi_nullable
103
+ Set.new([
104
+ ])
105
+ end
106
+
107
+ # Initializes the object
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ def initialize(attributes = {})
110
+ if (!attributes.is_a?(Hash))
111
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BizReceipts::InfoTransactionView` initialize method"
112
+ end
113
+
114
+ # check to see if the attribute exists and convert string to symbol for hash key
115
+ attributes = attributes.each_with_object({}) { |(k, v), h|
116
+ if (!self.class.attribute_map.key?(k.to_sym))
117
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BizReceipts::InfoTransactionView`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
118
+ end
119
+ h[k.to_sym] = v
120
+ }
121
+
122
+ if attributes.key?(:'transaction_id')
123
+ self.transaction_id = attributes[:'transaction_id']
124
+ end
125
+
126
+ if attributes.key?(:'auth_code')
127
+ self.auth_code = attributes[:'auth_code']
128
+ end
129
+
130
+ if attributes.key?(:'rrn')
131
+ self.rrn = attributes[:'rrn']
132
+ end
133
+
134
+ if attributes.key?(:'transaction_date')
135
+ self.transaction_date = attributes[:'transaction_date']
136
+ end
137
+
138
+ if attributes.key?(:'psp_name')
139
+ self.psp_name = attributes[:'psp_name']
140
+ end
141
+
142
+ if attributes.key?(:'wallet_info')
143
+ self.wallet_info = attributes[:'wallet_info']
144
+ end
145
+
146
+ if attributes.key?(:'payment_method')
147
+ self.payment_method = attributes[:'payment_method']
148
+ end
149
+
150
+ if attributes.key?(:'payer')
151
+ self.payer = attributes[:'payer']
152
+ end
153
+
154
+ if attributes.key?(:'amount')
155
+ self.amount = attributes[:'amount']
156
+ end
157
+
158
+ if attributes.key?(:'fee')
159
+ self.fee = attributes[:'fee']
160
+ end
161
+
162
+ if attributes.key?(:'origin')
163
+ self.origin = attributes[:'origin']
164
+ end
165
+ end
166
+
167
+ # Show invalid properties with the reasons. Usually used together with valid?
168
+ # @return Array for valid properties with the reasons
169
+ def list_invalid_properties
170
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
171
+ invalid_properties = Array.new
172
+ invalid_properties
173
+ end
174
+
175
+ # Check to see if the all the properties in the model are valid
176
+ # @return true if the model is valid
177
+ def valid?
178
+ warn '[DEPRECATED] the `valid?` method is obsolete'
179
+ payment_method_validator = EnumAttributeValidator.new('String', ["BBT", "BP", "AD", "CP", "PO", "OBEP", "JIF", "MYBK", "PPAL", "UNKNOWN"])
180
+ return false unless payment_method_validator.valid?(@payment_method)
181
+ origin_validator = EnumAttributeValidator.new('String', ["INTERNAL", "PM", "NDP001PROD", "NDP002PROD", "NDP003PROD", "UNKNOWN"])
182
+ return false unless origin_validator.valid?(@origin)
183
+ true
184
+ end
185
+
186
+ # Custom attribute writer method checking allowed values (enum).
187
+ # @param [Object] payment_method Object to be assigned
188
+ def payment_method=(payment_method)
189
+ validator = EnumAttributeValidator.new('String', ["BBT", "BP", "AD", "CP", "PO", "OBEP", "JIF", "MYBK", "PPAL", "UNKNOWN"])
190
+ unless validator.valid?(payment_method)
191
+ fail ArgumentError, "invalid value for \"payment_method\", must be one of #{validator.allowable_values}."
192
+ end
193
+ @payment_method = payment_method
194
+ end
195
+
196
+ # Custom attribute writer method checking allowed values (enum).
197
+ # @param [Object] origin Object to be assigned
198
+ def origin=(origin)
199
+ validator = EnumAttributeValidator.new('String', ["INTERNAL", "PM", "NDP001PROD", "NDP002PROD", "NDP003PROD", "UNKNOWN"])
200
+ unless validator.valid?(origin)
201
+ fail ArgumentError, "invalid value for \"origin\", must be one of #{validator.allowable_values}."
202
+ end
203
+ @origin = origin
204
+ end
205
+
206
+ # Checks equality by comparing each attribute.
207
+ # @param [Object] Object to be compared
208
+ def ==(o)
209
+ return true if self.equal?(o)
210
+ self.class == o.class &&
211
+ transaction_id == o.transaction_id &&
212
+ auth_code == o.auth_code &&
213
+ rrn == o.rrn &&
214
+ transaction_date == o.transaction_date &&
215
+ psp_name == o.psp_name &&
216
+ wallet_info == o.wallet_info &&
217
+ payment_method == o.payment_method &&
218
+ payer == o.payer &&
219
+ amount == o.amount &&
220
+ fee == o.fee &&
221
+ origin == o.origin
222
+ end
223
+
224
+ # @see the `==` method
225
+ # @param [Object] Object to be compared
226
+ def eql?(o)
227
+ self == o
228
+ end
229
+
230
+ # Calculates hash code according to all attributes.
231
+ # @return [Integer] Hash code
232
+ def hash
233
+ [transaction_id, auth_code, rrn, transaction_date, psp_name, wallet_info, payment_method, payer, amount, fee, origin].hash
234
+ end
235
+
236
+ # Builds the object from hash
237
+ # @param [Hash] attributes Model attributes in the form of hash
238
+ # @return [Object] Returns the model itself
239
+ def self.build_from_hash(attributes)
240
+ return nil unless attributes.is_a?(Hash)
241
+ attributes = attributes.transform_keys(&:to_sym)
242
+ transformed_hash = {}
243
+ openapi_types.each_pair do |key, type|
244
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
245
+ transformed_hash["#{key}"] = nil
246
+ elsif type =~ /\AArray<(.*)>/i
247
+ # check to ensure the input is an array given that the attribute
248
+ # is documented as an array but the input is not
249
+ if attributes[attribute_map[key]].is_a?(Array)
250
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
251
+ end
252
+ elsif !attributes[attribute_map[key]].nil?
253
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
254
+ end
255
+ end
256
+ new(transformed_hash)
257
+ end
258
+
259
+ # Deserializes the data based on type
260
+ # @param string type Data type
261
+ # @param string value Value to be deserialized
262
+ # @return [Object] Deserialized data
263
+ def self._deserialize(type, value)
264
+ case type.to_sym
265
+ when :Time
266
+ Time.parse(value)
267
+ when :Date
268
+ Date.parse(value)
269
+ when :String
270
+ value.to_s
271
+ when :Integer
272
+ value.to_i
273
+ when :Float
274
+ value.to_f
275
+ when :Boolean
276
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
277
+ true
278
+ else
279
+ false
280
+ end
281
+ when :Object
282
+ # generic object (usually a Hash), return directly
283
+ value
284
+ when /\AArray<(?<inner_type>.+)>\z/
285
+ inner_type = Regexp.last_match[:inner_type]
286
+ value.map { |v| _deserialize(inner_type, v) }
287
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
288
+ k_type = Regexp.last_match[:k_type]
289
+ v_type = Regexp.last_match[:v_type]
290
+ {}.tap do |hash|
291
+ value.each do |k, v|
292
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
293
+ end
294
+ end
295
+ else # model
296
+ # models (e.g. Pet) or oneOf
297
+ klass = BizReceipts.const_get(type)
298
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
299
+ end
300
+ end
301
+
302
+ # Returns the string representation of the object
303
+ # @return [String] String presentation of the object
304
+ def to_s
305
+ to_hash.to_s
306
+ end
307
+
308
+ # to_body is an alias to to_hash (backward compatibility)
309
+ # @return [Hash] Returns the object in the form of hash
310
+ def to_body
311
+ to_hash
312
+ end
313
+
314
+ # Returns the object in the form of hash
315
+ # @return [Hash] Returns the object in the form of hash
316
+ def to_hash
317
+ hash = {}
318
+ self.class.attribute_map.each_pair do |attr, param|
319
+ value = self.send(attr)
320
+ if value.nil?
321
+ is_nullable = self.class.openapi_nullable.include?(attr)
322
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
323
+ end
324
+
325
+ hash[param] = _to_hash(value)
326
+ end
327
+ hash
328
+ end
329
+
330
+ # Outputs non-array value in the form of hash
331
+ # For object, use to_hash. Otherwise, just return the value
332
+ # @param [Object] value Any valid value
333
+ # @return [Hash] Returns the value in the form of hash
334
+ def _to_hash(value)
335
+ if value.is_a?(Array)
336
+ value.compact.map { |v| _to_hash(v) }
337
+ elsif value.is_a?(Hash)
338
+ {}.tap do |hash|
339
+ value.each { |k, v| hash[k] = _to_hash(v) }
340
+ end
341
+ elsif value.respond_to? :to_hash
342
+ value.to_hash
343
+ else
344
+ value
345
+ end
346
+ end
347
+
348
+ end
349
+
350
+ end
@@ -0,0 +1,223 @@
1
+ =begin
2
+ #Biz-Events Service
3
+
4
+ #Microservice for exposing REST APIs about payment receipts.
5
+
6
+ The version of the OpenAPI document: 0.1.72
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module BizReceipts
17
+ class MapEntry
18
+ attr_accessor :key
19
+
20
+ attr_accessor :value
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'key' => :'key',
26
+ :'value' => :'value'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'key' => :'String',
39
+ :'value' => :'String'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BizReceipts::MapEntry` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BizReceipts::MapEntry`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'key')
65
+ self.key = attributes[:'key']
66
+ end
67
+
68
+ if attributes.key?(:'value')
69
+ self.value = attributes[:'value']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
77
+ invalid_properties = Array.new
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ warn '[DEPRECATED] the `valid?` method is obsolete'
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ key == o.key &&
94
+ value == o.value
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Integer] Hash code
105
+ def hash
106
+ [key, value].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def self.build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ attributes = attributes.transform_keys(&:to_sym)
115
+ transformed_hash = {}
116
+ openapi_types.each_pair do |key, type|
117
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
118
+ transformed_hash["#{key}"] = nil
119
+ elsif type =~ /\AArray<(.*)>/i
120
+ # check to ensure the input is an array given that the attribute
121
+ # is documented as an array but the input is not
122
+ if attributes[attribute_map[key]].is_a?(Array)
123
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
124
+ end
125
+ elsif !attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
127
+ end
128
+ end
129
+ new(transformed_hash)
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def self._deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ # models (e.g. Pet) or oneOf
170
+ klass = BizReceipts.const_get(type)
171
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+
223
+ end