webpay 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1223d7691b96e04b2b402559469879005904b623
4
- data.tar.gz: 06adb123e708121a8344bb27195fc08f0689c5f1
3
+ metadata.gz: 3b9b26edd82d7f002e5f36526c8ab154add38e73
4
+ data.tar.gz: f1b94bd1d186e498df8d02f392dfa812af490a8d
5
5
  SHA512:
6
- metadata.gz: 849b139e4d784eda4c838c22bc3c9cdc6a08ad023b45f8b6a27d9b9e6b9b763164f5285bcc22b92963be2400595e61fe04d7a880c8d791a0752368c558440931
7
- data.tar.gz: a09359f1a3229ddc265df98040b78efd90032f4b5b76aef9574ffc178dfe69c97a79b57007fd2e16e3ecb564824e2a9607be987f88ac2541028745ad6908d14b
6
+ metadata.gz: 2580bf9f090e2691f4c2f97cadeb72449fbdf5c3e4405dd41955f0488d4df2720678ab59386ce6f20aa0dab020cdba6768a4cc343fb28d94379bec6a10e4ffd9
7
+ data.tar.gz: a8fd487fa7a2addeccae5129e5dce8c15054e6d55ccb022c008dcc2a763b154e7d432b14efae9be401891d2f03763bcc621123834fee6aa4d81441f394397651
@@ -5,7 +5,7 @@ class WebPay::Account < WebPay::ApiResource
5
5
  # @return [AccountResponse]
6
6
  def retrieve(params = {})
7
7
  req = WebPay::EmptyRequest.create(params)
8
- raw_response = @client.request(:get, 'account', req)
8
+ raw_response = @client._request(:get, 'account', req)
9
9
  WebPay::AccountResponse.new(raw_response)
10
10
  end
11
11
 
@@ -15,7 +15,7 @@ class WebPay::Account < WebPay::ApiResource
15
15
  # @return [DeletedResponse]
16
16
  def delete_data(params = {})
17
17
  req = WebPay::EmptyRequest.create(params)
18
- raw_response = @client.request(:delete, 'account/data', req)
18
+ raw_response = @client._request(:delete, 'account/data', req)
19
19
  WebPay::DeletedResponse.new(raw_response)
20
20
  end
21
21
 
data/lib/webpay/charge.rb CHANGED
@@ -6,7 +6,7 @@ class WebPay::Charge < WebPay::ApiResource
6
6
  # @return [ChargeResponse]
7
7
  def create(params = {})
8
8
  req = WebPay::ChargeRequestCreate.create(params)
9
- raw_response = @client.request(:post, 'charges', req)
9
+ raw_response = @client._request(:post, 'charges', req)
10
10
  WebPay::ChargeResponse.new(raw_response)
11
11
  end
12
12
 
@@ -16,7 +16,7 @@ class WebPay::Charge < WebPay::ApiResource
16
16
  # @return [ChargeResponse]
17
17
  def retrieve(params = {})
18
18
  req = WebPay::ChargeIdRequest.create(params)
19
- raw_response = @client.request(:get, 'charges/:id', req)
19
+ raw_response = @client._request(:get, 'charges/:id', req)
20
20
  WebPay::ChargeResponse.new(raw_response)
21
21
  end
22
22
 
@@ -27,7 +27,7 @@ class WebPay::Charge < WebPay::ApiResource
27
27
  # @return [ChargeResponse]
28
28
  def refund(params = {})
29
29
  req = WebPay::ChargeRequestWithAmount.create(params)
30
- raw_response = @client.request(:post, 'charges/:id/refund', req)
30
+ raw_response = @client._request(:post, 'charges/:id/refund', req)
31
31
  WebPay::ChargeResponse.new(raw_response)
32
32
  end
33
33
 
@@ -37,7 +37,7 @@ class WebPay::Charge < WebPay::ApiResource
37
37
  # @return [ChargeResponse]
38
38
  def capture(params = {})
39
39
  req = WebPay::ChargeRequestWithAmount.create(params)
40
- raw_response = @client.request(:post, 'charges/:id/capture', req)
40
+ raw_response = @client._request(:post, 'charges/:id/capture', req)
41
41
  WebPay::ChargeResponse.new(raw_response)
42
42
  end
43
43
 
@@ -47,7 +47,7 @@ class WebPay::Charge < WebPay::ApiResource
47
47
  # @return [ChargeResponseList]
48
48
  def all(params = {})
49
49
  req = WebPay::ChargeListRequest.create(params)
50
- raw_response = @client.request(:get, 'charges', req)
50
+ raw_response = @client._request(:get, 'charges', req)
51
51
  WebPay::ChargeResponseList.new(raw_response)
52
52
  end
53
53
 
@@ -5,7 +5,7 @@ class WebPay::Customer < WebPay::ApiResource
5
5
  # @return [CustomerResponse]
