raims 0.1.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.
@@ -0,0 +1,506 @@
1
+ # frozen_string_literal: true
2
+ # Generated by scripts/generate.py. Do not edit.
3
+
4
+ module Raims
5
+
6
+ class AccountsService
7
+ def initialize(client)
8
+ @client = client
9
+ end
10
+
11
+ # Retrieve account fees.
12
+ # @return [Raims::AccountFees]
13
+ def retrieve_fees(params = {}, options = {})
14
+ @client.request('GetAccountFees', path_params: {}, params: params, options: options)
15
+ end
16
+
17
+ # Retrieve the account number.
18
+ # @return [Raims::AccountNumber]
19
+ def retrieve_number(params = {}, options = {})
20
+ @client.request('GetAccountNumber', path_params: {}, params: params, options: options)
21
+ end
22
+
23
+ # Retrieve checkout settings.
24
+ # @return [Raims::CheckoutSettings]
25
+ def retrieve_checkout_settings(params = {}, options = {})
26
+ @client.request('GetCheckoutSettings', path_params: {}, params: params, options: options)
27
+ end
28
+
29
+ # Update checkout customization.
30
+ # @return [Raims::CheckoutSettings]
31
+ def update_checkout_settings(params = {}, options = {})
32
+ @client.request('UpdateCheckoutSettings', path_params: {}, params: params, options: options)
33
+ end
34
+
35
+ # Prepare a logo upload.
36
+ # @return [Raims::CheckoutAssetUpload]
37
+ def create_checkout_logo_upload(params = {}, options = {})
38
+ @client.request('CreateCheckoutLogoUpload', path_params: {}, params: params, options: options)
39
+ end
40
+
41
+ # Prepare an icon upload.
42
+ # @return [Raims::CheckoutAssetUpload]
43
+ def create_checkout_favicon_upload(params = {}, options = {})
44
+ @client.request('CreateCheckoutFaviconUpload', path_params: {}, params: params, options: options)
45
+ end
46
+
47
+ # Discard an image upload.
48
+ # @return [Raims::CheckoutAssetUploadDeleted]
49
+ def delete_checkout_asset_upload(id, params = {}, options = {})
50
+ @client.request('DeleteCheckoutAssetUpload', path_params: {'id' => id}, params: params, options: options)
51
+ end
52
+
53
+ # Retrieve account context.
54
+ # @return [Raims::AccountContext]
55
+ def retrieve_context(params = {}, options = {})
56
+ @client.request('GetAccountContext', path_params: {}, params: params, options: options)
57
+ end
58
+ end
59
+
60
+ class BalancesService
61
+ def initialize(client)
62
+ @client = client
63
+ end
64
+
65
+ # Retrieve the current balance.
66
+ # @return [Raims::Balance]
67
+ def retrieve(params = {}, options = {})
68
+ @client.request('GetBalance', path_params: {}, params: params, options: options)
69
+ end
70
+
71
+ # Retrieve expected receipts.
72
+ # @return [Raims::BalanceForecast]
73
+ def forecast(params = {}, options = {})
74
+ @client.request('GetBalanceForecast', path_params: {}, params: params, options: options)
75
+ end
76
+ end
77
+
78
+ class ChargesService
79
+ def initialize(client)
80
+ @client = client
81
+ end
82
+
83
+ # Create a new charge.
84
+ # @return [Raims::ChargeCreated]
85
+ def create(params = {}, options = {})
86
+ @client.request('CreateCharge', path_params: {}, params: params, options: options)
87
+ end
88
+
89
+ # List charges.
90
+ # @return [Raims::ApiList]
91
+ def list(params = {}, options = {})
92
+ @client.request('ListCharges', path_params: {}, params: params, options: options)
93
+ end
94
+
95
+ # Retrieve a charge.
96
+ # @return [Raims::Charge]
97
+ def retrieve(id, params = {}, options = {})
98
+ @client.request('GetCharge', path_params: {'id' => id}, params: params, options: options)
99
+ end
100
+
101
+ # Update an existing charge.
102
+ # @return [Raims::Charge]
103
+ def update(id, params = {}, options = {})
104
+ @client.request('UpdateCharge', path_params: {'id' => id}, params: params, options: options)
105
+ end
106
+
107
+ # Revoke a charge.
108
+ # @return [Raims::ChargeRevoked or Raims::ChargeRevocationPending]
109
+ def revoke(id, params = {}, options = {})
110
+ @client.request('RevokeCharge', path_params: {'id' => id}, params: params, options: options)
111
+ end
112
+
113
+ # Retrieve payment information.
114
+ # @return [Raims::PaymentReceipt]
115
+ def retrieve_payment(id, params = {}, options = {})
116
+ @client.request('GetChargePayment', path_params: {'id' => id}, params: params, options: options)
117
+ end
118
+
119
+ # Retrieve a payment receipt.
120
+ # @return [Raims::FinancialDocument]
121
+ def retrieve_receipt(id, params = {}, options = {})
122
+ @client.request('GetChargeReceipt', path_params: {'id' => id}, params: params, options: options)
123
+ end
124
+
125
+ # Retrieve a boleto document.
126
+ # @return [Raims::FinancialDocument]
127
+ def retrieve_boleto(id, params = {}, options = {})
128
+ @client.request('GetChargeBoleto', path_params: {'id' => id}, params: params, options: options)
129
+ end
130
+
131
+ # Request a refund.
132
+ # @return [Raims::Refund]
133
+ def create_refund(id, params = {}, options = {})
134
+ @client.request('CreateRefund', path_params: {'id' => id}, params: params, options: options)
135
+ end
136
+
137
+ # List refunds for a charge.
138
+ # @return [Raims::ApiList]
139
+ def list_refunds(id, params = {}, options = {})
140
+ @client.request('ListChargeRefunds', path_params: {'id' => id}, params: params, options: options)
141
+ end
142
+
143
+ # Retrieve refund eligibility.
144
+ # @return [Raims::RefundEligibility]
145
+ def retrieve_refund_eligibility(id, params = {}, options = {})
146
+ @client.request('GetRefundEligibility', path_params: {'id' => id}, params: params, options: options)
147
+ end
148
+
149
+ # Retrieve charge statistics.
150
+ # @return [Raims::ChargeStatistics]
151
+ def statistics(params = {}, options = {})
152
+ @client.request('GetChargeStatistics', path_params: {}, params: params, options: options)
153
+ end
154
+ end
155
+
156
+ class CustomersService
157
+ def initialize(client)
158
+ @client = client
159
+ end
160
+
161
+ # Create a customer.
162
+ # @return [Raims::CustomerCreated]
163
+ def create(params = {}, options = {})
164
+ @client.request('CreateCustomer', path_params: {}, params: params, options: options)
165
+ end
166
+
167
+ # List customers.
168
+ # @return [Raims::ApiList]
169
+ def list(params = {}, options = {})
170
+ @client.request('ListCustomers', path_params: {}, params: params, options: options)
171
+ end
172
+
173
+ # Retrieve a customer.
174
+ # @return [Raims::CustomerListItem]
175
+ def retrieve(id, params = {}, options = {})
176
+ @client.request('GetCustomer', path_params: {'id' => id}, params: params, options: options)
177
+ end
178
+
179
+ # Update an existing customer.
180
+ # @return [Raims::CustomerListItem]
181
+ def update(id, params = {}, options = {})
182
+ @client.request('UpdateCustomer', path_params: {'id' => id}, params: params, options: options)
183
+ end
184
+
185
+ # Delete a customer.
186
+ # @return [Raims::CustomerDeleted]
187
+ def delete(id, params = {}, options = {})
188
+ @client.request('DeleteCustomer', path_params: {'id' => id}, params: params, options: options)
189
+ end
190
+
191
+ # Delete customers in a batch.
192
+ # @return [Raims::CustomerBatchDeleted]
193
+ def delete_batch(params = {}, options = {})
194
+ @client.request('DeleteCustomersBatch', path_params: {}, params: params, options: options)
195
+ end
196
+ end
197
+
198
+ class DisputesService
199
+ def initialize(client)
200
+ @client = client
201
+ end
202
+
203
+ # List disputes.
204
+ # @return [Raims::ApiList]
205
+ def list(params = {}, options = {})
206
+ @client.request('ListDisputes', path_params: {}, params: params, options: options)
207
+ end
208
+
209
+ # Retrieve a dispute.
210
+ # @return [Raims::Dispute]
211
+ def retrieve(id, params = {}, options = {})
212
+ @client.request('GetDispute', path_params: {'id' => id}, params: params, options: options)
213
+ end
214
+ end
215
+
216
+ class PaymentLinksService
217
+ def initialize(client)
218
+ @client = client
219
+ end
220
+
221
+ # Create or retrieve a payment link.
222
+ # @return [Raims::PaymentLink]
223
+ def create(params = {}, options = {})
224
+ @client.request('CreatePaymentLink', path_params: {}, params: params, options: options)
225
+ end
226
+
227
+ # List payment links.
228
+ # @return [Raims::ApiList]
229
+ def list(params = {}, options = {})
230
+ @client.request('ListPaymentLinks', path_params: {}, params: params, options: options)
231
+ end
232
+
233
+ # Retrieve a payment link.
234
+ # @return [Raims::PaymentLinkDetails]
235
+ def retrieve(id, params = {}, options = {})
236
+ @client.request('GetPaymentLink', path_params: {'id' => id}, params: params, options: options)
237
+ end
238
+
239
+ # Update a payment link.
240
+ # @return [Raims::PaymentLink]
241
+ def update(id, params = {}, options = {})
242
+ @client.request('UpdatePaymentLink', path_params: {'id' => id}, params: params, options: options)
243
+ end
244
+
245
+ # Request payment link delivery by email.
246
+ # @return [Raims::PaymentLinkEmailRequestAccepted]
247
+ def send_email(id, params = {}, options = {})
248
+ @client.request('SendPaymentLinkEmail', path_params: {'id' => id}, params: params, options: options)
249
+ end
250
+ end
251
+
252
+ class RefundsService
253
+ def initialize(client)
254
+ @client = client
255
+ end
256
+
257
+ # List refunds.
258
+ # @return [Raims::ApiList]
259
+ def list(params = {}, options = {})
260
+ @client.request('ListRefunds', path_params: {}, params: params, options: options)
261
+ end
262
+
263
+ # Retrieve a refund.
264
+ # @return [Raims::Refund]
265
+ def retrieve(id, params = {}, options = {})
266
+ @client.request('GetRefund', path_params: {'id' => id}, params: params, options: options)
267
+ end
268
+
269
+ # Retrieve a refund receipt.
270
+ # @return [Raims::FinancialDocument]
271
+ def retrieve_receipt(id, params = {}, options = {})
272
+ @client.request('GetRefundReceipt', path_params: {'id' => id}, params: params, options: options)
273
+ end
274
+ end
275
+
276
+ class StatementsService
277
+ def initialize(client)
278
+ @client = client
279
+ end
280
+
281
+ # Retrieve statements.
282
+ # @return [Raims::ApiList]
283
+ def list(params = {}, options = {})
284
+ @client.request('ListStatements', path_params: {}, params: params, options: options)
285
+ end
286
+
287
+ # Retrieve a statement entry.
288
+ # @return [Raims::Statement]
289
+ def retrieve(id, params = {}, options = {})
290
+ @client.request('GetStatement', path_params: {'id' => id}, params: params, options: options)
291
+ end
292
+ end
293
+
294
+ class WebhookEventTypesService
295
+ def initialize(client)
296
+ @client = client
297
+ end
298
+
299
+ # List available event types.
300
+ # @return [Raims::WebhookEventTypeListResponse]
301
+ def list(params = {}, options = {})
302
+ @client.request('ListWebhookEventTypes', path_params: {}, params: params, options: options)
303
+ end
304
+ end
305
+
306
+ class WebhooksService
307
+ def initialize(client)
308
+ @client = client
309
+ end
310
+
311
+ # Create a webhook.
312
+ # @return [Raims::WebhookCreated]
313
+ def create(params = {}, options = {})
314
+ @client.request('CreateWebhook', path_params: {}, params: params, options: options)
315
+ end
316
+
317
+ # List webhooks.
318
+ # @return [Raims::ApiList]
319
+ def list(params = {}, options = {})
320
+ @client.request('ListWebhooks', path_params: {}, params: params, options: options)
321
+ end
322
+
323
+ # Retrieve a webhook.
324
+ # @return [Raims::Webhook]
325
+ def retrieve(webhook_id, params = {}, options = {})
326
+ @client.request('GetWebhook', path_params: {'webhook_id' => webhook_id}, params: params, options: options)
327
+ end
328
+
329
+ # Update a webhook.
330
+ # @return [Raims::Webhook]
331
+ def update(webhook_id, params = {}, options = {})
332
+ @client.request('UpdateWebhook', path_params: {'webhook_id' => webhook_id}, params: params, options: options)
333
+ end
334
+
335
+ # Delete a webhook.
336
+ # @return [nil]
337
+ def delete(webhook_id, params = {}, options = {})
338
+ @client.request('DeleteWebhook', path_params: {'webhook_id' => webhook_id}, params: params, options: options)
339
+ end
340
+
341
+ # Retrieve webhook failures.
342
+ # @return [Raims::WebhookHealth]
343
+ def retrieve_health(webhook_id, params = {}, options = {})
344
+ @client.request('GetWebhookHealth', path_params: {'webhook_id' => webhook_id}, params: params, options: options)
345
+ end
346
+
347
+ # Pause or resume deliveries.
348
+ # @return [Raims::WebhookPause]
349
+ def set_pause(webhook_id, params = {}, options = {})
350
+ @client.request('SetWebhookPause', path_params: {'webhook_id' => webhook_id}, params: params, options: options)
351
+ end
352
+
353
+ # Rotate the signing secret.
354
+ # @return [Raims::WebhookSecretRotation]
355
+ def rotate_secret(webhook_id, params = {}, options = {})
356
+ @client.request('RotateWebhookSecret', path_params: {'webhook_id' => webhook_id}, params: params, options: options)
357
+ end
358
+
359
+ # Send a test event.
360
+ # @return [Raims::WebhookTestAccepted]
361
+ def test(webhook_id, params = {}, options = {})
362
+ @client.request('TestWebhook', path_params: {'webhook_id' => webhook_id}, params: params, options: options)
363
+ end
364
+ end
365
+
366
+ class WithdrawalDestinationsService
367
+ def initialize(client)
368
+ @client = client
369
+ end
370
+
371
+ # List withdrawal destinations.
372
+ # @return [Raims::ApiList]
373
+ def list(params = {}, options = {})
374
+ @client.request('ListWithdrawalDestinations', path_params: {}, params: params, options: options)
375
+ end
376
+
377
+ # Retrieve a withdrawal destination.
378
+ # @return [Raims::WithdrawalDestination]
379
+ def retrieve(id, params = {}, options = {})
380
+ @client.request('GetWithdrawalDestination', path_params: {'id' => id}, params: params, options: options)
381
+ end
382
+ end
383
+
384
+ class WithdrawalsService
385
+ def initialize(client)
386
+ @client = client
387
+ end
388
+
389
+ # Request a withdrawal.
390
+ # @return [Raims::Withdrawal]
391
+ def create(params = {}, options = {})
392
+ @client.request('CreateWithdrawal', path_params: {}, params: params, options: options)
393
+ end
394
+
395
+ # List withdrawals.
396
+ # @return [Raims::ApiList]
397
+ def list(params = {}, options = {})
398
+ @client.request('ListWithdrawals', path_params: {}, params: params, options: options)
399
+ end
400
+
401
+ # Retrieve a withdrawal.
402
+ # @return [Raims::Withdrawal]
403
+ def retrieve(id, params = {}, options = {})
404
+ @client.request('GetWithdrawal', path_params: {'id' => id}, params: params, options: options)
405
+ end
406
+
407
+ # Retrieve withdrawal conditions.
408
+ # @return [Raims::WithdrawalLimits]
409
+ def retrieve_limits(params = {}, options = {})
410
+ @client.request('GetWithdrawalLimits', path_params: {}, params: params, options: options)
411
+ end
412
+
413
+ # Retrieve the withdrawal processing summary.
414
+ # @return [Raims::WithdrawalSummary]
415
+ def retrieve_summary(params = {}, options = {})
416
+ @client.request('GetWithdrawalSummary', path_params: {}, params: params, options: options)
417
+ end
418
+
419
+ # Retrieve automatic withdrawal settings.
420
+ # @return [Raims::AutomaticWithdrawalSettings]
421
+ def retrieve_automatic_settings(params = {}, options = {})
422
+ @client.request('GetAutomaticWithdrawalSettings', path_params: {}, params: params, options: options)
423
+ end
424
+
425
+ # Update automatic withdrawals.
426
+ # @return [Raims::AutomaticWithdrawalSettings]
427
+ def update_automatic_settings(params = {}, options = {})
428
+ @client.request('UpdateAutomaticWithdrawalSettings', path_params: {}, params: params, options: options)
429
+ end
430
+ end
431
+
432
+ class SimulationChargesService
433
+ def initialize(client)
434
+ @client = client
435
+ end
436
+
437
+ # Confirm a simulated payment.
438
+ # @return [Raims::ChargeSimulation]
439
+ def confirm_payment(id, params = {}, options = {})
440
+ @client.request('ConfirmSimulationPayment', path_params: {'id' => id}, params: params, options: options)
441
+ end
442
+
443
+ # Simulate payment failure.
444
+ # @return [Raims::ChargeSimulation]
445
+ def fail_payment(id, params = {}, options = {})
446
+ @client.request('FailSimulationPayment', path_params: {'id' => id}, params: params, options: options)
447
+ end
448
+
449
+ # Prepare a scenario.
450
+ # @return [Raims::ChargeScenario]
451
+ def configure_scenario(id, params = {}, options = {})
452
+ @client.request('ConfigureSimulationScenario', path_params: {'id' => id}, params: params, options: options)
453
+ end
454
+
455
+ # Resolve a pending scenario.
456
+ # @return [Raims::ChargeScenario]
457
+ def resolve_scenario(id, params = {}, options = {})
458
+ @client.request('ResolveSimulationScenario', path_params: {'id' => id}, params: params, options: options)
459
+ end
460
+
461
+ # Issue a test payment.
462
+ # @return [Raims::Charge]
463
+ def issue_payment(id, params = {}, options = {})
464
+ @client.request('IssueSimulationPayment', path_params: {'id' => id}, params: params, options: options)
465
+ end
466
+
467
+ # Simulate boleto compensation.
468
+ # @return [Raims::ChargeBoletoCompensation]
469
+ def compensate_boleto(id, params = {}, options = {})
470
+ @client.request('CompensateSimulationBoleto', path_params: {'id' => id}, params: params, options: options)
471
+ end
472
+
473
+ # Simulate a pending refund.
474
+ # @return [Raims::Refund]
475
+ def create_refund(id, params = {}, options = {})
476
+ @client.request('CreateSimulationRefund', path_params: {'id' => id}, params: params, options: options)
477
+ end
478
+ end
479
+
480
+ class SimulationRefundsService
481
+ def initialize(client)
482
+ @client = client
483
+ end
484
+
485
+ # Complete a simulated refund.
486
+ # @return [Raims::Refund]
487
+ def complete(id, params = {}, options = {})
488
+ @client.request('CompleteSimulationRefund', path_params: {'id' => id}, params: params, options: options)
489
+ end
490
+
491
+ # Simulate refund failure.
492
+ # @return [Raims::Refund]
493
+ def fail(id, params = {}, options = {})
494
+ @client.request('FailSimulationRefund', path_params: {'id' => id}, params: params, options: options)
495
+ end
496
+ end
497
+
498
+ class SimulationsService
499
+ attr_reader :charges, :refunds
500
+
501
+ def initialize(client)
502
+ @charges = SimulationChargesService.new(client)
503
+ @refunds = SimulationRefundsService.new(client)
504
+ end
505
+ end
506
+ end
data/lib/raims/util.rb ADDED
@@ -0,0 +1,141 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'bigdecimal'
5
+
6
+ module Raims
7
+ module Util
8
+ MAX_DECIMAL_EXPONENT = 4300
9
+
10
+ class JsonDecimal
11
+ def self.new(token)
12
+ Util.parse_decimal(token)
13
+ end
14
+ end
15
+ private_constant :JsonDecimal
16
+
17
+ module_function
18
+
19
+ def visible_ascii(value, maximum, label)
20
+ unless value.is_a?(String) && value.ascii_only? && value.match?(/\A[\x21-\x7e]{1,#{maximum}}\z/)
21
+ raise ArgumentError, "#{label} must contain visible ASCII without spaces."
22
+ end
23
+ value.dup.freeze
24
+ end
25
+
26
+ def timeout(value)
27
+ unless (value.is_a?(Integer) || value.is_a?(Float)) && value.finite? && value.positive? && value <= 300
28
+ raise ArgumentError, 'timeout must be greater than zero and at most 300 seconds.'
29
+ end
30
+ value.to_f
31
+ end
32
+
33
+ def retries(value)
34
+ raise ArgumentError, 'max_network_retries must be an integer between zero and five.' unless value.is_a?(Integer) && (0..5).cover?(value)
35
+ value
36
+ end
37
+
38
+ def deep_freeze(value)
39
+ case value
40
+ when Hash
41
+ value.each { |key, child| deep_freeze(key); deep_freeze(child) }
42
+ when Array
43
+ value.each { |child| deep_freeze(child) }
44
+ end
45
+ value.freeze
46
+ end
47
+
48
+ def json_value(value, seen = {}, depth = 0)
49
+ raise ArgumentError, 'Request parameters are nested too deeply.' if depth > 100
50
+ case value
51
+ when Hash, Array
52
+ raise ArgumentError, 'Request parameters cannot contain cycles.' if seen[value.object_id]
53
+ seen[value.object_id] = true
54
+ begin
55
+ if value.is_a?(Array)
56
+ value.map { |child| json_value(child, seen, depth + 1) }
57
+ else
58
+ value.each_with_object({}) do |(key, child), result|
59
+ raise ArgumentError, 'JSON field names must be strings or symbols.' unless key.is_a?(String) || key.is_a?(Symbol)
60
+ key = utf8_string(key.to_s)
61
+ raise ArgumentError, 'JSON field names must be unique after UTF-8 conversion.' if result.key?(key)
62
+ result[key] = json_value(child, seen, depth + 1)
63
+ end
64
+ end
65
+ ensure
66
+ seen.delete(value.object_id)
67
+ end
68
+ when String
69
+ utf8_string(value)
70
+ when Integer, TrueClass, FalseClass, NilClass
71
+ value
72
+ when Float
73
+ raise ArgumentError, 'JSON numbers must be finite.' unless value.finite?
74
+ value
75
+ else
76
+ raise ArgumentError, 'Request parameters must contain only JSON values.'
77
+ end
78
+ end
79
+
80
+ def utf8_string(value)
81
+ text = if value.encoding == Encoding::ASCII_8BIT
82
+ value.dup.force_encoding(Encoding::UTF_8)
83
+ else
84
+ value.encode(Encoding::UTF_8)
85
+ end
86
+ raise ArgumentError, 'JSON strings must contain valid text convertible to UTF-8.' unless text.valid_encoding?
87
+ text
88
+ rescue EncodingError
89
+ raise ArgumentError, 'JSON strings must contain valid text convertible to UTF-8.', cause: nil
90
+ end
91
+
92
+ def parse_json(body)
93
+ text = body.dup.force_encoding(Encoding::UTF_8)
94
+ raise JSON::ParserError, 'Invalid UTF-8.' unless text.valid_encoding?
95
+ normalize_number(JSON.parse(text, max_nesting: 100, allow_nan: false, create_additions: false, decimal_class: JsonDecimal))
96
+ end
97
+
98
+ def parse_decimal(token)
99
+ coefficient, exponent = token.split(/[eE]/, 2)
100
+ if exponent
101
+ digits = exponent.delete_prefix('-').delete_prefix('+').sub(/\A0+/, '')
102
+ if digits.length > 4 || digits.to_i > MAX_DECIMAL_EXPONENT
103
+ raise JSON::ParserError, 'JSON number exceeds the supported size.'
104
+ end
105
+ end
106
+ value = BigDecimal(token)
107
+ unless value.finite? && value.exponent.abs <= MAX_DECIMAL_EXPONENT && !(value.zero? && coefficient.match?(/[1-9]/))
108
+ raise JSON::ParserError, 'JSON number cannot be represented without losing its value.'
109
+ end
110
+ value
111
+ rescue ArgumentError
112
+ raise JSON::ParserError, 'JSON number cannot be represented.', cause: nil
113
+ end
114
+
115
+ def normalize_number(value)
116
+ case value
117
+ when BigDecimal
118
+ unless value.finite? && value.exponent.abs <= MAX_DECIMAL_EXPONENT
119
+ raise JSON::ParserError, 'JSON number exceeds the supported size.'
120
+ end
121
+ value.frac.zero? ? value.to_i : value
122
+ when Array
123
+ value.map { |child| normalize_number(child) }
124
+ when Hash
125
+ value.transform_values { |child| normalize_number(child) }
126
+ else
127
+ value
128
+ end
129
+ end
130
+
131
+ def plain(value)
132
+ case value
133
+ when ApiResource then value.to_h
134
+ when Hash then value.transform_values { |child| plain(child) }
135
+ when Array then value.map { |child| plain(child) }
136
+ when String then value.dup
137
+ else value
138
+ end
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Raims
4
+ VERSION = '0.1.1'
5
+ end