webpay 2.4.1 → 3.0.0

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 (79) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -2
  3. data/Rakefile +0 -6
  4. data/lib/webpay/account.rb +19 -24
  5. data/lib/webpay/api_resource.rb +5 -0
  6. data/lib/webpay/charge.rb +48 -27
  7. data/lib/webpay/customer.rb +56 -91
  8. data/lib/webpay/data_types.rb +2069 -0
  9. data/lib/webpay/error.rb +68 -0
  10. data/lib/webpay/event.rb +19 -16
  11. data/lib/webpay/recursion.rb +47 -46
  12. data/lib/webpay/shop.rb +37 -68
  13. data/lib/webpay/token.rb +19 -10
  14. data/lib/webpay.rb +114 -77
  15. data/webpay.gemspec +6 -13
  16. metadata +16 -179
  17. data/.rspec +0 -2
  18. data/.travis.yml +0 -12
  19. data/LICENSE.txt +0 -22
  20. data/README.md +0 -52
  21. data/gemfiles/no_doc_gems +0 -14
  22. data/lib/data/ca-certificates.crt +0 -3829
  23. data/lib/webpay/card.rb +0 -13
  24. data/lib/webpay/client.rb +0 -81
  25. data/lib/webpay/deleted_entity.rb +0 -8
  26. data/lib/webpay/entity.rb +0 -71
  27. data/lib/webpay/entity_list.rb +0 -25
  28. data/lib/webpay/fee.rb +0 -13
  29. data/lib/webpay/operations.rb +0 -49
  30. data/lib/webpay/response_converter.rb +0 -57
  31. data/lib/webpay/version.rb +0 -5
  32. data/lib/webpay/webpay_error.rb +0 -126
  33. data/spec/resources/account/delete.txt +0 -15
  34. data/spec/resources/account/retrieve.txt +0 -23
  35. data/spec/resources/charges/all.txt +0 -139
  36. data/spec/resources/charges/capture.txt +0 -49
  37. data/spec/resources/charges/create_with_card.txt +0 -49
  38. data/spec/resources/charges/create_with_customer.txt +0 -49
  39. data/spec/resources/charges/refund.txt +0 -57
  40. data/spec/resources/charges/retrieve.txt +0 -49
  41. data/spec/resources/charges/retrieve_not_captured.txt +0 -42
  42. data/spec/resources/customers/all.txt +0 -76
  43. data/spec/resources/customers/create.txt +0 -31
  44. data/spec/resources/customers/delete.txt +0 -16
  45. data/spec/resources/customers/retrieve.txt +0 -63
  46. data/spec/resources/customers/retrieve_deleted.txt +0 -16
  47. data/spec/resources/customers/update.txt +0 -31
  48. data/spec/resources/errors/bad_request.txt +0 -18
  49. data/spec/resources/errors/broken_json.txt +0 -16
  50. data/spec/resources/errors/card_error.txt +0 -19
  51. data/spec/resources/errors/not_found.txt +0 -18
  52. data/spec/resources/errors/not_found_ja.txt +0 -20
  53. data/spec/resources/errors/unauthorized.txt +0 -16
  54. data/spec/resources/errors/unknown_api_error.txt +0 -17
  55. data/spec/resources/events/all_with_type.txt +0 -164
  56. data/spec/resources/events/retrieve.txt +0 -41
  57. data/spec/resources/recursions/all.txt +0 -61
  58. data/spec/resources/recursions/create.txt +0 -26
  59. data/spec/resources/recursions/delete.txt +0 -16
  60. data/spec/resources/recursions/resume.txt +0 -26
  61. data/spec/resources/recursions/retrieve.txt +0 -26
  62. data/spec/resources/recursions/retrieve_deleted.txt +0 -16
  63. data/spec/resources/recursions/retrieve_suspended.txt +0 -26
  64. data/spec/resources/shops/all.txt +0 -122
  65. data/spec/resources/shops/create.txt +0 -54
  66. data/spec/resources/shops/retrieve.txt +0 -54
  67. data/spec/resources/shops/update.txt +0 -55
  68. data/spec/resources/tokens/create.txt +0 -30
  69. data/spec/resources/tokens/retrieve.txt +0 -30
  70. data/spec/spec_helper.rb +0 -37
  71. data/spec/webpay/account_spec.rb +0 -24
  72. data/spec/webpay/charge_spec.rb +0 -143
  73. data/spec/webpay/customer_spec.rb +0 -109
  74. data/spec/webpay/event_spec.rb +0 -30
  75. data/spec/webpay/recursion_spec.rb +0 -93
  76. data/spec/webpay/shop_spec.rb +0 -121
  77. data/spec/webpay/token_spec.rb +0 -33
  78. data/spec/webpay/webpay_error_spec.rb +0 -64
  79. data/spec/webpay_spec.rb +0 -40