6
6
  def create(params = {})
7
7
  req = WebPay::CustomerRequestCreate.create(params)
8
- raw_response = @client.request(:post, 'customers', req)
8
+ raw_response = @client._request(:post, 'customers', req)
9
9
  WebPay::CustomerResponse.new(raw_response)
10
10
  end
11
11
 
@@ -16,7 +16,7 @@ class WebPay::Customer < WebPay::ApiResource
16
16
  # @return [CustomerResponse]
17
17
  def retrieve(params = {})
18
18
  req = WebPay::CustomerIdRequest.create(params)
19
- raw_response = @client.request(:get, 'customers/:id', req)
19
+ raw_response = @client._request(:get, 'customers/:id', req)
20
20
  WebPay::CustomerResponse.new(raw_response)
21
21
  end
22
22
 
@@ -26,7 +26,7 @@ class WebPay::Customer < WebPay::ApiResource
26
26
  # @return [CustomerResponse]
27
27
  def update(params = {})
28
28
  req = WebPay::CustomerRequestUpdate.create(params)
29
- raw_response = @client.request(:post, 'customers/:id', req)
29
+ raw_response = @client._request(:post, 'customers/:id', req)
30
30
  WebPay::CustomerResponse.new(raw_response)
31
31
  end
32
32
 
@@ -36,7 +36,7 @@ class WebPay::Customer < WebPay::ApiResource
36
36
  # @return [CustomerResponse]
37
37
  def delete(params = {})
38
38
  req = WebPay::CustomerIdRequest.create(params)
39
- raw_response = @client.request(:delete, 'customers/:id', req)
39
+ raw_response = @client._request(:delete, 'customers/:id', req)
40
40
  WebPay::CustomerResponse.new(raw_response)
41
41
  end
42
42
 
@@ -46,7 +46,7 @@ class WebPay::Customer < WebPay::ApiResource
46
46
  # @return [CustomerResponseList]
47
47
  def all(params = {})
48
48
  req = WebPay::BasicListRequest.create(params)
49
- raw_response = @client.request(:get, 'customers', req)
49
+ raw_response = @client._request(:get, 'customers', req)
50
50
  WebPay::CustomerResponseList.new(raw_response)
51
51
  end
52
52
 
@@ -56,7 +56,7 @@ class WebPay::Customer < WebPay::ApiResource
56
56
  # @return [CustomerResponse]
57
57
  def delete_active_card(params = {})
58
58
  req = WebPay::CustomerIdRequest.create(params)
59
- raw_response = @client.request(:delete, 'customers/:id/active_card', req)
59
+ raw_response = @client._request(:delete, 'customers/:id/active_card', req)
60
60
  WebPay::CustomerResponse.new(raw_response)
61
61
  end
62
62
 
@@ -27,6 +27,13 @@ class WebPay
27
27
  end
28
28
 
29
29
  alias_method :inspect, :to_s
30
+
31
+ private
32
+ def copy_if_exists(from, to, key, recurring_fun)
33
+ v = from[key]
34
+ return if v == nil
35
+ to[key] = v.respond_to?(recurring_fun) ? v.__send__(recurring_fun) : v
36
+ end
30
37
  end
31
38
 
32
39
  class CardRequest < Entity
@@ -52,6 +59,28 @@ class WebPay
52
59
  @attributes = hash
53
60
  end
54
61
 
62
+
63
+ def request_body
64
+ result = {}
65
+
66
+ copy_if_exists(@attributes, result, 'number', 'request_body');
67
+
68
+ copy_if_exists(@attributes, result, 'exp_month', 'request_body');
69
+
70
+ copy_if_exists(@attributes, result, 'exp_year', 'request_body');
71
+
72
+ copy_if_exists(@attributes, result, 'cvc', 'request_body');
73
+
74
+ copy_if_exists(@attributes, result, 'name', 'request_body');
75
+ result
76
+ end
77
+
78
+ def query_params
79
+ result = {}
80
+ return result
81
+ end
82
+
83
+
55
84
  # attributes accessors
56
85
  def number
57
86
  attributes['number']
@@ -123,6 +152,36 @@ class WebPay
123
152
  @attributes = hash
124
153
  end
125
154
 
155
+
156
+ def request_body
157
+ result = {}
158
+
159
+ copy_if_exists(@attributes, result, 'amount', 'request_body');
160
+
161
+ copy_if_exists(@attributes, result, 'currency', 'request_body');
162
+
163
+ copy_if_exists(@attributes, result, 'customer', 'request_body');
164
+
165
+ copy_if_exists(@attributes, result, 'shop', 'request_body');
166
+
167
+ copy_if_exists(@attributes, result, 'card', 'request_body');
168
+
169
+ copy_if_exists(@attributes, result, 'description', 'request_body');
170
+
171
+ copy_if_exists(@attributes, result, 'capture', 'request_body');
172
+
173
+ copy_if_exists(@attributes, result, 'expire_days', 'request_body');
174
+
175
+ copy_if_exists(@attributes, result, 'uuid', 'request_body');
176
+ result
177
+ end
178
+
179
+ def query_params
180
+ result = {}
181
+ return result
182
+ end
183
+
184
+
126
185
  # attributes accessors
