espago 0.0.9 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +15 -3
  3. data/Gemfile +2 -0
  4. data/Gemfile.lock +263 -47
  5. data/Guardfile +1 -0
  6. data/README.md +116 -6
  7. data/app/helpers/espago/masterpass_helper.rb +13 -0
  8. data/app/helpers/espago/secure_web_page_helper.rb +5 -0
  9. data/app/views/espago_masterpass/_masterpass_button.html.haml +20 -0
  10. data/app/views/espago_masterpass/_masterpass_pairing_button.html.haml +11 -0
  11. data/app/views/espago_masterpass/_masterpass_precheckout_button.html.haml +21 -0
  12. data/app/views/espago_secure_web_page/_form.html.haml +26 -0
  13. data/espago.gemspec +16 -9
  14. data/lib/espago/api_connection/{post_clients.rb → api.rb} +1 -5
  15. data/lib/espago/api_connection/api_delete.rb +9 -0
  16. data/lib/espago/api_connection/api_get.rb +13 -0
  17. data/lib/espago/api_connection/api_post.rb +9 -0
  18. data/lib/espago/api_connection/api_put.rb +9 -0
  19. data/lib/espago/api_connection/charges_complete_post.rb +9 -0
  20. data/lib/espago/api_connection/charges_delete.rb +9 -0
  21. data/lib/espago/api_connection/charges_get.rb +9 -0
  22. data/lib/espago/api_connection/charges_post.rb +9 -0
  23. data/lib/espago/api_connection/{post_charges_refund.rb → charges_refund_post.rb} +1 -5
  24. data/lib/espago/api_connection/clients_authorize_post.rb +9 -0
  25. data/lib/espago/api_connection/clients_delete.rb +9 -0
  26. data/lib/espago/api_connection/clients_get.rb +9 -0
  27. data/lib/espago/api_connection/clients_invoices_get.rb +9 -0
  28. data/lib/espago/api_connection/clients_post.rb +9 -0
  29. data/lib/espago/api_connection/clients_put.rb +9 -0
  30. data/lib/espago/api_connection/clients_subscriptions_get.rb +9 -0
  31. data/lib/espago/api_connection/complete_post.rb +14 -0
  32. data/lib/espago/api_connection/dcc_decision_post.rb +9 -0
  33. data/lib/espago/api_connection/invoice_items_delete.rb +9 -0
  34. data/lib/espago/api_connection/invoice_items_get.rb +9 -0
  35. data/lib/espago/api_connection/invoice_items_post.rb +9 -0
  36. data/lib/espago/api_connection/invoices_get.rb +9 -0
  37. data/lib/espago/api_connection/line_items_get.rb +9 -0
  38. data/lib/espago/api_connection/masterpass_post.rb +9 -0
  39. data/lib/espago/api_connection/plans_delete.rb +9 -0
  40. data/lib/espago/api_connection/plans_get.rb +9 -0
  41. data/lib/espago/api_connection/plans_post.rb +9 -0
  42. data/lib/espago/api_connection/plans_put.rb +9 -0
  43. data/lib/espago/api_connection/refunds_post.rb +9 -0
  44. data/lib/espago/api_connection/secure_web_page_register_post.rb +9 -0
  45. data/lib/espago/api_connection/subscriptions_delete.rb +9 -0
  46. data/lib/espago/api_connection/subscriptions_get.rb +9 -0
  47. data/lib/espago/api_connection/subscriptions_post.rb +9 -0
  48. data/lib/espago/api_connection/tokens_get.rb +9 -0
  49. data/lib/espago/api_connection/{delete_charges.rb → tokens_post.rb} +3 -2
  50. data/lib/espago/api_connection/visacheckout_post.rb +9 -0
  51. data/lib/espago/api_connection.rb +20 -9
  52. data/lib/espago/back_request.rb +33 -0
  53. data/lib/espago/client.rb +23 -9
  54. data/lib/espago/engine.rb +5 -0
  55. data/lib/espago/masterpass.rb +52 -0
  56. data/lib/espago/router.rb +1 -1
  57. data/lib/espago/secure_web_page.rb +31 -0
  58. data/lib/espago/version.rb +1 -1
  59. data/lib/espago.rb +11 -3
  60. data/lib/generators/espago/install_generator.rb +20 -0
  61. data/lib/generators/espago/templates/README +10 -0
  62. data/lib/generators/espago/templates/espago.rb +6 -0
  63. data/spec/espago/api_connection_spec.rb +5 -4
  64. data/spec/espago/back_request_spec.rb +33 -0
  65. data/spec/espago/client_spec.rb +21 -8
  66. data/spec/espago/error_spec.rb +4 -3
  67. data/spec/espago/response_spec.rb +10 -10
  68. data/spec/espago/router_spec.rb +6 -7
  69. data/spec/features/apis_spec.rb +21 -0
  70. data/spec/features/charges_spec.rb +79 -0
  71. data/spec/features/charges_spec_with_params_spec.rb +89 -0
  72. data/spec/features/clients_spec.rb +100 -0
  73. data/spec/features/dcc_decision_spec.rb +20 -0
  74. data/spec/features/error_spec.rb +28 -0
  75. data/spec/features/invoice_items_spec.rb +37 -0
  76. data/spec/features/invoices_spec.rb +24 -0
  77. data/spec/features/line_items_spec.rb +17 -0
  78. data/spec/features/plans_spec.rb +61 -0
  79. data/spec/features/secure_web_page_register_spec.rb +23 -0
  80. data/spec/features/subscriptions_spec.rb +43 -0
  81. data/spec/features/tokens_spec.rb +39 -0
  82. data/spec/fixtures/cassettes/api_2.yml +68 -0
  83. data/spec/fixtures/cassettes/api_3.yml +68 -0
  84. data/spec/fixtures/cassettes/charges_complete.yml +48 -0
  85. data/spec/fixtures/cassettes/charges_complete_deprecation.yml +48 -0
  86. data/spec/fixtures/cassettes/charges_destroy.yml +46 -0
  87. data/spec/fixtures/cassettes/charges_get.yml +67 -0
  88. data/spec/fixtures/cassettes/charges_get_pay_mTOngouLTJWZ0w.yml +48 -0
  89. data/spec/fixtures/cassettes/charges_post.yml +50 -0
  90. data/spec/fixtures/cassettes/charges_refund.yml +50 -0
  91. data/spec/fixtures/cassettes/clients_authorize.yml +50 -0
  92. data/spec/fixtures/cassettes/clients_delete.yml +44 -0
  93. data/spec/fixtures/cassettes/clients_get.yml +48 -0
  94. data/spec/fixtures/cassettes/clients_get_cli_w0Se2smYwyQ0Uw.yml +48 -0
  95. data/spec/fixtures/cassettes/clients_invoices.yml +48 -0
  96. data/spec/fixtures/cassettes/clients_post.yml +50 -0
  97. data/spec/fixtures/cassettes/clients_put.yml +50 -0
  98. data/spec/fixtures/cassettes/clients_subscriptions.yml +48 -0
  99. data/spec/fixtures/cassettes/dcc_decision_post.yml +50 -0
  100. data/spec/fixtures/cassettes/error_400.yml +48 -0
  101. data/spec/fixtures/cassettes/error_401.yml +48 -0
  102. data/spec/fixtures/cassettes/error_500.yml +48 -0
  103. data/spec/fixtures/cassettes/invoice_items_delete_ii_WDzszvhTshe78Xd.yml +44 -0
  104. data/spec/fixtures/cassettes/invoice_items_get_ii_5LS-YR7S1QaJBl3.yml +49 -0
  105. data/spec/fixtures/cassettes/invoice_items_post_ii_5LS-YR7S1QaJBl3.yml +51 -0
  106. data/spec/fixtures/cassettes/invoices_get.yml +48 -0
  107. data/spec/fixtures/cassettes/invoices_get_in_tUCMhwlg2nkvAaL.yml +48 -0
  108. data/spec/fixtures/cassettes/line_items_get.yml +47 -0
  109. data/spec/fixtures/cassettes/plans_delete.yml +42 -0
  110. data/spec/fixtures/cassettes/plans_get.yml +46 -0
  111. data/spec/fixtures/cassettes/plans_get_pl_12345.yml +46 -0
  112. data/spec/fixtures/cassettes/plans_post.yml +50 -0
  113. data/spec/fixtures/cassettes/plans_put.yml +46 -0
  114. data/spec/fixtures/cassettes/secure_web_page_register_post.yml +56 -0
  115. data/spec/fixtures/cassettes/subscriptions_delete_sub_8yYuCBKdywr7e2.yml +44 -0
  116. data/spec/fixtures/cassettes/subscriptions_get.yml +46 -0
  117. data/spec/fixtures/cassettes/subscriptions_get_sub_8yYuCBKdywr7e2.yml +46 -0
  118. data/spec/fixtures/cassettes/subscriptions_post.yml +50 -0
  119. data/spec/fixtures/cassettes/tokens_get.yml +48 -0
  120. data/spec/fixtures/cassettes/tokens_post.yml +56 -0
  121. data/spec/spec_helper.rb +29 -1
  122. metadata +271 -42
  123. data/lib/espago/api_connection/delete_clients.rb +0 -13
  124. data/lib/espago/api_connection/get_charges.rb +0 -17
  125. data/lib/espago/api_connection/get_clients.rb +0 -17
  126. data/lib/espago/api_connection/get_tokens.rb +0 -13
  127. data/lib/espago/api_connection/post_charges.rb +0 -13
  128. data/lib/espago/api_connection/post_clients_authorize.rb +0 -13
  129. data/lib/espago/api_connection/post_complete.rb +0 -13
  130. data/lib/espago/api_connection/post_tokens.rb +0 -14
  131. data/lib/espago/api_connection/put_clients.rb +0 -13
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://sandbox.espago.com/api/plans/pl_XczKHr_42CRiKXZ
6
+ body:
7
+ encoding: US-ASCII
8
+ string: plan_id=pl_XczKHr_42CRiKXZ&period_unit=month&period=1&amount=149.99&currency=pln&description=Test+Plan
9
+ headers:
10
+ Accept:
11
+ - application/vnd.espago.v2+json
12
+ Authorization:
13
+ - Basic YXBwX2lkX3Rlc3Q6YXBwX3Bhc3N3b3JkX3Rlc3Q=
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 204
23
+ message: No Content
24
+ headers:
25
+ X-Meta-Request-Version:
26
+ - 0.2.2
27
+ X-Ua-Compatible:
28
+ - IE=Edge
29
+ Cache-Control:
30
+ - no-cache
31
+ Set-Cookie:
32
+ - _session_id=444820a95c126c20986637ed3efd2fd4; path=/; HttpOnly
33
+ X-Request-Id:
34
+ - f6497ce3e4a20c75130f5cac324381a1
35
+ X-Runtime:
36
+ - '0.489553'
37
+ Connection:
38
+ - close
39
+ Server:
40
+ - thin 1.5.0 codename Knife
41
+ body:
42
+ encoding: UTF-8
43
+ string: ''
44
+ http_version:
45
+ recorded_at: Wed, 26 Nov 2014 17:51:57 GMT
46
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://sandbox.espago.com/api/secure_web_page_register
6
+ body:
7
+ encoding: UTF-8
8
+ string: amount=49.99&currency=PLN&description=Test12345&client_description=Jan+Kowalski&kind=sale
9
+ headers:
10
+ Accept:
11
+ - application/vnd.espago.v3+json
12
+ Authorization:
13
+ - Basic YXBwX2lkX3Rlc3Q6YXBwX3Bhc3N3b3JkX3Rlc3Q=
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: 'Created '
24
+ headers:
25
+ X-Frame-Options:
26
+ - SAMEORIGIN
27
+ X-Xss-Protection:
28
+ - 1; mode=block
29
+ X-Content-Type-Options:
30
+ - nosniff
31
+ Content-Type:
32
+ - application/json; charset=utf-8
33
+ X-Meta-Request-Version:
34
+ - 0.2.9
35
+ Etag:
36
+ - W/"c32d4faa6245c966283caad9e1088455"
37
+ Cache-Control:
38
+ - max-age=0, private, must-revalidate
39
+ X-Request-Id:
40
+ - a9b96384-cf27-49a6-b685-6f2f77689f5d
41
+ Server:
42
+ - WEBrick/1.3.1 (Ruby/2.4.6/2019-04-01)
43
+ Date:
44
+ - Mon, 15 Apr 2019 16:03:09 GMT
45
+ Content-Length:
46
+ - '227'
47
+ Connection:
48
+ - Keep-Alive
49
+ Set-Cookie:
50
+ - _session_id=93a8bdfcb34dc876573281a240c04d43; path=/; HttpOnly
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"id":"pay_770swCpLvm5dzrqk","description":"Test12345","amount":"49.99","currency":"PLN","state":"new","created_at":1555344189,"transaction_id":"tr_770J9n7gw","redirect_url":"http://127.0.0.1:3000/secure_web_page/tr_770J9n7gw"}'
54
+ http_version:
55
+ recorded_at: Mon, 15 Apr 2019 16:03:09 GMT
56
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: https://sandbox.espago.com/api/subscriptions/sub_8yYuCBKdywr7e2
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/vnd.espago.v2+json
12
+ Authorization:
13
+ - Basic YXBwX2lkX3Rlc3Q6YXBwX3Bhc3N3b3JkX3Rlc3Q=
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ User-Agent:
17
+ - Ruby
18
+ response:
19
+ status:
20
+ code: 204
21
+ message: No Content
22
+ headers:
23
+ X-Meta-Request-Version:
24
+ - 0.2.2
25
+ X-Ua-Compatible:
26
+ - IE=Edge
27
+ Cache-Control:
28
+ - no-cache
29
+ Set-Cookie:
30
+ - _session_id=8e765e9748ae92432715e3d41d9951d2; path=/; HttpOnly
31
+ X-Request-Id:
32
+ - a7dbff53bce58ab3f0b52a64d4322c0f
33
+ X-Runtime:
34
+ - '1.657240'
35
+ Connection:
36
+ - close
37
+ Server:
38
+ - thin 1.5.0 codename Knife
39
+ body:
40
+ encoding: UTF-8
41
+ string: ''
42
+ http_version:
43
+ recorded_at: Thu, 27 Nov 2014 15:38:16 GMT
44
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandbox.espago.com/api/subscriptions
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/vnd.espago.v2+json
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Content-Type:
22
+ - application/json; charset=utf-8
23
+ X-Meta-Request-Version:
24
+ - 0.2.2
25
+ X-Ua-Compatible:
26
+ - IE=Edge
27
+ Etag:
28
+ - '"e8b64babf491e15309cc95cc2db2d258"'
29
+ Cache-Control:
30
+ - max-age=0, private, must-revalidate
31
+ Set-Cookie:
32
+ - _session_id=34e94b2812086a2c7f02e9c1a51d4b03; path=/; HttpOnly
33
+ X-Request-Id:
34
+ - bb518b642a4faf3f20c0be5da4259599
35
+ X-Runtime:
36
+ - '0.437633'
37
+ Connection:
38
+ - close
39
+ Server:
40
+ - thin 1.5.0 codename Knife
41
+ body:
42
+ encoding: UTF-8
43
+ string: '{"count":1,"subscriptions":[{"id":"sub_8yYuCBKdywr7e2","state":"active","client":"cli_90Pi6Jf0ndl_PP","plan":"pl_12345","created_at":1417030496,"last_invoice":{"id":"in_tUCMhwlg2nkvAaL","date":1417030496,"client":"cli_90Pi6Jf0ndl_PP","subscription":"sub_8yYuCBKdywr7e2","amount":"123.45","currency":"pln","paid":true,"issuer_response_code":"00","attempts":1,"next_payment_attempt":null,"created_at":1417030497}}]}'
44
+ http_version:
45
+ recorded_at: Wed, 26 Nov 2014 19:35:13 GMT
46
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandbox.espago.com/api/subscriptions/sub_8yYuCBKdywr7e2
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/vnd.espago.v2+json
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Content-Type:
22
+ - application/json; charset=utf-8
23
+ X-Meta-Request-Version:
24
+ - 0.2.2
25
+ X-Ua-Compatible:
26
+ - IE=Edge
27
+ Etag:
28
+ - '"8a7a471581b59dfd11b76713db87dce9"'
29
+ Cache-Control:
30
+ - max-age=0, private, must-revalidate
31
+ Set-Cookie:
32
+ - _session_id=d03bdbe00f0d157cb00c8a592a485cd3; path=/; HttpOnly
33
+ X-Request-Id:
34
+ - fb1102fda30ffbf7d6bdaf533a922195
35
+ X-Runtime:
36
+ - '0.531484'
37
+ Connection:
38
+ - close
39
+ Server:
40
+ - thin 1.5.0 codename Knife
41
+ body:
42
+ encoding: UTF-8
43
+ string: '{"id":"sub_8yYuCBKdywr7e2","state":"active","client":"cli_90Pi6Jf0ndl_PP","plan":"pl_12345","created_at":1417030496,"last_invoice":{"id":"in_tUCMhwlg2nkvAaL","date":1417030496,"client":"cli_90Pi6Jf0ndl_PP","subscription":"sub_8yYuCBKdywr7e2","amount":"123.45","currency":"pln","paid":true,"issuer_response_code":"00","attempts":1,"next_payment_attempt":null,"created_at":1417030497}}'
44
+ http_version:
45
+ recorded_at: Wed, 26 Nov 2014 19:42:58 GMT
46
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://sandbox.espago.com/api/subscriptions
6
+ body:
7
+ encoding: US-ASCII
8
+ string: plan=pl_12345&client=cli_90Pi6Jf0ndl_PP
9
+ headers:
10
+ Accept:
11
+ - application/vnd.espago.v2+json
12
+ Authorization:
13
+ - Basic YXBwX2lkX3Rlc3Q6YXBwX3Bhc3N3b3JkX3Rlc3Q=
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ X-Meta-Request-Version:
28
+ - 0.2.2
29
+ X-Ua-Compatible:
30
+ - IE=Edge
31
+ Etag:
32
+ - '"8a7a471581b59dfd11b76713db87dce9"'
33
+ Cache-Control:
34
+ - max-age=0, private, must-revalidate
35
+ Set-Cookie:
36
+ - _session_id=e1e08e4c938f82160380340d806c450d; path=/; HttpOnly
37
+ X-Request-Id:
38
+ - f95c468b308ee2f72f9726bf6cbd8be6
39
+ X-Runtime:
40
+ - '3.763953'
41
+ Connection:
42
+ - close
43
+ Server:
44
+ - thin 1.5.0 codename Knife
45
+ body:
46
+ encoding: UTF-8
47
+ string: '{"id":"sub_8yYuCBKdywr7e2","state":"active","client":"cli_90Pi6Jf0ndl_PP","plan":"pl_12345","created_at":1417030496,"last_invoice":{"id":"in_tUCMhwlg2nkvAaL","date":1417030496,"client":"cli_90Pi6Jf0ndl_PP","subscription":"sub_8yYuCBKdywr7e2","amount":"123.45","currency":"pln","paid":true,"issuer_response_code":"00","attempts":1,"next_payment_attempt":null,"created_at":1417030497}}'
48
+ http_version:
49
+ recorded_at: Wed, 26 Nov 2014 19:35:00 GMT
50
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandbox.espago.com/api/tokens/cc_166YDMhrVcemFb3
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/vnd.espago.v2+json
12
+ Authorization:
13
+ - Basic YXBwX2lkX3Rlc3Q6YXBwX3Bhc3N3b3JkX3Rlc3Q=
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ User-Agent:
17
+ - Ruby
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ X-Meta-Request-Version:
26
+ - 0.2.2
27
+ X-Ua-Compatible:
28
+ - IE=Edge
29
+ Etag:
30
+ - '"bebba4898713a5205954333a29c0e1cc"'
31
+ Cache-Control:
32
+ - max-age=0, private, must-revalidate
33
+ Set-Cookie:
34
+ - _session_id=eed7d2be93464a5f499c50ec411a3fa3; path=/; HttpOnly
35
+ X-Request-Id:
36
+ - 7554ad63074b0bbbadb71b495edad7fc
37
+ X-Runtime:
38
+ - '0.258735'
39
+ Connection:
40
+ - close
41
+ Server:
42
+ - thin 1.5.0 codename Knife
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"id":"cc_166YDMhrVcemFb3","created_at":1417029320,"used":false,"card":{"company":"VI","last4":"4242","year":2015,"month":2,"first_name":"Jan","last_name":"Kowalski","authorized":null,"created_at":1417029320}}'
46
+ http_version:
47
+ recorded_at: Wed, 26 Nov 2014 19:24:59 GMT
48
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://sandbox.espago.com/api/tokens
6
+ body:
7
+ encoding: US-ASCII
8
+ string: card%5Bfirst_name%5D=Jan&card%5Blast_name%5D=Kowalski&card%5Bnumber%5D=4242424242424242&card%5Bverification_value%5D=123&card%5Byear%5D=2015&card%5Bmonth%5D=2
9
+ headers:
10
+ Accept:
11
+ - application/vnd.espago.v2+json
12
+ Authorization:
13
+ - Basic YXBwX3B1YmxpY19rZXlfdGVzdDo=
14
+ Content-Type:
15
+ - application/x-www-form-urlencoded
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Access-Control-Allow-Origin:
26
+ - "*"
27
+ Access-Control-Allow-Methods:
28
+ - POST,OPTIONS
29
+ Access-Control-Allow-Headers:
30
+ - Origin,Accept,Content-Type,X-Requested-With,X-CSRF-Token,Authorization
31
+ Content-Type:
32
+ - application/json; charset=utf-8
33
+ X-Meta-Request-Version:
34
+ - 0.2.2
35
+ X-Ua-Compatible:
36
+ - IE=Edge
37
+ Etag:
38
+ - '"bebba4898713a5205954333a29c0e1cc"'
39
+ Cache-Control:
40
+ - max-age=0, private, must-revalidate
41
+ Set-Cookie:
42
+ - _session_id=255fbb3fda2057dc4cc956fe42d388b7; path=/; HttpOnly
43
+ X-Request-Id:
44
+ - fcb337aec80cff8ef25686049c0b46e7
45
+ X-Runtime:
46
+ - '0.553115'
47
+ Connection:
48
+ - close
49
+ Server:
50
+ - thin 1.5.0 codename Knife
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"id":"cc_166YDMhrVcemFb3","created_at":1417029320,"used":false,"card":{"company":"VI","last4":"4242","year":2015,"month":2,"first_name":"Jan","last_name":"Kowalski","authorized":null,"created_at":1417029320}}'
54
+ http_version:
55
+ recorded_at: Wed, 26 Nov 2014 19:15:20 GMT
56
+ recorded_with: VCR 2.9.3
data/spec/spec_helper.rb CHANGED
@@ -4,11 +4,39 @@
4
4
  # loaded once.