@@ -0,0 +1,2069 @@
1
+ class WebPay
2
+ class Entity
3
+ # Remove nil values and stringify keys
4
+ def normalize_hash(hash)
5
+ hash.each_with_object({}) { |kv, obj| k,v = kv; obj[k.to_s] = v unless v == nil }
6
+ end
7
+
8
+ # Convert attributes and its children to pure-Ruby hash
9
+ # @return [Hash] pure ruby hash including no user objects
10
+ def to_h
11
+ @attributes.each_with_object({}) do |kv, obj|
12
+ k, v = kv
13
+ next if v == nil
14
+ obj[k] = v.is_a?(Entity) ? v.to_h : v
15
+ end
16
+ end
17
+
18
+ alias_method :to_hash, :to_h
19
+
20
+ # Pretty print object's data
21
+ def to_s
22
+ rendered = "#<#{self.class}\n"
23
+ self.class.fields.each do |k|
24
+ rendered << " #{k}: " << @attributes[k].inspect.gsub(/(\r?\n)/, '\1 ') << "\n"
25
+ end
26
+ rendered << ">"
27
+ end
28
+
29
+ alias_method :inspect, :to_s
30
+ end
31
+
32
+ class CardRequest < Entity
33
+ attr_reader :attributes
34
+
35
+ def self.fields
36
+ ['number', 'exp_month', 'exp_year', 'cvc', 'name']
37
+ end
38
+
39
+
40
+ def self.create(params)
41
+ return params if params.is_a?(self)
42
+ hash = case params
43
+ when Hash; params
44
+ else
45
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
46
+ end
47
+ self.new(hash)
48
+ end
49
+
50
+ def initialize(hash = {})
51
+ hash = normalize_hash(hash)
52
+ @attributes = hash
53
+ end
54
+
55
+ # attributes accessors
56
+ def number
57
+ attributes['number']
58
+ end
59
+
60
+
61
+ def number=(value)
62
+ attributes['number'] = value
63
+ end
64
+
65
+ def exp_month
66
+ attributes['exp_month']
67
+ end
68
+
69
+
70
+ def exp_month=(value)
71
+ attributes['exp_month'] = value
72
+ end
73
+
74
+ def exp_year
75
+ attributes['exp_year']
76
+ end
77
+
78
+
79
+ def exp_year=(value)
80
+ attributes['exp_year'] = value
81
+ end
82
+
83
+ def cvc
84
+ attributes['cvc']
85
+ end
86
+
87
+
88
+ def cvc=(value)
89
+ attributes['cvc'] = value
90
+ end
91
+
92
+ def name
93
+ attributes['name']
94
+ end
95
+
96
+
97
+ def name=(value)
98
+ attributes['name'] = value
99
+ end
100
+
101
+ end
102
+ class ChargeRequestCreate < Entity
103
+ attr_reader :attributes
104
+
105
+ def self.fields
106
+ ['amount', 'currency', 'customer', 'card', 'description', 'capture', 'expire_days', 'uuid']
107
+ end
108
+
109
+
110
+ def self.create(params)
111
+ return params if params.is_a?(self)
112
+ hash = case params
113
+ when Hash; params
114
+ else
115
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
116
+ end
117
+ self.new(hash)
118
+ end
119
+
120
+ def initialize(hash = {})
121
+ hash = normalize_hash(hash)
122
+ hash['card'] = hash['card'].is_a?(Hash) ? WebPay::CardRequest.new(hash['card']) : hash['card']
123
+ @attributes = hash
124
+ end
125
+
126
+ # attributes accessors
127
+ def amount
128
+ attributes['amount']
129
+ end
130
+
131
+
132
+ def amount=(value)
133
+ attributes['amount'] = value
134
+ end
135
+
136
+ def currency
137
+ attributes['currency']
138
+ end
139
+
140
+
141
+ def currency=(value)
142
+ attributes['currency'] = value
143
+ end
144
+
145
+ def customer
146
+ attributes['customer']
147
+ end
148
+
149
+
150
+ def customer=(value)
151
+ attributes['customer'] = value
152
+ end
153
+
154
+ def card
155
+ attributes['card']
156
+ end
157
+
158
+
159
+ def card=(value)
160
+ value = value.is_a?(Hash) ? WebPay::CardRequest.new(value) : value
161
+ attributes['card'] = value
162
+ end
163
+
164
+ def description
165
+ attributes['description']
166
+ end
167
+
168
+
169
+ def description=(value)
170
+ attributes['description'] = value
171
+ end
172
+
173
+ def capture
174
+ attributes['capture']
175
+ end
176
+
177
+
178
+ def capture=(value)
179
+ attributes['capture'] = value
180
+ end
181
+
182
+ def expire_days
183
+ attributes['expire_days']
184
+ end
185
+
186
+
187
+ def expire_days=(value)
188
+ attributes['expire_days'] = value
189
+ end
190
+
191
+ def uuid
192
+ attributes['uuid']
193
+ end
194
+
195
+
196
+ def uuid=(value)
197
+ attributes['uuid'] = value
198
+ end
199
+
200
+ end
201
+ class CardResponse < Entity
202
+ attr_reader :attributes
203
+
204
+ def self.fields
205
+ ['object', 'exp_month', 'exp_year', 'fingerprint', 'last4', 'type', 'cvc_check', 'name', 'country']
206
+ end
207
+
208
+
209
+ def initialize(hash = {})
210
+ hash = normalize_hash(hash)
211
+ @attributes = hash
212
+ end
213
+
214
+ # attributes accessors
215
+ def object
216
+ attributes['object']
217
+ end
218
+
219
+ def exp_month
220
+ attributes['exp_month']
221
+ end
222
+
223
+ def exp_year
224
+ attributes['exp_year']
225
+ end
226
+
227
+ def fingerprint
228
+ attributes['fingerprint']
229
+ end
230
+
231
+ def last4
232
+ attributes['last4']
233
+ end
234
+
235
+ def type
236
+ attributes['type']
237
+ end
238
+
239
+ def cvc_check
240
+ attributes['cvc_check']
241
+ end
242
+
243
+ def name
244
+ attributes['name']
245
+ end
246
+
247
+ def country
248
+ attributes['country']
249
+ end
250
+
251
+ end
252
+ class ChargeFeeResponse < Entity
253
+ attr_reader :attributes
254
+
255
+ def self.fields
256
+ ['object', 'transaction_type', 'transaction_fee', 'rate', 'amount', 'created']
257
+ end
258
+
259
+
260
+ def initialize(hash = {})
261
+ hash = normalize_hash(hash)
262
+ @attributes = hash
263
+ end
264
+
265
+ # attributes accessors
266
+ def object
267
+ attributes['object']
268
+ end
269
+
270
+ def transaction_type
271
+ attributes['transaction_type']
272
+ end
273
+
274
+ def transaction_fee
275
+ attributes['transaction_fee']
276
+ end
277
+
278
+ def rate
279
+ attributes['rate']
280
+ end
281
+
282
+ def amount
283
+ attributes['amount']
284
+ end
285
+
286
+ def created
287
+ attributes['created']
288
+ end
289
+
290
+ end
291
+ class ChargeResponse < Entity
292
+ attr_reader :attributes
293
+
294
+ def self.fields
295
+ ['id', 'object', 'livemode', 'amount', 'card', 'created', 'currency', 'paid', 'captured', 'refunded', 'amount_refunded', 'customer', 'recursion', 'shop', 'description', 'failure_message', 'expire_time', 'fees']
296
+ end
297
+
298
+
299
+ def initialize(hash = {})
300
+ hash = normalize_hash(hash)
301
+ hash['card'] = WebPay::CardResponse.new(hash['card']) if hash['card'].is_a?(Hash)
302
+ hash['fees'] = hash['fees'].is_a?(Array) ? hash['fees'].map { |x| WebPay::ChargeFeeResponse.new(x) if x.is_a?(Hash) } : hash['fees']
303
+ @attributes = hash
304
+ end
305
+
306
+ # attributes accessors
307
+ def id
308
+ attributes['id']
309
+ end
310
+
311
+ def object
312
+ attributes['object']
313
+ end
314
+
315
+ def livemode
316
+ attributes['livemode']
317
+ end
318
+
319
+ def amount
320
+ attributes['amount']
321
+ end
322
+
323
+ def card
324
+ attributes['card']
325
+ end
326
+
327
+ def created
328
+ attributes['created']
329
+ end
330
+
331
+ def currency
332
+ attributes['currency']
333
+ end
334
+
335
+ def paid
336
+ attributes['paid']
337
+ end
338
+
339
+ def captured
340
+ attributes['captured']
341
+ end
342
+
343
+ def refunded
344
+ attributes['refunded']
345
+ end
346
+
347
+ def amount_refunded
348
+ attributes['amount_refunded']
349
+ end
350
+
351
+ def customer
352
+ attributes['customer']
353
+ end
354
+
355
+ def recursion
356
+ attributes['recursion']
357
+ end
358
+
359
+ def shop
360
+ attributes['shop']
361
+ end
362
+
363
+ def description
364
+ attributes['description']
365
+ end
366
+
367
+ def failure_message
368
+ attributes['failure_message']
369
+ end
370
+
371
+ def expire_time
372
+ attributes['expire_time']
373
+ end
374
+
375
+ def fees
376
+ attributes['fees']
377
+ end
378
+
379
+ end
380
+ class ChargeIdRequest < Entity
381
+ attr_reader :attributes
382
+
383
+ def self.fields
384
+ ['id']
385
+ end
386
+
387
+
388
+ def self.create(params)
389
+ return params if params.is_a?(self)
390
+ hash = case params
391
+ when Hash; params
392
+ when WebPay::ChargeResponse; {'id' => params.id}
393
+ when String; {'id' => params}
394
+ else
395
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
396
+ end
397
+ self.new(hash)
398
+ end
399
+
400
+ def initialize(hash = {})
401
+ hash = normalize_hash(hash)
402
+ @attributes = hash
403
+ end
404
+
405
+ # attributes accessors
406
+ def id
407
+ attributes['id']
408
+ end
409
+
410
+
411
+ def id=(value)
412
+ attributes['id'] = value
413
+ end
414
+
415
+ end
416
+ class ChargeRequestWithAmount < Entity
417
+ attr_reader :attributes
418
+
419
+ def self.fields
420
+ ['id', 'amount']
421
+ end
422
+
423
+
424
+ def self.create(params)
425
+ return params if params.is_a?(self)
426
+ hash = case params
427
+ when Hash; params
428
+ when WebPay::ChargeResponse; {'id' => params.id, 'amount' => params.amount}
429
+ when String; {'id' => params}
430
+ else
431
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
432
+ end
433
+ self.new(hash)
434
+ end
435
+
436
+ def initialize(hash = {})
437
+ hash = normalize_hash(hash)
438
+ @attributes = hash
439
+ end
440
+
441
+ # attributes accessors
442
+ def id
443
+ attributes['id']
444
+ end
445
+
446
+
447
+ def id=(value)
448
+ attributes['id'] = value
449
+ end
450
+
451
+ def amount
452
+ attributes['amount']
453
+ end
454
+
455
+
456
+ def amount=(value)
457
+ attributes['amount'] = value
458
+ end
459
+
460
+ end
461
+ class CreatedRange < Entity
462
+ attr_reader :attributes
463
+
464
+ def self.fields
465
+ ['gt', 'gte', 'lt', 'lte']
466
+ end
467
+
468
+
469
+ def self.create(params)
470
+ return params if params.is_a?(self)
471
+ hash = case params
472
+ when Hash; params
473
+ else
474
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
475
+ end
476
+ self.new(hash)
477
+ end
478
+
479
+ def initialize(hash = {})
480
+ hash = normalize_hash(hash)
481
+ @attributes = hash
482
+ end
483
+
484
+ # attributes accessors
485
+ def gt
486
+ attributes['gt']
487
+ end
488
+
489
+
490
+ def gt=(value)
491
+ attributes['gt'] = value
492
+ end
493
+
494
+ def gte
495
+ attributes['gte']
496
+ end
497
+
498
+
499
+ def gte=(value)
500
+ attributes['gte'] = value
501
+ end
502
+
503
+ def lt
504
+ attributes['lt']
505
+ end
506
+
507
+
508
+ def lt=(value)
509
+ attributes['lt'] = value
510
+ end
511
+
512
+ def lte
513
+ attributes['lte']
514
+ end
515
+
516
+
517
+ def lte=(value)
518
+ attributes['lte'] = value
519
+ end
520
+
521
+ end
522
+ class ListRequestWithCustomer < Entity
523
+ attr_reader :attributes
524
+
525
+ def self.fields
526
+ ['count', 'offset', 'created', 'customer', 'recursion']
527
+ end
528
+
529
+
530
+ def self.create(params)
531
+ return params if params.is_a?(self)
532
+ hash = case params
533
+ when Hash; params
534
+ else
535
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
536
+ end
537
+ self.new(hash)
538
+ end
539
+
540
+ def initialize(hash = {})
541
+ hash = normalize_hash(hash)
542
+ hash['created'] = hash['created'].is_a?(Hash) ? WebPay::CreatedRange.new(hash['created']) : hash['created']
543
+ @attributes = hash
544
+ end
545
+
546
+ # attributes accessors
547
+ def count
548
+ attributes['count']
549
+ end
550
+
551
+
552
+ def count=(value)
553
+ attributes['count'] = value
554
+ end
555
+
556
+ def offset
557
+ attributes['offset']
558
+ end
559
+
560
+
561
+ def offset=(value)
562
+ attributes['offset'] = value
563
+ end
564
+
565
+ def created
566
+ attributes['created']
567
+ end
568
+
569
+
570
+ def created=(value)
571
+ value = value.is_a?(Hash) ? WebPay::CreatedRange.new(value) : value
572
+ attributes['created'] = value
573
+ end
574
+
575
+ def customer
576
+ attributes['customer']
577
+ end
578
+
579
+
580
+ def customer=(value)
581
+ attributes['customer'] = value
582
+ end
583
+
584
+ def recursion
585
+ attributes['recursion']
586
+ end
587
+
588
+
589
+ def recursion=(value)
590
+ attributes['recursion'] = value
591
+ end
592
+
593
+ end
594
+ class ChargeResponseList < Entity
595
+ attr_reader :attributes
596
+
597
+ def self.fields
598
+ ['object', 'url', 'count', 'data']
599
+ end
600
+
601
+
602
+ def initialize(hash = {})
603
+ hash = normalize_hash(hash)
604
+ hash['data'] = hash['data'].is_a?(Array) ? hash['data'].map { |x| WebPay::ChargeResponse.new(x) if x.is_a?(Hash) } : hash['data']
605
+ @attributes = hash
606
+ end
607
+
608
+ # attributes accessors
609
+ def object
610
+ attributes['object']
611
+ end
612
+
613
+ def url
614
+ attributes['url']
615
+ end
616
+
617
+ def count
618
+ attributes['count']
619
+ end
620
+
621
+ def data
622
+ attributes['data']
623
+ end
624
+
625
+ end
626
+ class CustomerRequestCreate < Entity
627
+ attr_reader :attributes
628
+
629
+ def self.fields
630
+ ['card', 'description', 'email', 'uuid']
631
+ end
632
+
633
+
634
+ def self.create(params)
635
+ return params if params.is_a?(self)
636
+ hash = case params
637
+ when Hash; params
638
+ else
639
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
640
+ end
641
+ self.new(hash)
642
+ end
643
+
644
+ def initialize(hash = {})
645
+ hash = normalize_hash(hash)
646
+ hash['card'] = hash['card'].is_a?(Hash) ? WebPay::CardRequest.new(hash['card']) : hash['card']
647
+ @attributes = hash
648
+ end
649
+
650
+ # attributes accessors
651
+ def card
652
+ attributes['card']
653
+ end
654
+
655
+
656
+ def card=(value)
657
+ value = value.is_a?(Hash) ? WebPay::CardRequest.new(value) : value
658
+ attributes['card'] = value
659
+ end
660
+
661
+ def description
662
+ attributes['description']
663
+ end
664
+
665
+
666
+ def description=(value)
667
+ attributes['description'] = value
668
+ end
669
+
670
+ def email
671
+ attributes['email']
672
+ end
673
+
674
+
675
+ def email=(value)
676
+ attributes['email'] = value
677
+ end
678
+
679
+ def uuid
680
+ attributes['uuid']
681
+ end
682
+
683
+
684
+ def uuid=(value)
685
+ attributes['uuid'] = value
686
+ end
687
+
688
+ end
689
+ class RecursionResponse < Entity
690
+ attr_reader :attributes
691
+
692
+ def self.fields
693
+ ['id', 'object', 'livemode', 'created', 'amount', 'currency', 'period', 'description', 'customer', 'shop', 'last_executed', 'next_scheduled', 'status', 'deleted']
694
+ end
695
+
696
+
697
+ def initialize(hash = {})
698
+ hash = normalize_hash(hash)
699
+ hash['deleted'] ||= false
700
+ @attributes = hash
701
+ end
702
+
703
+ # attributes accessors
704
+ def id
705
+ attributes['id']
706
+ end
707
+
708
+ def object
709
+ attributes['object']
710
+ end
711
+
712
+ def livemode
713
+ attributes['livemode']
714
+ end
715
+
716
+ def created
717
+ attributes['created']
718
+ end
719
+
720
+ def amount
721
+ attributes['amount']
722
+ end
723
+
724
+ def currency
725
+ attributes['currency']
726
+ end
727
+
728
+ def period
729
+ attributes['period']
730
+ end
731
+
732
+ def description
733
+ attributes['description']
734
+ end
735
+
736
+ def customer
737
+ attributes['customer']
738
+ end
739
+
740
+ def shop
741
+ attributes['shop']
742
+ end
743
+
744
+ def last_executed
745
+ attributes['last_executed']
746
+ end
747
+
748
+ def next_scheduled
749
+ attributes['next_scheduled']
750
+ end
751
+
752
+ def status
753
+ attributes['status']
754
+ end
755
+
756
+ def deleted
757
+ attributes['deleted']
758
+ end
759
+
760
+ end
761
+ class CustomerResponse < Entity
762
+ attr_reader :attributes
763
+
764
+ def self.fields
765
+ ['id', 'object', 'livemode', 'created', 'active_card', 'description', 'email', 'recursions', 'deleted']
766
+ end
767
+
768
+
769
+ def initialize(hash = {})
770
+ hash = normalize_hash(hash)
771
+ hash['active_card'] = WebPay::CardResponse.new(hash['active_card']) if hash['active_card'].is_a?(Hash)
772
+ hash['recursions'] = hash['recursions'].is_a?(Array) ? hash['recursions'].map { |x| WebPay::RecursionResponse.new(x) if x.is_a?(Hash) } : hash['recursions']
773
+ hash['deleted'] ||= false
774
+ @attributes = hash
775
+ end
776
+
777
+ # attributes accessors
778
+ def id
779
+ attributes['id']
780
+ end
781
+
782
+ def object
783
+ attributes['object']
784
+ end
785
+
786
+ def livemode
787
+ attributes['livemode']
788
+ end
789
+
790
+ def created
791
+ attributes['created']
792
+ end
793
+
794
+ def active_card
795
+ attributes['active_card']
796
+ end
797
+
798
+ def description
799
+ attributes['description']
800
+ end
801
+
802
+ def email
803
+ attributes['email']
804
+ end
805
+
806
+ def recursions
807
+ attributes['recursions']
808
+ end
809
+
810
+ def deleted
811
+ attributes['deleted']
812
+ end
813
+
814
+ end
815
+ class CustomerIdRequest < Entity
816
+ attr_reader :attributes
817
+
818
+ def self.fields
819
+ ['id']
820
+ end
821
+
822
+
823
+ def self.create(params)
824
+ return params if params.is_a?(self)
825
+ hash = case params
826
+ when Hash; params
827
+ when WebPay::CustomerResponse; {'id' => params.id}
828
+ when String; {'id' => params}
829
+ else
830
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
831
+ end
832
+ self.new(hash)
833
+ end
834
+
835
+ def initialize(hash = {})
836
+ hash = normalize_hash(hash)
837
+ @attributes = hash
838
+ end
839
+
840
+ # attributes accessors
841
+ def id
842
+ attributes['id']
843
+ end
844
+
845
+
846
+ def id=(value)
847
+ attributes['id'] = value
848
+ end
849
+
850
+ end
851
+ class CustomerRequestUpdate < Entity
852
+ attr_reader :attributes
853
+
854
+ def self.fields
855
+ ['id', 'card', 'description', 'email']
856
+ end
857
+
858
+
859
+ def self.create(params)
860
+ return params if params.is_a?(self)
861
+ hash = case params
862
+ when Hash; params
863
+ when WebPay::CustomerResponse; {'id' => params.id}
864
+ when String; {'id' => params}
865
+ else
866
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
867
+ end
868
+ self.new(hash)
869
+ end
870
+
871
+ def initialize(hash = {})
872
+ hash = normalize_hash(hash)
873
+ hash['card'] = hash['card'].is_a?(Hash) ? WebPay::CardRequest.new(hash['card']) : hash['card']
874
+ @attributes = hash
875
+ end
876
+
877
+ # attributes accessors
878
+ def id
879
+ attributes['id']
880
+ end
881
+
882
+
883
+ def id=(value)
884
+ attributes['id'] = value
885
+ end
886
+
887
+ def card
888
+ attributes['card']
889
+ end
890
+
891
+
892
+ def card=(value)
893
+ value = value.is_a?(Hash) ? WebPay::CardRequest.new(value) : value
894
+ attributes['card'] = value
895
+ end
896
+
897
+ def description
898
+ attributes['description']
899
+ end
900
+
901
+
902
+ def description=(value)
903
+ attributes['description'] = value
904
+ end
905
+
906
+ def email
907
+ attributes['email']
908
+ end
909
+
910
+
911
+ def email=(value)
912
+ attributes['email'] = value
913
+ end
914
+
915
+ end
916
+ class ListRequest < Entity
917
+ attr_reader :attributes
918
+
919
+ def self.fields
920
+ ['count', 'offset', 'created']
921
+ end
922
+
923
+
924
+ def self.create(params)
925
+ return params if params.is_a?(self)
926
+ hash = case params
927
+ when Hash; params
928
+ else
929
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
930
+ end
931
+ self.new(hash)
932
+ end
933
+
934
+ def initialize(hash = {})
935
+ hash = normalize_hash(hash)
936
+ hash['created'] = hash['created'].is_a?(Hash) ? WebPay::CreatedRange.new(hash['created']) : hash['created']
937
+ @attributes = hash
938
+ end
939
+
940
+ # attributes accessors
941
+ def count
942
+ attributes['count']
943
+ end
944
+
945
+
946
+ def count=(value)
947
+ attributes['count'] = value
948
+ end
949
+
950
+ def offset
951
+ attributes['offset']
952
+ end
953
+
954
+
955
+ def offset=(value)
956
+ attributes['offset'] = value
957
+ end
958
+
959
+ def created
960
+ attributes['created']
961
+ end
962
+
963
+
964
+ def created=(value)
965
+ value = value.is_a?(Hash) ? WebPay::CreatedRange.new(value) : value
966
+ attributes['created'] = value
967
+ end
968
+
969
+ end
970
+ class CustomerResponseList < Entity
971
+ attr_reader :attributes
972
+
973
+ def self.fields
974
+ ['object', 'url', 'count', 'data']
975
+ end
976
+
977
+
978
+ def initialize(hash = {})
979
+ hash = normalize_hash(hash)
980
+ hash['data'] = hash['data'].is_a?(Array) ? hash['data'].map { |x| WebPay::CustomerResponse.new(x) if x.is_a?(Hash) } : hash['data']
981
+ @attributes = hash
982
+ end
983
+
984
+ # attributes accessors
985
+ def object
986
+ attributes['object']
987
+ end
988
+
989
+ def url
990
+ attributes['url']
991
+ end
992
+
993
+ def count
994
+ attributes['count']
995
+ end
996
+
997
+ def data
998
+ attributes['data']
999
+ end
1000
+
1001
+ end
1002
+ class TokenRequestCreate < Entity
1003
+ attr_reader :attributes
1004
+
1005
+ def self.fields
1006
+ ['card', 'uuid']
1007
+ end
1008
+
1009
+
1010
+ def self.create(params)
1011
+ return params if params.is_a?(self)
1012
+ hash = case params
1013
+ when Hash; params
1014
+ when WebPay::CardRequest; {'card' => params}
1015
+ else
1016
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
1017
+ end
1018
+ self.new(hash)
1019
+ end
1020
+
1021
+ def initialize(hash = {})
1022
+ hash = normalize_hash(hash)
1023
+ hash['card'] = WebPay::CardRequest.new(hash['card']) if hash['card'].is_a?(Hash)
1024
+ @attributes = hash
1025
+ end
1026
+
1027
+ # attributes accessors
1028
+ def card
1029
+ attributes['card']
1030
+ end
1031
+
1032
+
1033
+ def card=(value)
1034
+ value = WebPay::CardRequest.new(value) if value.is_a?(Hash)
1035
+ attributes['card'] = value
1036
+ end
1037
+
1038
+ def uuid
1039
+ attributes['uuid']
1040
+ end
1041
+
1042
+
1043
+ def uuid=(value)
1044
+ attributes['uuid'] = value
1045
+ end
1046
+
1047
+ end
1048
+ class TokenResponse < Entity
1049
+ attr_reader :attributes
1050
+
1051
+ def self.fields
1052
+ ['id', 'object', 'livemode', 'card', 'created', 'used']
1053
+ end
1054
+
1055
+
1056
+ def initialize(hash = {})
1057
+ hash = normalize_hash(hash)
1058
+ hash['card'] = WebPay::CardResponse.new(hash['card']) if hash['card'].is_a?(Hash)
1059
+ @attributes = hash
1060
+ end
1061
+
1062
+ # attributes accessors
1063
+ def id
1064
+ attributes['id']
1065
+ end
1066
+
1067
+ def object
1068
+ attributes['object']
1069
+ end
1070
+
1071
+ def livemode
1072
+ attributes['livemode']
1073
+ end
1074
+
1075
+ def card
1076
+ attributes['card']
1077
+ end
1078
+
1079
+ def created
1080
+ attributes['created']
1081
+ end
1082
+
1083
+ def used
1084
+ attributes['used']
1085
+ end
1086
+
1087
+ end
1088
+ class TokenIdRequest < Entity
1089
+ attr_reader :attributes
1090
+
1091
+ def self.fields
1092
+ ['id']
1093
+ end
1094
+
1095
+
1096
+ def self.create(params)
1097
+ return params if params.is_a?(self)
1098
+ hash = case params
1099
+ when Hash; params
1100
+ when WebPay::TokenResponse; {'id' => params.id}
1101
+ when String; {'id' => params}
1102
+ else
1103
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
1104
+ end
1105
+ self.new(hash)
1106
+ end
1107
+
1108
+ def initialize(hash = {})
1109
+ hash = normalize_hash(hash)
1110
+ @attributes = hash
1111
+ end
1112
+
1113
+ # attributes accessors
1114
+ def id
1115
+ attributes['id']
1116
+ end
1117
+
1118
+
1119
+ def id=(value)
1120
+ attributes['id'] = value
1121
+ end
1122
+
1123
+ end
1124
+ class EventIdRequest < Entity
1125
+ attr_reader :attributes
1126
+
1127
+ def self.fields
1128
+ ['id']
1129
+ end
1130
+
1131
+
1132
+ def self.create(params)
1133
+ return params if params.is_a?(self)
1134
+ hash = case params
1135
+ when Hash; params
1136
+ when WebPay::EventResponse; {'id' => params.id}
1137
+ when String; {'id' => params}
1138
+ else
1139
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
1140
+ end
1141
+ self.new(hash)
1142
+ end
1143
+
1144
+ def initialize(hash = {})
1145
+ hash = normalize_hash(hash)
1146
+ @attributes = hash
1147
+ end
1148
+
1149
+ # attributes accessors
1150
+ def id
1151
+ attributes['id']
1152
+ end
1153
+
1154
+
1155
+ def id=(value)
1156
+ attributes['id'] = value
1157
+ end
1158
+
1159
+ end
1160
+ class EventData < Entity
1161
+ attr_reader :attributes
1162
+
1163
+ def self.fields
1164
+ ['object', 'previous_attributes']
1165
+ end
1166
+
1167
+
1168
+ def initialize(hash = {})
1169
+ hash = normalize_hash(hash)
1170
+ hash['object'] =
1171
+ case hash['object'].is_a?(Hash) && hash['object']['object']
1172
+ when 'charge'; WebPay::ChargeResponse.new(hash['object'])
1173
+ when 'customer'; WebPay::CustomerResponse.new(hash['object'])
1174
+ when 'shop'; WebPay::ShopResponse.new(hash['object'])
1175
+ when 'recursion'; WebPay::RecursionResponse.new(hash['object'])
1176
+ when 'account'; WebPay::AccountResponse.new(hash['object'])
1177
+ else; hash['object']
1178
+ end
1179
+ @attributes = hash
1180
+ end
1181
+
1182
+ # attributes accessors
1183
+ def object
1184
+ attributes['object']
1185
+ end
1186
+
1187
+ def previous_attributes
1188
+ attributes['previous_attributes']
1189
+ end
1190
+
1191
+ end
1192
+ class EventResponse < Entity
1193
+ attr_reader :attributes
1194
+
1195
+ def self.fields
1196
+ ['id', 'object', 'livemode', 'created', 'data', 'pending_webhooks', 'type', 'shop']
1197
+ end
1198
+
1199
+
1200
+ def initialize(hash = {})
1201
+ hash = normalize_hash(hash)
1202
+ hash['data'] = WebPay::EventData.new(hash['data']) if hash['data'].is_a?(Hash)
1203
+ @attributes = hash
1204
+ end
1205
+
1206
+ # attributes accessors
1207
+ def id
1208
+ attributes['id']
1209
+ end
1210
+
1211
+ def object
1212
+ attributes['object']
1213
+ end
1214
+
1215
+ def livemode
1216
+ attributes['livemode']
1217
+ end
1218
+
1219
+ def created
1220
+ attributes['created']
1221
+ end
1222
+
1223
+ def data
1224
+ attributes['data']
1225
+ end
1226
+
1227
+ def pending_webhooks
1228
+ attributes['pending_webhooks']
1229
+ end
1230
+
1231
+ def type
1232
+ attributes['type']
1233
+ end
1234
+
1235
+ def shop
1236
+ attributes['shop']
1237
+ end
1238
+
1239
+ end
1240
+ class ListRequestWithEventType < Entity
1241
+ attr_reader :attributes
1242
+
1243
+ def self.fields
1244
+ ['count', 'offset', 'created', 'type']
1245
+ end
1246
+
1247
+
1248
+ def self.create(params)
1249
+ return params if params.is_a?(self)
1250
+ hash = case params
1251
+ when Hash; params
1252
+ else
1253
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
1254
+ end
1255
+ self.new(hash)
1256
+ end
1257
+
1258
+ def initialize(hash = {})
1259
+ hash = normalize_hash(hash)
1260
+ hash['created'] = hash['created'].is_a?(Hash) ? WebPay::CreatedRange.new(hash['created']) : hash['created']
1261
+ @attributes = hash
1262
+ end
1263
+
1264
+ # attributes accessors
1265
+ def count
1266
+ attributes['count']
1267
+ end
1268
+
1269
+
1270
+ def count=(value)
1271
+ attributes['count'] = value
1272
+ end
1273
+
1274
+ def offset
1275
+ attributes['offset']
1276
+ end
1277
+
1278
+
1279
+ def offset=(value)
1280
+ attributes['offset'] = value
1281
+ end
1282
+
1283
+ def created
1284
+ attributes['created']
1285
+ end
1286
+
1287
+
1288
+ def created=(value)
1289
+ value = value.is_a?(Hash) ? WebPay::CreatedRange.new(value) : value
1290
+ attributes['created'] = value
1291
+ end
1292
+
1293
+ def type
1294
+ attributes['type']
1295
+ end
1296
+
1297
+
1298
+ def type=(value)
1299
+ attributes['type'] = value
1300
+ end
1301
+
1302
+ end
1303
+ class EventResponseList < Entity
1304
+ attr_reader :attributes
1305
+
1306
+ def self.fields
1307
+ ['object', 'url', 'count', 'data']
1308
+ end
1309
+
1310
+
1311
+ def initialize(hash = {})
1312
+ hash = normalize_hash(hash)
1313
+ hash['data'] = hash['data'].is_a?(Array) ? hash['data'].map { |x| WebPay::EventResponse.new(x) if x.is_a?(Hash) } : hash['data']
1314
+ @attributes = hash
1315
+ end
1316
+
1317
+ # attributes accessors
1318
+ def object
1319
+ attributes['object']
1320
+ end
1321
+
1322
+ def url
1323
+ attributes['url']
1324
+ end
1325
+
1326
+ def count
1327
+ attributes['count']
1328
+ end
1329
+
1330
+ def data
1331
+ attributes['data']
1332
+ end
1333
+
1334
+ end
1335
+ class ShopRequestCreate < Entity
1336
+ attr_reader :attributes
1337
+
1338
+ def self.fields
1339
+ ['description', 'details', 'live']
1340
+ end
1341
+
1342
+
1343
+ def self.create(params)
1344
+ return params if params.is_a?(self)
1345
+ hash = case params
1346
+ when Hash; params
1347
+ else
1348
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
1349
+ end
1350
+ self.new(hash)
1351
+ end
1352
+
1353
+ def initialize(hash = {})
1354
+ hash = normalize_hash(hash)
1355
+ @attributes = hash
1356
+ end
1357
+
1358
+ # attributes accessors
1359
+ def description
1360
+ attributes['description']
1361
+ end
1362
+
1363
+
1364
+ def description=(value)
1365
+ attributes['description'] = value
1366
+ end
1367
+
1368
+ def details
1369
+ attributes['details']
1370
+ end
1371
+
1372
+
1373
+ def details=(value)
1374
+ attributes['details'] = value
1375
+ end
1376
+
1377
+ def live
1378
+ attributes['live']
1379
+ end
1380
+
1381
+
1382
+ def live=(value)
1383
+ attributes['live'] = value
1384
+ end
1385
+
1386
+ end
1387
+ class ShopResponse < Entity
1388
+ attr_reader :attributes
1389
+
1390
+ def self.fields
1391
+ ['id', 'object', 'livemode', 'status', 'description', 'access_key', 'created', 'statement_descriptor', 'card_types_supported', 'details']
1392
+ end
1393
+
1394
+
1395
+ def initialize(hash = {})
1396
+ hash = normalize_hash(hash)
1397
+ @attributes = hash
1398
+ end
1399
+
1400
+ # attributes accessors
1401
+ def id
1402
+ attributes['id']
1403
+ end
1404
+
1405
+ def object
1406
+ attributes['object']
1407
+ end
1408
+
1409
+ def livemode
1410
+ attributes['livemode']
1411
+ end
1412
+
1413
+ def status
1414
+ attributes['status']
1415
+ end
1416
+
1417
+ def description
1418
+ attributes['description']
1419
+ end
1420
+
1421
+ def access_key
1422
+ attributes['access_key']
1423
+ end
1424
+
1425
+ def created
1426
+ attributes['created']
1427
+ end
1428
+
1429
+ def statement_descriptor
1430
+ attributes['statement_descriptor']
1431
+ end
1432
+
1433
+ def card_types_supported
1434
+ attributes['card_types_supported']
1435
+ end
1436
+
1437
+ def details
1438
+ attributes['details']
1439
+ end
1440
+
1441
+ end
1442
+ class ShopIdRequest < Entity
1443
+ attr_reader :attributes
1444
+
1445
+ def self.fields
1446
+ ['id', 'live']
1447
+ end
1448
+
1449
+
1450
+ def self.create(params)
1451
+ return params if params.is_a?(self)
1452
+ hash = case params
1453
+ when Hash; params
1454
+ when WebPay::ShopResponse; {'id' => params.id}
1455
+ when String; {'id' => params}
1456
+ else
1457
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
1458
+ end
1459
+ self.new(hash)
1460
+ end
1461
+
1462
+ def initialize(hash = {})
1463
+ hash = normalize_hash(hash)
1464
+ @attributes = hash
1465
+ end
1466
+
1467
+ # attributes accessors
1468
+ def id
1469
+ attributes['id']
1470
+ end
1471
+
1472
+
1473
+ def id=(value)
1474
+ attributes['id'] = value
1475
+ end
1476
+
1477
+ def live
1478
+ attributes['live']
1479
+ end
1480
+
1481
+
1482
+ def live=(value)
1483
+ attributes['live'] = value
1484
+ end
1485
+
1486
+ end
1487
+ class ShopRequestUpdate < Entity
1488
+ attr_reader :attributes
1489
+
1490
+ def self.fields
1491
+ ['id', 'description', 'details', 'live']
1492
+ end
1493
+
1494
+
1495
+ def self.create(params)
1496
+ return params if params.is_a?(self)
1497
+ hash = case params
1498
+ when Hash; params
1499
+ when WebPay::ShopResponse; {'id' => params.id}
1500
+ when String; {'id' => params}
1501
+ else
1502
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
1503
+ end
1504
+ self.new(hash)
1505
+ end
1506
+
1507
+ def initialize(hash = {})
1508
+ hash = normalize_hash(hash)
1509
+ @attributes = hash
1510
+ end
1511
+
1512
+ # attributes accessors
1513
+ def id
1514
+ attributes['id']
1515
+ end
1516
+
1517
+
1518
+ def id=(value)
1519
+ attributes['id'] = value
1520
+ end
1521
+
1522
+ def description
1523
+ attributes['description']
1524
+ end
1525
+
1526
+
1527
+ def description=(value)
1528
+ attributes['description'] = value
1529
+ end
1530
+
1531
+ def details
1532
+ attributes['details']
1533
+ end
1534
+
1535
+
1536
+ def details=(value)
1537
+ attributes['details'] = value
1538
+ end
1539
+
1540
+ def live
1541
+ attributes['live']
1542
+ end
1543
+
1544
+
1545
+ def live=(value)
1546
+ attributes['live'] = value
1547
+ end
1548
+
1549
+ end
1550
+ class ListRequestWithLive < Entity
1551
+ attr_reader :attributes
1552
+
1553
+ def self.fields
1554
+ ['count', 'offset', 'created', 'live']
1555
+ end
1556
+
1557
+
1558
+ def self.create(params)
1559
+ return params if params.is_a?(self)
1560
+ hash = case params
1561
+ when Hash; params
1562
+ else
1563
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
1564
+ end
1565
+ self.new(hash)
1566
+ end
1567
+
1568
+ def initialize(hash = {})
1569
+ hash = normalize_hash(hash)
1570
+ hash['created'] = hash['created'].is_a?(Hash) ? WebPay::CreatedRange.new(hash['created']) : hash['created']
1571
+ @attributes = hash
1572
+ end
1573
+
1574
+ # attributes accessors
1575
+ def count
1576
+ attributes['count']
1577
+ end
1578
+
1579
+
1580
+ def count=(value)
1581
+ attributes['count'] = value
1582
+ end
1583
+
1584
+ def offset
1585
+ attributes['offset']
1586
+ end
1587
+
1588
+
1589
+ def offset=(value)
1590
+ attributes['offset'] = value
1591
+ end
1592
+
1593
+ def created
1594
+ attributes['created']
1595
+ end
1596
+
1597
+
1598
+ def created=(value)
1599
+ value = value.is_a?(Hash) ? WebPay::CreatedRange.new(value) : value
1600
+ attributes['created'] = value
1601
+ end
1602
+
1603
+ def live
1604
+ attributes['live']
1605
+ end
1606
+
1607
+
1608
+ def live=(value)
1609
+ attributes['live'] = value
1610
+ end
1611
+
1612
+ end
1613
+ class ShopResponseList < Entity
1614
+ attr_reader :attributes
1615
+
1616
+ def self.fields
1617
+ ['object', 'url', 'count', 'data']
1618
+ end
1619
+
1620
+
1621
+ def initialize(hash = {})
1622
+ hash = normalize_hash(hash)
1623
+ hash['data'] = hash['data'].is_a?(Array) ? hash['data'].map { |x| WebPay::ShopResponse.new(x) if x.is_a?(Hash) } : hash['data']
1624
+ @attributes = hash
1625
+ end
1626
+
1627
+ # attributes accessors
1628
+ def object
1629
+ attributes['object']
1630
+ end
1631
+
1632
+ def url
1633
+ attributes['url']
1634
+ end
1635
+
1636
+ def count
1637
+ attributes['count']
1638
+ end
1639
+
1640
+ def data
1641
+ attributes['data']
1642
+ end
1643
+
1644
+ end
1645
+ class RecursionRequestCreate < Entity
1646
+ attr_reader :attributes
1647
+
1648
+ def self.fields
1649
+ ['amount', 'currency', 'customer', 'period', 'description', 'shop', 'first_scheduled', 'uuid']
1650
+ end
1651
+
1652
+
1653
+ def self.create(params)
1654
+ return params if params.is_a?(self)
1655
+ hash = case params
1656
+ when Hash; params
1657
+ else
1658
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
1659
+ end
1660
+ self.new(hash)
1661
+ end
1662
+
1663
+ def initialize(hash = {})
1664
+ hash = normalize_hash(hash)
1665
+ @attributes = hash
1666
+ end
1667
+
1668
+ # attributes accessors
1669
+ def amount
1670
+ attributes['amount']
1671
+ end
1672
+
1673
+
1674
+ def amount=(value)
1675
+ attributes['amount'] = value
1676
+ end
1677
+
1678
+ def currency
1679
+ attributes['currency']
1680
+ end
1681
+
1682
+
1683
+ def currency=(value)
1684
+ attributes['currency'] = value
1685
+ end
1686
+
1687
+ def customer
1688
+ attributes['customer']
1689
+ end
1690
+
1691
+
1692
+ def customer=(value)
1693
+ attributes['customer'] = value
1694
+ end
1695
+
1696
+ def period
1697
+ attributes['period']
1698
+ end
1699
+
1700
+
1701
+ def period=(value)
1702
+ attributes['period'] = value
1703
+ end
1704
+
1705
+ def description
1706
+ attributes['description']
1707
+ end
1708
+
1709
+
1710
+ def description=(value)
1711
+ attributes['description'] = value
1712
+ end
1713
+
1714
+ def shop
1715
+ attributes['shop']
1716
+ end
1717
+
1718
+
1719
+ def shop=(value)
1720
+ attributes['shop'] = value
1721
+ end
1722
+
1723
+ def first_scheduled
1724
+ attributes['first_scheduled']
1725
+ end
1726
+
1727
+
1728
+ def first_scheduled=(value)
1729
+ attributes['first_scheduled'] = value
1730
+ end
1731
+
1732
+ def uuid
1733
+ attributes['uuid']
1734
+ end
1735
+
1736
+
1737
+ def uuid=(value)
1738
+ attributes['uuid'] = value
1739
+ end
1740
+
1741
+ end
1742
+ class RecursionIdRequest < Entity
1743
+ attr_reader :attributes
1744
+
1745
+ def self.fields
1746
+ ['id']
1747
+ end
1748
+
1749
+
1750
+ def self.create(params)
1751
+ return params if params.is_a?(self)
1752
+ hash = case params
1753
+ when Hash; params
1754
+ when WebPay::RecursionResponse; {'id' => params.id}
1755
+ when String; {'id' => params}
1756
+ else
1757
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
1758
+ end
1759
+ self.new(hash)
1760
+ end
1761
+
1762
+ def initialize(hash = {})
1763
+ hash = normalize_hash(hash)
1764
+ @attributes = hash
1765
+ end
1766
+
1767
+ # attributes accessors
1768
+ def id
1769
+ attributes['id']
1770
+ end
1771
+
1772
+
1773
+ def id=(value)
1774
+ attributes['id'] = value
1775
+ end
1776
+
1777
+ end
1778
+ class RecursionRequestResume < Entity
1779
+ attr_reader :attributes
1780
+
1781
+ def self.fields
1782
+ ['id', 'retry']
1783
+ end
1784
+
1785
+
1786
+ def self.create(params)
1787
+ return params if params.is_a?(self)
1788
+ hash = case params
1789
+ when Hash; params
1790
+ when WebPay::RecursionResponse; {'id' => params.id}
1791
+ when String; {'id' => params}
1792
+ else
1793
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
1794
+ end
1795
+ self.new(hash)
1796
+ end
1797
+
1798
+ def initialize(hash = {})
1799
+ hash = normalize_hash(hash)
1800
+ @attributes = hash
1801
+ end
1802
+
1803
+ # attributes accessors
1804
+ def id
1805
+ attributes['id']
1806
+ end
1807
+
1808
+
1809
+ def id=(value)
1810
+ attributes['id'] = value
1811
+ end
1812
+
1813
+ def retry
1814
+ attributes['retry']
1815
+ end
1816
+
1817
+
1818
+ def retry=(value)
1819
+ attributes['retry'] = value
1820
+ end
1821
+
1822
+ end
1823
+ class ListRequestWithCustomerAndSuspended < Entity
1824
+ attr_reader :attributes
1825
+
1826
+ def self.fields
1827
+ ['count', 'offset', 'created', 'customer', 'suspended']
1828
+ end
1829
+
1830
+
1831
+ def self.create(params)
1832
+ return params if params.is_a?(self)
1833
+ hash = case params
1834
+ when Hash; params
1835
+ else
1836
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
1837
+ end
1838
+ self.new(hash)
1839
+ end
1840
+
1841
+ def initialize(hash = {})
1842
+ hash = normalize_hash(hash)
1843
+ hash['created'] = hash['created'].is_a?(Hash) ? WebPay::CreatedRange.new(hash['created']) : hash['created']
1844
+ @attributes = hash
1845
+ end
1846
+
1847
+ # attributes accessors
1848
+ def count
1849
+ attributes['count']
1850
+ end
1851
+
1852
+
1853
+ def count=(value)
1854
+ attributes['count'] = value
1855
+ end
1856
+
1857
+ def offset
1858
+ attributes['offset']
1859
+ end
1860
+
1861
+
1862
+ def offset=(value)
1863
+ attributes['offset'] = value
1864
+ end
1865
+
1866
+ def created
1867
+ attributes['created']
1868
+ end
1869
+
1870
+
1871
+ def created=(value)
1872
+ value = value.is_a?(Hash) ? WebPay::CreatedRange.new(value) : value
1873
+ attributes['created'] = value
1874
+ end
1875
+
1876
+ def customer
1877
+ attributes['customer']
1878
+ end
1879
+
1880
+
1881
+ def customer=(value)
1882
+ attributes['customer'] = value
1883
+ end
1884
+
1885
+ def suspended
1886
+ attributes['suspended']
1887
+ end
1888
+
1889
+
1890
+ def suspended=(value)
1891
+ attributes['suspended'] = value
1892
+ end
1893
+
1894
+ end
1895
+ class RecursionResponseList < Entity
1896
+ attr_reader :attributes
1897
+
1898
+ def self.fields
1899
+ ['object', 'url', 'count', 'data']
1900
+ end
1901
+
1902
+
1903
+ def initialize(hash = {})
1904
+ hash = normalize_hash(hash)
1905
+ hash['data'] = hash['data'].is_a?(Array) ? hash['data'].map { |x| WebPay::RecursionResponse.new(x) if x.is_a?(Hash) } : hash['data']
1906
+ @attributes = hash
1907
+ end
1908
+
1909
+ # attributes accessors
1910
+ def object
1911
+ attributes['object']
1912
+ end
1913
+
1914
+ def url
1915
+ attributes['url']
1916
+ end
1917
+
1918
+ def count
1919
+ attributes['count']
1920
+ end
1921
+
1922
+ def data
1923
+ attributes['data']
1924
+ end
1925
+
1926
+ end
1927
+ class EmptyRequest < Entity
1928
+ attr_reader :attributes
1929
+
1930
+ def self.fields
1931
+ []
1932
+ end
1933
+
1934
+
1935
+ def self.create(params)
1936
+ return params if params.is_a?(self)
1937
+ hash = case params
1938
+ when Hash; params
1939
+ else
1940
+ raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
1941
+ end
1942
+ self.new(hash)
1943
+ end
1944
+
1945
+ def initialize(hash = {})
1946
+ hash = normalize_hash(hash)
1947
+ @attributes = hash
1948
+ end
1949
+
1950
+ # attributes accessors
1951
+ end
1952
+ class AccountResponse < Entity
1953
+ attr_reader :attributes
1954
+
1955
+ def self.fields
1956
+ ['id', 'object', 'charge_enabled', 'currencies_supported', 'details_submitted', 'email', 'statement_descriptor', 'card_types_supported']
1957
+ end
1958
+
1959
+
1960
+ def initialize(hash = {})
1961
+ hash = normalize_hash(hash)
1962
+ @attributes = hash
1963
+ end
1964
+
1965
+ # attributes accessors
1966
+ def id
1967
+ attributes['id']
1968
+ end
1969
+
1970
+ def object
1971
+ attributes['object']
1972
+ end
1973
+
1974
+ def charge_enabled
1975
+ attributes['charge_enabled']
1976
+ end
1977
+
1978
+ def currencies_supported
1979
+ attributes['currencies_supported']
1980
+ end
1981
+
1982
+ def details_submitted
1983
+ attributes['details_submitted']
1984
+ end
1985
+
1986
+ def email
1987
+ attributes['email']
1988
+ end
1989
+
1990
+ def statement_descriptor
1991
+ attributes['statement_descriptor']
1992
+ end
1993
+
1994
+ def card_types_supported
1995
+ attributes['card_types_supported']
1996
+ end
1997
+
1998
+ end
1999
+ class DeletedResponse < Entity
2000
+ attr_reader :attributes
2001
+
2002
+ def self.fields
2003
+ ['deleted']
2004
+ end
2005
+
2006
+
2007
+ def initialize(hash = {})
2008
+ hash = normalize_hash(hash)
2009
+ @attributes = hash
2010
+ end
2011
+
2012
+ # attributes accessors
2013
+ def deleted
2014
+ attributes['deleted']
2015
+ end
2016
+
2017
+ end
2018
+ class ErrorBody < Entity
2019
+ attr_reader :attributes
2020
+
2021
+ def self.fields
2022
+ ['message', 'type', 'code', 'param']
2023
+ end
2024
+
2025
+
2026
+ def initialize(hash = {})
2027
+ hash = normalize_hash(hash)
2028
+ @attributes = hash
2029
+ end
2030
+
2031
+ # attributes accessors
2032
+ def message
2033
+ attributes['message']
2034
+ end
2035
+
2036
+ def type
2037
+ attributes['type']
2038
+ end
2039
+
2040
+ def code
2041
+ attributes['code']
2042
+ end
2043
+
2044
+ def param
2045
+ attributes['param']
2046
+ end
2047
+
2048
+ end
2049
+ class ErrorData < Entity
2050
+ attr_reader :attributes
2051
+
2052
+ def self.fields
2053
+ ['error']
2054
+ end
2055
+
2056
+
2057
+ def initialize(hash = {})
2058
+ hash = normalize_hash(hash)
2059
+ hash['error'] = WebPay::ErrorBody.new(hash['error']) if hash['error'].is_a?(Hash)
2060
+ @attributes = hash
2061
+ end
2062
+
2063
+ # attributes accessors
2064
+ def error
2065
+ attributes['error']
2066
+ end
2067
+
2068
+ end
2069
+ end