127
186
  def amount
128
187
  attributes['amount']
@@ -220,6 +279,8 @@ class WebPay
220
279
  @attributes = hash
221
280
  end
222
281
 
282
+
283
+
223
284
  # attributes accessors
224
285
  def object
225
286
  attributes['object']
@@ -271,6 +332,8 @@ class WebPay
271
332
  @attributes = hash
272
333
  end
273
334
 
335
+
336
+
274
337
  # attributes accessors
275
338
  def object
276
339
  attributes['object']
@@ -312,6 +375,8 @@ class WebPay
312
375
  @attributes = hash
313
376
  end
314
377
 
378
+
379
+
315
380
  # attributes accessors
316
381
  def id
317
382
  attributes['id']
@@ -411,6 +476,18 @@ class WebPay
411
476
  @attributes = hash
412
477
  end
413
478
 
479
+
480
+ def request_body
481
+ result = {}
482
+ result
483
+ end
484
+
485
+ def query_params
486
+ result = {}
487
+ return result
488
+ end
489
+
490
+
414
491
  # attributes accessors
415
492
  def id
416
493
  attributes['id']
@@ -447,6 +524,20 @@ class WebPay
447
524
  @attributes = hash
448
525
  end
449
526
 
527
+
528
+ def request_body
529
+ result = {}
530
+
531
+ copy_if_exists(@attributes, result, 'amount', 'request_body');
532
+ result
533
+ end
534
+
535
+ def query_params
536
+ result = {}
537
+ return result
538
+ end
539
+
540
+
450
541
  # attributes accessors
451
542
  def id
452
543
  attributes['id']
@@ -490,6 +581,26 @@ class WebPay
490
581
  @attributes = hash
491
582
  end
492
583
 
584
+
585
+ def request_body
586
+ result = {}
587
+
588
+ copy_if_exists(@attributes, result, 'gt', 'request_body');
589
+
590
+ copy_if_exists(@attributes, result, 'gte', 'request_body');
591
+
592
+ copy_if_exists(@attributes, result, 'lt', 'request_body');
593
+
594
+ copy_if_exists(@attributes, result, 'lte', 'request_body');
595
+ result
596
+ end
597
+
598
+ def query_params
599
+ result = {}
600
+ return result
601
+ end
602
+
603
+
493
604
  # attributes accessors
494
605
  def gt
495
606
  attributes['gt']
@@ -552,6 +663,30 @@ class WebPay
552
663
  @attributes = hash
553
664
  end
554
665
 
666
+
667
+ def request_body
668
+ result = {}
669
+ result
670
+ end
671
+
672
+ def query_params
673
+ result = {}
674
+
675
+ copy_if_exists(@attributes, result, 'count', 'query_params');
676
+
677
+ copy_if_exists(@attributes, result, 'offset', 'query_params');
678
+
679
+ copy_if_exists(@attributes, result, 'created', 'query_params');
680
+
681
+ copy_if_exists(@attributes, result, 'customer', 'query_params');
682
+
683
+ copy_if_exists(@attributes, result, 'recursion', 'query_params');
684
+
685
+ copy_if_exists(@attributes, result, 'shop', 'query_params');
686
+ return result
687
+ end
688
+
689
+
555
690
  # attributes accessors
556
691
  def count
557
692
  attributes['count']
@@ -623,6 +758,8 @@ class WebPay
623
758
  @attributes = hash
624
759
  end
625
760
 
761
+
762
+
626
763
  # attributes accessors
627
764
  def object
628
765
  attributes['object']
@@ -665,6 +802,26 @@ class WebPay
665
802
  @attributes = hash
666
803
  end
667
804
 
805
+
806
+ def request_body
807
+ result = {}
808
+
809
+ copy_if_exists(@attributes, result, 'card', 'request_body');
810
+
811
+ copy_if_exists(@attributes, result, 'description', 'request_body');
812
+
813
+ copy_if_exists(@attributes, result, 'email', 'request_body');
814
+
815
+ copy_if_exists(@attributes, result, 'uuid', 'request_body');
816
+ result
817
+ end
818
+
819
+ def query_params
820
+ result = {}
821
+ return result
822
+ end
823
+
824
+
668
825
  # attributes accessors
669
826
  def card
670
827
  attributes['card']
@@ -718,6 +875,8 @@ class WebPay
718
875
  @attributes = hash
719
876
  end
720
877
 
878
+
879
+
721
880
  # attributes accessors
722
881
  def id
723
882
  attributes['id']