5
5
  #
6
6
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ require 'simplecov'
8
+ SimpleCov.start
9
+
10
+ require 'webmock/rspec'
11
+ require 'rspec/its'
12
+ require 'vcr'
13
+ require './lib/espago'
14
+ require 'byebug'
15
+
16
+ VCR.configure do |c|
17
+ c.default_cassette_options = {:record => :once, :serialize_with => :yaml}
18
+ c.cassette_library_dir = 'spec/fixtures/cassettes'
19
+ c.hook_into :webmock
20
+ end
21
+ #WebMock.allow_net_connect!
22
+ #VCR.turn_off!(:ignore_cassettes => false)
23
+ #VCR.turn_on!
24
+
7
25
  RSpec.configure do |config|
8
- config.treat_symbols_as_metadata_keys_with_true_values = true
9
26
  config.run_all_when_everything_filtered = true
10
27
  config.filter_run :focus
11
28
 
29
+ # config.raise_errors_for_deprecations!
30
+
31
+ config.before(:each) do
32
+ Espago.app_id = 'app_id_test'
33
+ Espago.app_password = 'app_password_test'
34
+ Espago.public_key = 'app_public_key_test'
35
+ Espago.production = false
36
+ Espago.api_version = '3'
37
+ end
38
+
39
+
12
40
  # Run specs in random order to surface order dependencies. If you find an
13
41
  # order dependency and want to debug it, you can fix the order by providing
14
42
  # the seed, which is printed after each run.