regaliator 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +16 -0
  3. data/.ruby-version +1 -0
  4. data/Gemfile +4 -0
  5. data/Guardfile +36 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +116 -0
  8. data/Rakefile +11 -0
  9. data/lib/regaliator/api_version_error.rb +7 -0
  10. data/lib/regaliator/client.rb +9 -0
  11. data/lib/regaliator/configuration.rb +25 -0
  12. data/lib/regaliator/endpoint.rb +17 -0
  13. data/lib/regaliator/request.rb +100 -0
  14. data/lib/regaliator/response.rb +40 -0
  15. data/lib/regaliator/v15/account.rb +11 -0
  16. data/lib/regaliator/v15/bill.rb +23 -0
  17. data/lib/regaliator/v15/biller.rb +15 -0
  18. data/lib/regaliator/v15/client.rb +32 -0
  19. data/lib/regaliator/v15/rate.rb +15 -0
  20. data/lib/regaliator/v15/transaction.rb +23 -0
  21. data/lib/regaliator/v15.rb +7 -0
  22. data/lib/regaliator/v30/account.rb +11 -0
  23. data/lib/regaliator/v30/bill.rb +35 -0
  24. data/lib/regaliator/v30/biller.rb +19 -0
  25. data/lib/regaliator/v30/client.rb +32 -0
  26. data/lib/regaliator/v30/rate.rb +15 -0
  27. data/lib/regaliator/v30/transaction.rb +11 -0
  28. data/lib/regaliator/v30.rb +7 -0
  29. data/lib/regaliator/v31.rb +14 -0
  30. data/lib/regaliator/version.rb +3 -0
  31. data/lib/regaliator.rb +59 -0
  32. data/regaliator.gemspec +34 -0
  33. data/test/fixtures/vcr_cassettes/V31/account/failed_info.yml +48 -0
  34. data/test/fixtures/vcr_cassettes/V31/account/successful_info.yml +50 -0
  35. data/test/fixtures/vcr_cassettes/V31/bill/create.yml +52 -0
  36. data/test/fixtures/vcr_cassettes/V31/bill/list.yml +71 -0
  37. data/test/fixtures/vcr_cassettes/V31/bill/pay.yml +52 -0
  38. data/test/fixtures/vcr_cassettes/V31/bill/refresh.yml +52 -0
  39. data/test/fixtures/vcr_cassettes/V31/bill/show.yml +51 -0
  40. data/test/fixtures/vcr_cassettes/V31/bill/update.yml +53 -0
  41. data/test/fixtures/vcr_cassettes/V31/bill/xdata.yml +51 -0
  42. data/test/fixtures/vcr_cassettes/V31/biller/credentials.yml +256 -0
  43. data/test/fixtures/vcr_cassettes/V31/biller/topups.yml +209 -0
  44. data/test/fixtures/vcr_cassettes/V31/biller/utilities.yml +611 -0
  45. data/test/fixtures/vcr_cassettes/V31/rate/history.yml +50 -0
  46. data/test/fixtures/vcr_cassettes/V31/rate/list.yml +50 -0
  47. data/test/fixtures/vcr_cassettes/V31/transaction/list.yml +52 -0
  48. data/test/fixtures/vcr_cassettes/V31/transaction/search.yml +52 -0
  49. data/test/fixtures/vcr_cassettes/v15/account/failed_info.yml +50 -0
  50. data/test/fixtures/vcr_cassettes/v15/account/successful_info.yml +52 -0
  51. data/test/fixtures/vcr_cassettes/v15/bill/check.yml +52 -0
  52. data/test/fixtures/vcr_cassettes/v15/bill/consult.yml +52 -0
  53. data/test/fixtures/vcr_cassettes/v15/bill/index.yml +176 -0
  54. data/test/fixtures/vcr_cassettes/v15/bill/pay.yml +52 -0
  55. data/test/fixtures/vcr_cassettes/v15/biller/topups.yml +212 -0
  56. data/test/fixtures/vcr_cassettes/v15/biller/utilities.yml +611 -0
  57. data/test/fixtures/vcr_cassettes/v15/rate/history.yml +52 -0
  58. data/test/fixtures/vcr_cassettes/v15/rate/list.yml +52 -0
  59. data/test/fixtures/vcr_cassettes/v15/transaction/cancel.yml +52 -0
  60. data/test/fixtures/vcr_cassettes/v15/transaction/list.yml +54 -0
  61. data/test/fixtures/vcr_cassettes/v15/transaction/pay.yml +52 -0
  62. data/test/fixtures/vcr_cassettes/v15/transaction/reverse.yml +52 -0
  63. data/test/fixtures/vcr_cassettes/v15/transaction/search.yml +54 -0
  64. data/test/fixtures/vcr_cassettes/v30/account/failed_info.yml +48 -0
  65. data/test/fixtures/vcr_cassettes/v30/account/successful_info.yml +50 -0
  66. data/test/fixtures/vcr_cassettes/v30/bill/create.yml +56 -0
  67. data/test/fixtures/vcr_cassettes/v30/bill/list.yml +54 -0
  68. data/test/fixtures/vcr_cassettes/v30/bill/pay.yml +56 -0
  69. data/test/fixtures/vcr_cassettes/v30/bill/refresh.yml +56 -0
  70. data/test/fixtures/vcr_cassettes/v30/bill/show.yml +55 -0
  71. data/test/fixtures/vcr_cassettes/v30/bill/update.yml +57 -0
  72. data/test/fixtures/vcr_cassettes/v30/bill/xdata.yml +50 -0
  73. data/test/fixtures/vcr_cassettes/v30/biller/credentials.yml +54 -0
  74. data/test/fixtures/vcr_cassettes/v30/biller/topups.yml +54 -0
  75. data/test/fixtures/vcr_cassettes/v30/biller/utilities.yml +54 -0
  76. data/test/fixtures/vcr_cassettes/v30/rate/history.yml +54 -0
  77. data/test/fixtures/vcr_cassettes/v30/rate/list.yml +54 -0
  78. data/test/fixtures/vcr_cassettes/v30/transaction/list.yml +56 -0
  79. data/test/fixtures/vcr_cassettes/v30/transaction/search.yml +56 -0
  80. data/test/regaliator/api_version_error_test.rb +14 -0
  81. data/test/regaliator/client_test.rb +19 -0
  82. data/test/regaliator/configuration_test.rb +115 -0
  83. data/test/regaliator/endpoint_test.rb +19 -0
  84. data/test/regaliator/v15/account_test.rb +37 -0
  85. data/test/regaliator/v15/bill_test.rb +67 -0
  86. data/test/regaliator/v15/biller_test.rb +35 -0
  87. data/test/regaliator/v15/client_test.rb +23 -0
  88. data/test/regaliator/v15/rate_test.rb +35 -0
  89. data/test/regaliator/v15/transaction_test.rb +62 -0
  90. data/test/regaliator/v15_test.rb +10 -0
  91. data/test/regaliator/v30/account_test.rb +37 -0
  92. data/test/regaliator/v30/bill_test.rb +80 -0
  93. data/test/regaliator/v30/biller_test.rb +44 -0
  94. data/test/regaliator/v30/client_test.rb +23 -0
  95. data/test/regaliator/v30/rate_test.rb +35 -0
  96. data/test/regaliator/v30/transaction_test.rb +35 -0
  97. data/test/regaliator/v30_test.rb +10 -0
  98. data/test/regaliator/v31/account_test.rb +37 -0
  99. data/test/regaliator/v31/bill_test.rb +84 -0
  100. data/test/regaliator/v31/biller_test.rb +44 -0
  101. data/test/regaliator/v31/client_test.rb +23 -0
  102. data/test/regaliator/v31/rate_test.rb +35 -0
  103. data/test/regaliator/v31/transaction_test.rb +35 -0
  104. data/test/regaliator/v31_test.rb +10 -0
  105. data/test/regaliator/version_test.rb +10 -0
  106. data/test/regaliator_test.rb +66 -0
  107. data/test/test_helper.rb +26 -0
  108. metadata +394 -0
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: patch
5
+ uri: http://api.regalii.dev/bills/5
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"name_on_account":"Test name"}'
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - application/vnd.regalii.v3.0+json
14
+ User-Agent:
15
+ - Regaliator gem v3.0.0
16
+ Content-Type:
17
+ - application/json
18
+ Date:
19
+ - Tue, 22 Mar 2016 21:40:11 GMT
20
+ Content-Md5:
21
+ - tQ8IX1hl4ZosSRi1479/kw==
22
+ Authorization:
23
+ - APIAuth api-key:ymsqM5jmkDfiE8Sn7qaZdgxzQBc=
24
+ response:
25
+ status:
26
+ code: 200
27
+ message: OK
28
+ headers:
29
+ X-Frame-Options:
30
+ - SAMEORIGIN
31
+ X-Xss-Protection:
32
+ - 1; mode=block
33
+ X-Content-Type-Options:
34
+ - nosniff
35
+ Content-Type:
36
+ - application/json; charset=utf-8
37
+ Etag:
38
+ - '"7d6d90aec27891b906d0ee6dfc9af4f3"'
39
+ Cache-Control:
40
+ - max-age=0, private, must-revalidate
41
+ X-Request-Id:
42
+ - c1c531ee-94a5-4137-be1c-2a87aeeb968d
43
+ X-Runtime:
44
+ - '0.028269'
45
+ Vary:
46
+ - Origin
47
+ Date:
48
+ - Tue, 22 Mar 2016 21:40:11 GMT
49
+ Connection:
50
+ - close
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"id":5,"biller_id":2,"account_number":"8081969","name_on_account":"Test
54
+ name","due_date":null,"balance":44.0,"balance_currency":"RD","balance_in_chain_currency":1.01,"balance_updated_at":"2016-03-22T21:38:08Z","created_at":"2016-03-22T21:32:36Z","last_paid_at":null,"error_with_account":false,"error_message":null,"status":"updated","mfa_challenges":[]}'
55
+ http_version:
56
+ recorded_at: Tue, 22 Mar 2016 21:40:11 GMT
57
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.regalii.dev/bills/674101/xdata
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - application/vnd.regalii.v3.0+json
14
+ User-Agent:
15
+ - Regaliator gem v3.0.0
16
+ Content-Type:
17
+ - application/json
18
+ Date:
19
+ - Fri, 14 Oct 2016 21:20:47 GMT
20
+ Authorization:
21
+ - APIAuth api-key:rf2BpM59AG/pw62+ZPamVhkEvzc=
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ X-Frame-Options:
28
+ - SAMEORIGIN
29
+ X-Xss-Protection:
30
+ - 1; mode=block
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Etag:
36
+ - W/"1fae34a1a67550f79f43c740411397dc"
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - 29be0b82-604b-4096-b5f0-8bba834db266
41
+ X-Runtime:
42
+ - '0.173437'
43
+ Transfer-Encoding:
44
+ - chunked
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"id":674101,"biller_id":6503,"account_number":"12345","name_on_account":"Kelly Gruber","due_date":"2016-10-10","balance":10.5,"balance_currency":"USD","balance_updated_at":"2016-08-03T18:35:21Z","created_at":"2016-06-14T20:57:08Z","status":"updated","address":null,"payment_method":null,"statements":[],"subordinates":[]}'
48
+ http_version:
49
+ recorded_at: Fri, 14 Oct 2016 21:20:47 GMT
50
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.regalii.dev/billers/credentials
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - application/vnd.regalii.v3.0+json
14
+ User-Agent:
15
+ - Regaliator gem v3.0.0
16
+ Content-Type:
17
+ - application/json
18
+ Date:
19
+ - Tue, 22 Mar 2016 19:56:12 GMT
20
+ Authorization:
21
+ - APIAuth api-key:iVasEKpN7aMC50Od44vlpf60F+M=
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ X-Frame-Options:
28
+ - SAMEORIGIN
29
+ X-Xss-Protection:
30
+ - 1; mode=block
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Etag:
36
+ - '"4c9bb549ffd38f8e4e183f2554b71cce"'
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - 96bc2458-60c4-40e4-9523-b423914f62fd
41
+ X-Runtime:
42
+ - '0.173376'
43
+ Vary:
44
+ - Origin
45
+ Date:
46
+ - Tue, 22 Mar 2016 19:56:13 GMT
47
+ Connection:
48
+ - close
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"billers":[{"id":6330,"name":"Adobe Creative Cloud","country":"US","currency":"","biller_type":"Media","bill_type":"credentials","required_parameters":null,"returned_parameters":null}]}'
52
+ http_version:
53
+ recorded_at: Tue, 22 Mar 2016 19:56:13 GMT
54
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.regalii.dev/billers/topups
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - application/vnd.regalii.v3.0+json
14
+ User-Agent:
15
+ - Regaliator gem v3.0.0
16
+ Content-Type:
17
+ - application/json
18
+ Date:
19
+ - Tue, 22 Mar 2016 19:56:13 GMT
20
+ Authorization:
21
+ - APIAuth api-key:M5WcYibh66vodyol4TPXNuiScdk=
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ X-Frame-Options:
28
+ - SAMEORIGIN
29
+ X-Xss-Protection:
30
+ - 1; mode=block
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Etag:
36
+ - '"0f285178775f3ad6995bb69c496ce3aa"'
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - 2cd5d759-7b6c-4394-998a-c38a3646892f
41
+ X-Runtime:
42
+ - '0.081188'
43
+ Vary:
44
+ - Origin
45
+ Date:
46
+ - Tue, 22 Mar 2016 19:56:13 GMT
47
+ Connection:
48
+ - close
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"billers":[{"id":4842,"name":"Alegro","country":"EC","currency":"USD","biller_type":"Cell","bill_type":"phone_number","available_topup_amounts":["6.00","12.00"],"topup_fxrate":null,"mask":null,"topup_commission":11.0,"account_number_digits":"8"}]}'
52
+ http_version:
53
+ recorded_at: Tue, 22 Mar 2016 19:56:13 GMT
54
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.regalii.dev/billers/utilities
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - application/vnd.regalii.v3.0+json
14
+ User-Agent:
15
+ - Regaliator gem v3.0.0
16
+ Content-Type:
17
+ - application/json
18
+ Date:
19
+ - Tue, 22 Mar 2016 19:56:13 GMT
20
+ Authorization:
21
+ - APIAuth api-key:17LBCPSQes3BgiY6jc84+OhEen4=
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ X-Frame-Options:
28
+ - SAMEORIGIN
29
+ X-Xss-Protection:
30
+ - 1; mode=block
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Etag:
36
+ - '"26f2a27ae80cf111448992a8984eb010"'
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - 614893e7-9a5e-4917-b3f0-05f7ea5b1eb3
41
+ X-Runtime:
42
+ - '0.027250'
43
+ Vary:
44
+ - Origin
45
+ Date:
46
+ - Tue, 22 Mar 2016 19:56:13 GMT
47
+ Connection:
48
+ - close
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"billers":[{"id":3261,"name":"Adani Energy Limited","country":"IN","currency":"INR","biller_type":"Gas","bill_type":"account_number","can_check_balance":false,"mask":"9999999999","requires_name_on_account":false,"supports_partial_payments":true,"hours_to_fulfill":0,"account_number_digits":"10"}]}'
52
+ http_version:
53
+ recorded_at: Tue, 22 Mar 2016 19:56:13 GMT
54
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.regalii.dev/rates/history
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - application/vnd.regalii.v3.0+json
14
+ User-Agent:
15
+ - Regaliator gem v3.0.0
16
+ Content-Type:
17
+ - application/json
18
+ Date:
19
+ - Tue, 22 Mar 2016 19:46:14 GMT
20
+ Authorization:
21
+ - APIAuth api-key:+RNogcCfF1Aeyq6QLrH8nn74slo=
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ X-Frame-Options:
28
+ - SAMEORIGIN
29
+ X-Xss-Protection:
30
+ - 1; mode=block
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Etag:
36
+ - '"1c08052831a51483e433474e1a0cdb1f"'
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - 675769f9-19ca-483f-86a3-363c6d98ca10
41
+ X-Runtime:
42
+ - '0.048035'
43
+ Vary:
44
+ - Origin
45
+ Date:
46
+ - Tue, 22 Mar 2016 19:46:14 GMT
47
+ Connection:
48
+ - close
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"2016-03-22":{}}'
52
+ http_version:
53
+ recorded_at: Tue, 22 Mar 2016 19:46:14 GMT
54
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.regalii.dev/rates
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - application/vnd.regalii.v3.0+json
14
+ User-Agent:
15
+ - Regaliator gem v3.0.0
16
+ Content-Type:
17
+ - application/json
18
+ Date:
19
+ - Tue, 22 Mar 2016 19:46:14 GMT
20
+ Authorization:
21
+ - APIAuth api-key:LmpI1fkCUOHXjII2UAIc7H4W2+o=
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ X-Frame-Options:
28
+ - SAMEORIGIN
29
+ X-Xss-Protection:
30
+ - 1; mode=block
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Etag:
36
+ - '"29503024667a3647d28134f8b3a74606"'
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - ba2ba805-82d6-4e8c-80f7-409d4ecbf463
41
+ X-Runtime:
42
+ - '0.032566'
43
+ Vary:
44
+ - Origin
45
+ Date:
46
+ - Tue, 22 Mar 2016 19:46:14 GMT
47
+ Connection:
48
+ - close
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"MXN":16.488,"RD":43.7165}'
52
+ http_version:
53
+ recorded_at: Tue, 22 Mar 2016 19:46:14 GMT
54
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.regalii.dev/transactions
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - application/vnd.regalii.v3.0+json
14
+ User-Agent:
15
+ - Regaliator gem v3.0.0
16
+ Content-Type:
17
+ - application/json
18
+ Date:
19
+ - Tue, 22 Mar 2016 20:00:30 GMT
20
+ Authorization:
21
+ - APIAuth api-key:cMleQmzTkTfzVlT/D8ueDcL3E88=
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ X-Frame-Options:
28
+ - SAMEORIGIN
29
+ X-Xss-Protection:
30
+ - 1; mode=block
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ X-Pagination:
34
+ - '{"total_entries":11,"total_pages":1,"previous_page":null,"current_page":1,"next_page":null}'
35
+ Content-Type:
36
+ - application/json; charset=utf-8
37
+ Etag:
38
+ - '"b9b2cb7d7ca22ba6c4178463069e7eac"'
39
+ Cache-Control:
40
+ - max-age=0, private, must-revalidate
41
+ X-Request-Id:
42
+ - 6010ee23-10b6-466a-a177-1349366c8fa2
43
+ X-Runtime:
44
+ - '0.100741'
45
+ Vary:
46
+ - Origin
47
+ Date:
48
+ - Tue, 22 Mar 2016 20:00:30 GMT
49
+ Connection:
50
+ - close
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"transactions":[{"id":1,"external_id":"1-1591-2222222233-201509302128","biller_id":1591,"account_number":"2222222233","bill_amount":2.0,"bill_amount_currency":"USD","fx_rate":16.6048,"bill_amount_usd":2.0,"bill_amount_chain_currency":2.0,"payment_transaction_fee":0.0,"payment_total_usd":2.0,"payment_total_chain_currency":2.0,"chain_earned":0.5,"chain_paid":1.5,"starting_balance":-602.1,"ending_balance":-603.6,"hours_to_fulfill":0,"discount":0.0,"sms_text":null,"created_at":"2015-09-30T21:28:08Z","payment_status":"sent","bill_amount_local_currency":20.0,"local_currency":"MXN"}]}'
54
+ http_version:
55
+ recorded_at: Tue, 22 Mar 2016 20:00:30 GMT
56
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.regalii.dev/transactions?q%5Bid_eq%5D=1
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - application/vnd.regalii.v3.0+json
14
+ User-Agent:
15
+ - Regaliator gem v3.0.0
16
+ Content-Type:
17
+ - application/json
18
+ Date:
19
+ - Tue, 22 Mar 2016 20:52:13 GMT
20
+ Authorization:
21
+ - APIAuth api-key:WL6G79M838Zoo5LH+jpJsHJ3S04=
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ X-Frame-Options:
28
+ - SAMEORIGIN
29
+ X-Xss-Protection:
30
+ - 1; mode=block
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ X-Pagination:
34
+ - '{"total_entries":1,"total_pages":1,"previous_page":null,"current_page":1,"next_page":null}'
35
+ Content-Type:
36
+ - application/json; charset=utf-8
37
+ Etag:
38
+ - '"0dd2c5083f4e41a311a14206e6a70f28"'
39
+ Cache-Control:
40
+ - max-age=0, private, must-revalidate
41
+ X-Request-Id:
42
+ - 38c0073e-4106-43a4-8705-32eb1483de24
43
+ X-Runtime:
44
+ - '0.213259'
45
+ Vary:
46
+ - Origin
47
+ Date:
48
+ - Tue, 22 Mar 2016 20:52:16 GMT
49
+ Connection:
50
+ - close
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"transactions":[{"id":1,"external_id":"1-1591-2222222233-201509302128","biller_id":1591,"account_number":"2222222233","bill_amount":2.0,"bill_amount_currency":"USD","fx_rate":16.6048,"bill_amount_usd":2.0,"bill_amount_chain_currency":2.0,"payment_transaction_fee":0.0,"payment_total_usd":2.0,"payment_total_chain_currency":2.0,"chain_earned":0.5,"chain_paid":1.5,"starting_balance":-602.1,"ending_balance":-603.6,"hours_to_fulfill":0,"discount":0.0,"sms_text":null,"created_at":"2015-09-30T21:28:08Z","payment_status":"sent","bill_amount_local_currency":20.0,"local_currency":"MXN"}]}'
54
+ http_version:
55
+ recorded_at: Tue, 22 Mar 2016 20:52:16 GMT
56
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,14 @@
1
+ require 'test_helper'
2
+
3
+ module Regaliator
4
+ class APIVersionErrorTest < Minitest::Test
5
+ def test_class_inherits_from_standard_error
6
+ assert_operator APIVersionError, :<, StandardError
7
+ end
8
+
9
+ def test_constructor_expects_a_version
10
+ subject = APIVersionError.new('1.0')
11
+ assert_match /1\.0/, subject.message
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ require 'test_helper'
2
+
3
+ module Regaliator
4
+ class ClientTest < Minitest::Test
5
+ def setup
6
+ @config = Configuration.new.tap do |config|
7
+ config.host = 'https://api.regalii.dev'
8
+ config.api_key = 'api_key'
9
+ config.secret_key = 'secret_key'
10
+ end
11
+ end
12
+
13
+ def test_constructor_accepts_a_configuration
14
+ subject = Client.new(@config)
15
+
16
+ assert_same @config, subject.config
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,115 @@
1
+ require 'test_helper'
2
+
3
+ module Regaliator
4
+ class ConfigurationTest < Minitest::Test
5
+ def setup
6
+ @subject = Configuration.new
7
+ end
8
+
9
+ def test_api_key_attribute_has_default_value
10
+ assert_nil @subject.api_key
11
+ end
12
+
13
+ def test_secret_key_attribute_has_default_value
14
+ assert_nil @subject.secret_key
15
+ end
16
+
17
+ def test_host_attribute_has_default_value
18
+ assert_nil @subject.host
19
+ end
20
+
21
+ def test_version_attribute_has_default_value
22
+ assert_nil @subject.version
23
+ end
24
+
25
+ def test_open_timeout_attribute_has_default_value
26
+ assert_instance_of Fixnum, @subject.open_timeout
27
+ end
28
+
29
+ def test_read_timeout_attribute_has_default_value
30
+ assert_instance_of Fixnum, @subject.read_timeout
31
+ end
32
+
33
+ def test_use_ssl_attribute_has_default_value
34
+ assert_instance_of TrueClass, @subject.use_ssl
35
+ end
36
+
37
+ def test_proxy_host_attribute_has_default_value
38
+ assert_nil @subject.proxy_host
39
+ end
40
+
41
+ def test_proxy_port_attribute_has_default_value
42
+ assert_nil @subject.proxy_port
43
+ end
44
+
45
+ def test_proxy_user_attribute_has_default_value
46
+ assert_nil @subject.proxy_user
47
+ end
48
+
49
+ def test_proxy_pass_attribute_has_default_value
50
+ assert_nil @subject.proxy_pass
51
+ end
52
+
53
+ def test_api_key_attribute_has_writter
54
+ subject = Configuration.new.tap { |c| c.api_key = '123' }
55
+ assert_equal '123', subject.api_key
56
+ end
57
+
58
+ def test_secret_key_attribute_has_writter
59
+ subject = Configuration.new.tap { |c| c.secret_key = '321' }
60
+ assert_equal '321', subject.secret_key
61
+ end
62
+
63
+ def test_host_attribute_has_writter
64
+ subject = Configuration.new.tap { |c| c.host = 'api.example.com' }
65
+ assert_equal 'api.example.com', subject.host
66
+ end
67
+
68
+ def test_version_attribute_has_writter
69
+ subject = Configuration.new.tap { |c| c.version = '1.0' }
70
+ assert_equal '1.0', subject.version
71
+ end
72
+
73
+ def test_open_timeout_attribute_has_writter
74
+ subject = Configuration.new.tap { |c| c.open_timeout = 10 }
75
+ assert_equal 10, subject.open_timeout
76
+ end
77
+
78
+ def test_read_timeout_attribute_has_writter
79
+ subject = Configuration.new.tap { |c| c.read_timeout = 10 }
80
+ assert_equal 10, subject.read_timeout
81
+ end
82
+
83
+ def test_use_ssl_attribute_has_writter
84
+ subject = Configuration.new.tap { |c| c.use_ssl = false }
85
+ assert_equal false, subject.use_ssl
86
+ end
87
+
88
+ def test_proxy_host_attribute_has_writter
89
+ subject = Configuration.new.tap { |c| c.proxy_host = 'localhost' }
90
+ assert_equal 'localhost', subject.proxy_host
91
+ end
92
+
93
+ def test_proxy_port_attribute_has_writter
94
+ subject = Configuration.new.tap { |c| c.proxy_port = '9293' }
95
+ assert_equal '9293', subject.proxy_port
96
+ end
97
+
98
+ def test_proxy_user_attribute_has_writter
99
+ subject = Configuration.new.tap { |c| c.proxy_user = 'username' }
100
+ assert_equal 'username', subject.proxy_user
101
+ end
102
+
103
+ def test_proxy_pass_attribute_has_writter
104
+ subject = Configuration.new.tap { |c| c.proxy_pass = 'password' }
105
+ assert_equal 'password', subject.proxy_pass
106
+ end
107
+
108
+ def test_secure_method_returns_boolean
109
+ assert_equal true, Configuration.new.tap { |c| c.use_ssl = true }.secure?
110
+ assert_equal false, Configuration.new.tap { |c| c.use_ssl = 'hello' }.secure?
111
+ assert_equal false, Configuration.new.tap { |c| c.use_ssl = false }.secure?
112
+ assert_equal false, Configuration.new.tap { |c| c.use_ssl = nil }.secure?
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,19 @@
1
+ require 'test_helper'
2
+
3
+ module Regaliator
4
+ class EndpointTest < Minitest::Test
5
+ def setup
6
+ @config = Configuration.new.tap do |config|
7
+ config.host = 'https://api.regalii.dev'
8
+ config.api_key = 'api_key'
9
+ config.secret_key = 'secret_key'
10
+ end
11
+ end
12
+
13
+ def test_constructor_accepts_a_configuration
14
+ subject = Endpoint.new(@config)
15
+
16
+ assert_same @config, subject.config
17
+ end
18
+ end
19
+ end