@@ -792,6 +951,8 @@ class WebPay
792
951
  @attributes = hash
793
952
  end
794
953
 
954
+
955
+
795
956
  # attributes accessors
796
957
  def id
797
958
  attributes['id']
@@ -855,6 +1016,18 @@ class WebPay
855
1016
  @attributes = hash
856
1017
  end
857
1018
 
1019
+
1020
+ def request_body
1021
+ result = {}
1022
+ result
1023
+ end
1024
+
1025
+ def query_params
1026
+ result = {}
1027
+ return result
1028
+ end
1029
+
1030
+
858
1031
  # attributes accessors
859
1032
  def id
860
1033
  attributes['id']
@@ -892,6 +1065,24 @@ class WebPay
892
1065
  @attributes = hash
893
1066
  end
894
1067
 
1068
+
1069
+ def request_body
1070
+ result = {}
1071
+
1072
+ copy_if_exists(@attributes, result, 'card', 'request_body');
1073
+
1074
+ copy_if_exists(@attributes, result, 'description', 'request_body');
1075
+
1076
+ copy_if_exists(@attributes, result, 'email', 'request_body');
1077
+ result
1078
+ end
1079
+
1080
+ def query_params
1081
+ result = {}
1082
+ return result
1083
+ end
1084
+
1085
+
895
1086
  # attributes accessors
896
1087
  def id
897
1088
  attributes['id']
@@ -955,6 +1146,24 @@ class WebPay
955
1146
  @attributes = hash
956
1147
  end
957
1148
 
1149
+
1150
+ def request_body
1151
+ result = {}
1152
+ result
1153
+ end
1154
+
1155
+ def query_params
1156
+ result = {}
1157
+
1158
+ copy_if_exists(@attributes, result, 'count', 'query_params');
1159
+
1160
+ copy_if_exists(@attributes, result, 'offset', 'query_params');
1161
+
1162
+ copy_if_exists(@attributes, result, 'created', 'query_params');
1163
+ return result
1164
+ end
1165
+
1166
+
958
1167
  # attributes accessors
959
1168
  def count
960
1169
  attributes['count']
@@ -999,6 +1208,8 @@ class WebPay
999
1208
  @attributes = hash
1000
1209
  end
1001
1210
 
1211
+
1212
+
1002
1213
  # attributes accessors
1003
1214
  def object
1004
1215
  attributes['object']
@@ -1042,6 +1253,22 @@ class WebPay
1042
1253
  @attributes = hash
1043
1254
  end
1044
1255
 
1256
+
1257
+ def request_body
1258
+ result = {}
1259
+
1260
+ copy_if_exists(@attributes, result, 'card', 'request_body');
1261
+
1262
+ copy_if_exists(@attributes, result, 'uuid', 'request_body');
1263
+ result
1264
+ end
1265
+
1266
+ def query_params
1267
+ result = {}
1268
+ return result
1269
+ end
1270
+
1271
+
1045
1272
  # attributes accessors
1046
1273
  def card
1047
1274
  attributes['card']
@@ -1077,6 +1304,8 @@ class WebPay
1077
1304
  @attributes = hash
1078
1305
  end
1079
1306
 
1307
+
1308
+
1080
1309
  # attributes accessors
1081
1310
  def id
1082
1311
  attributes['id']
@@ -1128,6 +1357,18 @@ class WebPay
1128
1357
  @attributes = hash
1129
1358
  end
1130
1359
 
1360
+
1361
+ def request_body
1362
+ result = {}
1363
+ result
1364
+ end
1365
+
1366
+ def query_params
1367
+ result = {}
1368
+ return result
1369
+ end
1370
+
1371
+
1131
1372
  # attributes accessors
1132
1373
  def id
1133
1374
  attributes['id']
@@ -1164,6 +1405,18 @@ class WebPay
1164
1405
  @attributes = hash
1165
1406
  end
1166
1407
 
1408
+
1409
+ def request_body
1410
+ result = {}
1411
+ result
1412
+ end
1413
+
1414
+ def query_params
1415
+ result = {}
1416
+ return result
1417
+ end
1418
+
1419
+
1167
1420
  # attributes accessors
1168
1421
  def id
1169
1422
  attributes['id']
@@ -1197,6 +1450,8 @@ class WebPay
1197
1450
  @attributes = hash
1198
1451
  end
1199
1452
 
1453
+
1454
+
1200
1455
  # attributes accessors
1201
1456
  def object
1202
1457
  attributes['object']
@@ -1221,6 +1476,8 @@ class WebPay
1221
1476
  @attributes = hash
1222
1477
  end
1223
1478
 
1479
+
1480
+
1224
1481
  # attributes accessors
1225
1482
  def id
1226
1483
  attributes['id']
@@ -1279,6 +1536,28 @@ class WebPay
1279
1536
  @attributes = hash
1280
1537
  end
1281
1538
 
1539
+
1540
+ def request_body
1541
+ result = {}
1542
+ result
1543
+ end
1544
+
1545
+ def query_params
1546
+ result = {}
1547
+
1548
+ copy_if_exists(@attributes, result, 'count', 'query_params');
1549
+
1550
+ copy_if_exists(@attributes, result, 'offset', 'query_params');
1551
+
1552
+ copy_if_exists(@attributes, result, 'created', 'query_params');
1553
+
1554
+ copy_if_exists(@attributes, result, 'type', 'query_params');
1555
+
1556
+ copy_if_exists(@attributes, result, 'shop', 'query_params');
1557
+ return result
1558
+ end
1559
+
1560
+
1282
1561
  # attributes accessors
1283
1562
  def count
1284
1563
  attributes['count']
@@ -1341,6 +1620,8 @@ class WebPay
1341
1620
  @attributes = hash
1342
1621
  end
1343
1622
 
1623
+
1624
+
1344
1625
  # attributes accessors
1345
1626
  def object
1346
1627
  attributes['object']
@@ -1382,6 +1663,22 @@ class WebPay
1382
1663
  @attributes = hash
1383
1664
  end
1384
1665
 
1666
+
1667
+ def request_body
1668
+ result = {}
1669
+
1670
+ copy_if_exists(@attributes, result, 'description', 'request_body');
1671
+
1672
+ copy_if_exists(@attributes, result, 'details', 'request_body');
1673
+ result
1674
+ end
1675
+
1676
+ def query_params
1677
+ result = {}
1678
+ return result
1679
+ end
1680
+
1681
+
1385
1682
  # attributes accessors
1386
1683
  def description
1387
1684
  attributes['description']
@@ -1415,6 +1712,8 @@ class WebPay
1415
1712
  @attributes = hash
1416
1713
  end
1417
1714
 
1715
+
1716
+
1418
1717
  # attributes accessors
1419
1718
  def id
1420
1719
  attributes['id']
@@ -1482,6 +1781,18 @@ class WebPay
1482
1781
  @attributes = hash
1483
1782
  end
1484
1783
 
1784
+
1785
+ def request_body
1786
+ result = {}
1787
+ result
1788
+ end
1789
+
1790
+ def query_params
1791
+ result = {}
1792
+ return result
1793
+ end
1794
+
1795
+
1485
1796
  # attributes accessors
1486
1797
  def id
1487
1798
  attributes['id']
@@ -1518,6 +1829,22 @@ class WebPay
1518
1829
  @attributes = hash
1519
1830
  end
1520
1831
 
1832
+
1833
+ def request_body
1834
+ result = {}
1835
+
1836
+ copy_if_exists(@attributes, result, 'description', 'request_body');
1837
+
1838
+ copy_if_exists(@attributes, result, 'details', 'request_body');
1839
+ result
1840
+ end
1841
+
1842
+ def query_params
1843
+ result = {}
1844
+ return result
1845
+ end
1846
+
1847
+
1521
1848
  # attributes accessors
1522
1849
  def id
1523
1850
  attributes['id']
@@ -1561,6 +1888,8 @@ class WebPay
1561
1888
  @attributes = hash
1562
1889
  end
1563
1890
 
1891
+
1892
+
1564
1893
  # attributes accessors
1565
1894
  def object
1566
1895
  attributes['object']
@@ -1602,6 +1931,34 @@ class WebPay
1602
1931
  @attributes = hash
1603
1932
  end
1604
1933
 
1934
+
1935
+ def request_body
1936
+ result = {}
1937
+
1938
+ copy_if_exists(@attributes, result, 'amount', 'request_body');
1939
+
1940
+ copy_if_exists(@attributes, result, 'currency', 'request_body');
1941
+
1942
+ copy_if_exists(@attributes, result, 'customer', 'request_body');
1943
+
1944
+ copy_if_exists(@attributes, result, 'period', 'request_body');
1945
+
1946
+ copy_if_exists(@attributes, result, 'description', 'request_body');
1947
+
1948
+ copy_if_exists(@attributes, result, 'shop', 'request_body');
1949
+
1950
+ copy_if_exists(@attributes, result, 'first_scheduled', 'request_body');
1951
+
1952
+ copy_if_exists(@attributes, result, 'uuid', 'request_body');
1953
+ result
1954
+ end
1955
+
1956
+ def query_params
1957
+ result = {}
1958
+ return result
1959
+ end
1960
+
1961
+
1605
1962
  # attributes accessors
1606
1963
  def amount
1607
1964
  attributes['amount']
@@ -1701,6 +2058,18 @@ class WebPay
1701
2058
  @attributes = hash
1702
2059
  end
1703
2060
 
2061
+
2062
+ def request_body
2063
+ result = {}
2064
+ result
2065
+ end
2066
+
2067
+ def query_params
2068
+ result = {}
2069
+ return result
2070
+ end
2071
+
2072
+
1704
2073
  # attributes accessors
1705
2074
  def id
1706
2075
  attributes['id']
@@ -1737,6 +2106,20 @@ class WebPay
1737
2106
  @attributes = hash
1738
2107
  end
1739
2108
 
2109
+
2110
+ def request_body
2111
+ result = {}
2112
+
2113
+ copy_if_exists(@attributes, result, 'retry', 'request_body');
2114
+ result
2115
+ end
2116
+
2117
+ def query_params
2118
+ result = {}
2119
+ return result
2120
+ end
2121
+
2122
+
1740
2123
  # attributes accessors
1741
2124
  def id
1742
2125
  attributes['id']
@@ -1781,6 +2164,30 @@ class WebPay
1781
2164
  @attributes = hash
1782
2165
  end
1783
2166
 
2167
+
2168
+ def request_body
2169
+ result = {}
2170
+ result
2171
+ end
2172
+
2173
+ def query_params
2174
+ result = {}
2175
+
2176
+ copy_if_exists(@attributes, result, 'count', 'query_params');
2177
+
2178
+ copy_if_exists(@attributes, result, 'offset', 'query_params');
2179
+
2180
+ copy_if_exists(@attributes, result, 'created', 'query_params');
2181
+
2182
+ copy_if_exists(@attributes, result, 'customer', 'query_params');
2183
+
2184
+ copy_if_exists(@attributes, result, 'shop', 'query_params');
2185
+
2186
+ copy_if_exists(@attributes, result, 'suspended', 'query_params');
2187
+ return result
2188
+ end
2189
+
2190
+
1784
2191
  # attributes accessors
1785
2192
  def count
1786
2193
  attributes['count']
@@ -1852,6 +2259,8 @@ class WebPay
1852
2259
  @attributes = hash
1853
2260
  end
1854
2261
 
2262
+
2263
+
1855
2264
  # attributes accessors
1856
2265
  def object
1857
2266
  attributes['object']
@@ -1893,6 +2302,18 @@ class WebPay
1893
2302
  @attributes = hash
1894
2303
  end
1895
2304
 
2305
+
2306
+ def request_body
2307
+ result = {}
2308
+ result
2309
+ end
2310
+
2311
+ def query_params
2312
+ result = {}
2313
+ return result
2314
+ end
2315
+
2316
+
1896
2317
  # attributes accessors
1897
2318
  end
1898
2319
  class AccountResponse < Entity
@@ -1908,6 +2329,8 @@ class WebPay
1908
2329
  @attributes = hash
1909
2330
  end
1910
2331
 
2332
+
2333
+
1911
2334
  # attributes accessors
1912
2335
  def id
1913
2336
  attributes['id']
@@ -1955,6 +2378,8 @@ class WebPay
1955
2378
  @attributes = hash
1956
2379
  end
1957
2380
 
2381
+
2382
+
1958
2383
  # attributes accessors
1959
2384
  def deleted
1960
2385
  attributes['deleted']
@@ -1965,7 +2390,7 @@ class WebPay
1965
2390
  attr_reader :attributes
1966
2391
 
1967
2392
  def self.fields
1968
- ['message', 'type', 'code', 'param']
2393
+ ['message', 'type', 'code', 'param', 'charge']
1969
2394
  end
1970
2395
 
1971
2396
 
@@ -1974,6 +2399,8 @@ class WebPay
1974
2399
  @attributes = hash
1975
2400
  end
1976
2401
 
2402
+
2403
+
1977
2404
  # attributes accessors
1978
2405
  def message
1979
2406
  attributes['message']
@@ -1991,6 +2418,10 @@ class WebPay
1991
2418
  attributes['param']
1992
2419
  end
1993
2420
 
2421
+ def charge
2422
+ attributes['charge']
2423
+ end
2424
+
1994
2425
  end
1995
2426
  class ErrorData < Entity
1996
2427
  attr_reader :attributes
@@ -2006,6 +2437,8 @@ class WebPay
2006
2437
  @attributes = hash
2007
2438
  end
2008
2439
 
2440
+
2441
+
2009
2442
  # attributes accessors
2010
2443
  def error
2011
2444
  attributes['error']
data/lib/webpay/event.rb CHANGED
@@ -5,7 +5,7 @@ class WebPay::Event < WebPay::ApiResource
5
5
  # @return [EventResponse]
6
6
  def retrieve(params = {})
7
7
  req = WebPay::EventIdRequest.create(params)
8
- raw_response = @client.request(:get, 'events/:id', req)
8
+ raw_response = @client._request(:get, 'events/:id', req)
9
9
  WebPay::EventResponse.new(raw_response)
10
10
  end
11
11
 
@@ -15,7 +15,7 @@ class WebPay::Event < WebPay::ApiResource
15
15
  # @return [EventResponseList]
16
16
  def all(params = {})
17
17
  req = WebPay::EventListRequest.create(params)
18
- raw_response = @client.request(:get, 'events', req)
18
+ raw_response = @client._request(:get, 'events', req)
19
19
  WebPay::EventResponseList.new(raw_response)
20
20
  end
21
21
 
@@ -5,7 +5,7 @@ class WebPay::Recursion < WebPay::ApiResource
5
5
  # @return [RecursionResponse]
6
6
  def create(params = {})
7
7
  req = WebPay::RecursionRequestCreate.create(params)
8
- raw_response = @client.request(:post, 'recursions', req)
8
+ raw_response = @client._request(:post, 'recursions', req)
9
9
  WebPay::RecursionResponse.new(raw_response)
10
10
  end
11
11
 
@@ -16,7 +16,7 @@ class WebPay::Recursion < WebPay::ApiResource
16
16
  # @return [RecursionResponse]
17
17
  def retrieve(params = {})
18
18
  req = WebPay::RecursionIdRequest.create(params)
19
- raw_response = @client.request(:get, 'recursions/:id', req)
19
+ raw_response = @client._request(:get, 'recursions/:id', req)
20
20
  WebPay::RecursionResponse.new(raw_response)
21
21
  end
22
22
 
@@ -26,7 +26,7 @@ class WebPay::Recursion < WebPay::ApiResource
26
26
  # @return [RecursionResponse]
27
27
  def resume(params = {})
28
28
  req = WebPay::RecursionRequestResume.create(params)
29
- raw_response = @client.request(:post, 'recursions/:id/resume', req)
29
+ raw_response = @client._request(:post, 'recursions/:id/resume', req)
30
30
  WebPay::RecursionResponse.new(raw_response)
31
31
  end
32
32
 
@@ -36,7 +36,7 @@ class WebPay::Recursion < WebPay::ApiResource
36
36
  # @return [RecursionResponse]
37
37
  def delete(params = {})
38
38
  req = WebPay::RecursionIdRequest.create(params)
39
- raw_response = @client.request(:delete, 'recursions/:id', req)
39
+ raw_response = @client._request(:delete, 'recursions/:id', req)
40
40
  WebPay::RecursionResponse.new(raw_response)
41
41
  end
42
42
 
@@ -46,7 +46,7 @@ class WebPay::Recursion < WebPay::ApiResource
46
46
  # @return [RecursionResponseList]
47
47
  def all(params = {})
48
48
  req = WebPay::RecursionListRequest.create(params)
49
- raw_response = @client.request(:get, 'recursions', req)
49
+ raw_response = @client._request(:get, 'recursions', req)
50
50
  WebPay::RecursionResponseList.new(raw_response)
51
51
  end
52
52
 
data/lib/webpay/shop.rb CHANGED
@@ -5,7 +5,7 @@ class WebPay::Shop < WebPay::ApiResource
5
5
  # @return [ShopResponse]
6
6
  def create(params = {})
7
7
  req = WebPay::ShopRequestCreate.create(params)
8
- raw_response = @client.request(:post, 'shops', req)
8
+ raw_response = @client._request(:post, 'shops', req)
9
9
  WebPay::ShopResponse.new(raw_response)
10
10
  end
11
11
 
@@ -15,7 +15,7 @@ class WebPay::Shop < WebPay::ApiResource
15
15
  # @return [ShopResponse]
16
16
  def retrieve(params = {})
17
17
  req = WebPay::ShopIdRequest.create(params)
18
- raw_response = @client.request(:get, 'shops/:id', req)
18
+ raw_response = @client._request(:get, 'shops/:id', req)
19
19
  WebPay::ShopResponse.new(raw_response)
20
20
  end
21
21
 
@@ -25,7 +25,7 @@ class WebPay::Shop < WebPay::ApiResource
25
25
  # @return [ShopResponse]
26
26
  def update(params = {})
27
27
  req = WebPay::ShopRequestUpdate.create(params)
28
- raw_response = @client.request(:post, 'shops/:id', req)
28
+ raw_response = @client._request(:post, 'shops/:id', req)
29
29
  WebPay::ShopResponse.new(raw_response)
30
30
  end
31
31
 
@@ -35,7 +35,7 @@ class WebPay::Shop < WebPay::ApiResource
35
35
  # @return [ShopResponseList]
36
36
  def all(params = {})
37
37
  req = WebPay::BasicListRequest.create(params)
38
- raw_response = @client.request(:get, 'shops', req)
38
+ raw_response = @client._request(:get, 'shops', req)
39
39
  WebPay::ShopResponseList.new(raw_response)
40
40
  end
41
41
 
data/lib/webpay/token.rb CHANGED
@@ -5,7 +5,7 @@ class WebPay::Token < WebPay::ApiResource
5
5
  # @return [TokenResponse]
6
6
  def create(params = {})
7
7
  req = WebPay::TokenRequestCreate.create(params)
8
- raw_response = @client.request(:post, 'tokens', req)
8
+ raw_response = @client._request(:post, 'tokens', req)
9
9
  WebPay::TokenResponse.new(raw_response)
10
10
  end
11
11
 
@@ -15,7 +15,7 @@ class WebPay::Token < WebPay::ApiResource
15
15
  # @return [TokenResponse]
16
16
  def retrieve(params = {})
17
17
  req = WebPay::TokenIdRequest.create(params)
18
- raw_response = @client.request(:get, 'tokens/:id', req)
18
+ raw_response = @client._request(:get, 'tokens/:id', req)
19
19
  WebPay::TokenResponse.new(raw_response)
20
20
  end
21
21
 
data/lib/webpay.rb CHANGED
@@ -25,9 +25,13 @@ class WebPay
25
25
 
26
26
  connection_options = options['faraday_options'] || {}
27
27
  connection_options['headers'] = {
28
+
28
29
  "Content-Type" => "application/json",
30
+
29
31
  "Accept" => "application/json",
30
- "User-Agent" => "Apipa-webpay/3.0.1 ruby",
32
+
33
+ "User-Agent" => "Apipa-webpay/3.0.2 ruby",
34
+
31
35
  "Accept-Language" => "en",
32
36
  }
33
37
  connection_options['url'] = options['api_base'] || 'https://api.webpay.jp/v1'
@@ -52,6 +56,37 @@ class WebPay
52
56
  @conn.headers['Accept-Language'] = value
53
57
  end
54
58
 
59
+ def _request(method, url_pattern ,param_data)
60
+ url = url_pattern.gsub(/:([[:alnum:]]+)/) { |name| param_data.__send__(name[1..-1]) }
61
+ begin
62
+ response = @conn.__send__(method) do |req|
63
+ req.url(url)
64
+ req.params = param_data.query_params
65
+ req.body = JSON.dump(param_data.request_body)
66
+ end
67
+ rescue Faraday::Error::ClientError, URI::InvalidURIError => e
68
+ raise WebPay::ApiConnectionError.in_request(e)
69
+ end
70
+ handle_response(response)
71
+ end
72
+
73
+ private
74
+
75
+ # Infer encoding from response
76
+ #
77
+ # @param response [Faraday::Response]
78
+ # @return [Encoding]
79
+ def infer_encoding(response)
80
+ unless (type = response.headers['content-type']) &&
81
+ (charset = type.split(';').find { |field| field.include?('charset=') })
82
+ return Encoding.default_external
83
+ end
84
+
85
+ encoding_string = charset.split('=', 2).last.strip
86
+ Encoding.find(encoding_string)
87
+ rescue
88
+ Encoding.default_external
89
+ end
55
90
 
56
91
  # Convert faraday response to a hash by decoding JSON.
57
92
  # This raises error if the response indicates error status.
@@ -90,34 +125,6 @@ class WebPay
90
125
  raise "Unknown error is returned"
91
126
  end
92
127
  end
93
-
94
- def request(method, url_pattern ,params)
95
- url = url_pattern.gsub(/:([[:alnum:]]+)/) { |name| params.__send__(name[1..-1]) }
96
- begin
97
- response = @conn.__send__(method, url, [:get, :delete].include?(method) ? params.to_h : JSON.dump(params.to_h))
98
- rescue Faraday::Error::ClientError, URI::InvalidURIError => e
99
- raise WebPay::ApiConnectionError.in_request(e)
100
- end
101
- handle_response(response)
102
- end
103
-
104
- private
105
-
106
- # Infer encoding from response
107
- #
108
- # @param response [Faraday::Response]
109
- # @return [Encoding]
110
- def infer_encoding(response)
111
- unless (type = response.headers['content-type']) &&
112
- (charset = type.split(';').find { |field| field.include?('charset=') })
113
- return Encoding.default_external
114
- end
115
-
116
- encoding_string = charset.split('=', 2).last.strip
117
- Encoding.find(encoding_string)
118
- rescue
119
- Encoding.default_external
120
- end
121
128
  end
122
129
 
123
130
  require 'webpay/api_resource'
data/webpay.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'webpay'
5
- spec.version = '3.0.1'
5
+ spec.version = '3.0.2'
6
6
  spec.authors = ['webpay', 'tomykaira']
7
7
  spec.email = ['administrators@webpay.jp', 'tomykaira@webpay.jp']
8
8
  spec.description = 'WebPay is payment gateway service in Japan. see also https://webpay.jp/'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpay
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - webpay
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-05 00:00:00.000000000 Z
12
+ date: 2014-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -101,4 +101,3 @@ signing_key:
101
101
  specification_version: 4
102
102
  summary: Bindings of WebPay API
103
103
  test_files: []
104
- has_rdoc: