boletosimples 0.4.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +6 -14
  3. data/README.md +12 -54
  4. data/lib/boletosimples.rb +10 -6
  5. data/lib/boletosimples/configuration.rb +18 -33
  6. data/lib/boletosimples/last_request.rb +12 -9
  7. data/lib/boletosimples/middlewares/bearer.rb +12 -0
  8. data/lib/boletosimples/middlewares/last_request.rb +3 -1
  9. data/lib/boletosimples/middlewares/raise_error.rb +9 -2
  10. data/lib/boletosimples/middlewares/user_agent.rb +3 -1
  11. data/lib/boletosimples/resources/bank_billet.rb +5 -11
  12. data/lib/boletosimples/resources/bank_billet_account.rb +3 -1
  13. data/lib/boletosimples/resources/bank_billet_discharge.rb +6 -0
  14. data/lib/boletosimples/resources/bank_billet_payment.rb +6 -0
  15. data/lib/boletosimples/resources/bank_billet_remittance.rb +6 -0
  16. data/lib/boletosimples/resources/base_model.rb +3 -1
  17. data/lib/boletosimples/resources/customer.rb +3 -1
  18. data/lib/boletosimples/resources/customer_import.rb +8 -0
  19. data/lib/boletosimples/resources/customer_subscription.rb +3 -10
  20. data/lib/boletosimples/resources/customer_subscription_import.rb +8 -0
  21. data/lib/boletosimples/resources/discharge.rb +4 -11
  22. data/lib/boletosimples/resources/email_delivery.rb +6 -0
  23. data/lib/boletosimples/resources/event.rb +3 -1
  24. data/lib/boletosimples/resources/installment.rb +3 -1
  25. data/lib/boletosimples/resources/remittance.rb +3 -1
  26. data/lib/boletosimples/resources/sms_delivery.rb +6 -0
  27. data/lib/boletosimples/resources/transaction.rb +3 -1
  28. data/lib/boletosimples/resources/webhook.rb +3 -1
  29. data/lib/boletosimples/resources/webhook_delivery.rb +3 -1
  30. data/lib/boletosimples/response_error.rb +8 -3
  31. data/lib/boletosimples/version.rb +3 -1
  32. data/spec/boletosimples/configuration_spec.rb +71 -83
  33. data/spec/boletosimples/last_request_spec.rb +16 -28
  34. data/spec/boletosimples/resources/bank_billet_account_spec.rb +57 -33
  35. data/spec/boletosimples/resources/bank_billet_discharge_spec.rb +12 -0
  36. data/spec/boletosimples/resources/bank_billet_payment_spec.rb +12 -0
  37. data/spec/boletosimples/resources/bank_billet_remittance_spec.rb +12 -0
  38. data/spec/boletosimples/resources/bank_billet_spec.rb +56 -42
  39. data/spec/boletosimples/resources/customer_import_spec.rb +67 -0
  40. data/spec/boletosimples/resources/customer_spec.rb +52 -39
  41. data/spec/boletosimples/resources/customer_subscription_import_spec.rb +67 -0
  42. data/spec/boletosimples/resources/customer_subscription_spec.rb +61 -33
  43. data/spec/boletosimples/resources/discharge_spec.rb +64 -11
  44. data/spec/boletosimples/resources/email_delivery_spec.rb +12 -0
  45. data/spec/boletosimples/resources/event_spec.rb +7 -12
  46. data/spec/boletosimples/resources/installment_spec.rb +61 -32
  47. data/spec/boletosimples/resources/remittance_spec.rb +7 -12
  48. data/spec/boletosimples/resources/sms_delivery_spec.rb +12 -0
  49. data/spec/boletosimples/resources/transactions_spec.rb +7 -12
  50. data/spec/boletosimples/resources/webhook_delivery_spec.rb +7 -12
  51. data/spec/boletosimples/resources/webhook_spec.rb +7 -12
  52. data/spec/fixtures/customer_imports.csv +1 -0
  53. data/spec/fixtures/customer_subscription_imports.csv +1 -0
  54. data/spec/fixtures/discharge.RET +3 -0
  55. data/spec/fixtures/vcr_cassettes/last_request/bank_billets.yml +536 -88
  56. data/spec/fixtures/vcr_cassettes/resources/bank_billet/all.yml +537 -91
  57. data/spec/fixtures/vcr_cassettes/resources/bank_billet/cancel/success.yml +34 -92
  58. data/spec/fixtures/vcr_cassettes/resources/bank_billet/create/invalid_params.yml +32 -20
  59. data/spec/fixtures/vcr_cassettes/resources/bank_billet/create/invalid_root.yml +28 -17
  60. data/spec/fixtures/vcr_cassettes/resources/bank_billet/create/valid.yml +43 -27
  61. data/spec/fixtures/vcr_cassettes/resources/bank_billet/duplicate/success.yml +83 -0
  62. data/spec/fixtures/vcr_cassettes/resources/bank_billet/find.yml +51 -27
  63. data/spec/fixtures/vcr_cassettes/resources/bank_billet_account/all.yml +131 -20
  64. data/spec/fixtures/vcr_cassettes/resources/bank_billet_account/create/invalid_params.yml +34 -20
  65. data/spec/fixtures/vcr_cassettes/resources/bank_billet_account/create/invalid_root.yml +30 -19
  66. data/spec/fixtures/vcr_cassettes/resources/bank_billet_account/create/valid.yml +41 -21
  67. data/spec/fixtures/vcr_cassettes/resources/bank_billet_account/find.yml +38 -18
  68. data/spec/fixtures/vcr_cassettes/resources/bank_billet_discharge/all.yml +97 -0
  69. data/spec/fixtures/vcr_cassettes/resources/bank_billet_payment/all.yml +75 -0
  70. data/spec/fixtures/vcr_cassettes/resources/bank_billet_remittance/all.yml +126 -0
  71. data/spec/fixtures/vcr_cassettes/resources/customer/all.yml +79 -32
  72. data/spec/fixtures/vcr_cassettes/resources/customer/create/invalid_params.yml +30 -17
  73. data/spec/fixtures/vcr_cassettes/resources/customer/create/invalid_root.yml +28 -17
  74. data/spec/fixtures/vcr_cassettes/resources/customer/create/valid.yml +33 -21
  75. data/spec/fixtures/vcr_cassettes/resources/customer/find.yml +33 -19
  76. data/spec/fixtures/vcr_cassettes/resources/customer_import/all.yml +74 -0
  77. data/spec/fixtures/vcr_cassettes/resources/customer_import/create/invalid_params.yml +69 -0
  78. data/spec/fixtures/vcr_cassettes/resources/customer_import/create/invalid_root.yml +69 -0
  79. data/spec/fixtures/vcr_cassettes/resources/customer_import/create/valid.yml +76 -0
  80. data/spec/fixtures/vcr_cassettes/resources/customer_import/find.yml +71 -0
  81. data/spec/fixtures/vcr_cassettes/resources/customer_subscription/all.yml +102 -52
  82. data/spec/fixtures/vcr_cassettes/resources/customer_subscription/create/invalid_params.yml +40 -50
  83. data/spec/fixtures/vcr_cassettes/resources/customer_subscription/create/invalid_root.yml +36 -48
  84. data/spec/fixtures/vcr_cassettes/resources/customer_subscription/create/valid.yml +48 -53
  85. data/spec/fixtures/vcr_cassettes/resources/customer_subscription/find.yml +44 -50
  86. data/spec/fixtures/vcr_cassettes/resources/customer_subscription/next_charge.yml +45 -133
  87. data/spec/fixtures/vcr_cassettes/resources/customer_subscription_import/all.yml +75 -0
  88. data/spec/fixtures/vcr_cassettes/resources/customer_subscription_import/create/invalid_params.yml +69 -0
  89. data/spec/fixtures/vcr_cassettes/resources/customer_subscription_import/create/invalid_root.yml +70 -0
  90. data/spec/fixtures/vcr_cassettes/resources/customer_subscription_import/create/valid.yml +76 -0
  91. data/spec/fixtures/vcr_cassettes/resources/customer_subscription_import/find.yml +71 -0
  92. data/spec/fixtures/vcr_cassettes/resources/discharge/all.yml +64 -33
  93. data/spec/fixtures/vcr_cassettes/resources/discharge/create/invalid_params.yml +70 -0
  94. data/spec/fixtures/vcr_cassettes/resources/discharge/create/invalid_root.yml +69 -0
  95. data/spec/fixtures/vcr_cassettes/resources/discharge/create/valid.yml +84 -0
  96. data/spec/fixtures/vcr_cassettes/resources/discharge/find.yml +71 -0
  97. data/spec/fixtures/vcr_cassettes/resources/email_delivery/all.yml +73 -0
  98. data/spec/fixtures/vcr_cassettes/resources/event/all.yml +490 -166
  99. data/spec/fixtures/vcr_cassettes/resources/installment/all.yml +418 -52
  100. data/spec/fixtures/vcr_cassettes/resources/installment/create/invalid_params.yml +41 -52
  101. data/spec/fixtures/vcr_cassettes/resources/installment/create/invalid_root.yml +36 -48
  102. data/spec/fixtures/vcr_cassettes/resources/installment/create/valid.yml +48 -53
  103. data/spec/fixtures/vcr_cassettes/resources/installment/find.yml +44 -52
  104. data/spec/fixtures/vcr_cassettes/resources/remittance/all.yml +53 -33
  105. data/spec/fixtures/vcr_cassettes/resources/sns_delivery/all.yml +73 -0
  106. data/spec/fixtures/vcr_cassettes/resources/transaction/all.yml +34 -22
  107. data/spec/fixtures/vcr_cassettes/resources/web_hook/all.yml +42 -33
  108. data/spec/fixtures/vcr_cassettes/resources/webhook_delivery/all.yml +1232 -54
  109. data/spec/spec_helper.rb +3 -20
  110. data/spec/support/stub_env.rb +7 -0
  111. data/spec/support/vcr.rb +3 -4
  112. metadata +190 -82
  113. data/.coveralls.yml +0 -2
  114. data/.gitignore +0 -19
  115. data/.ruby-gemset +0 -1
  116. data/.ruby-version +0 -1
  117. data/.travis.yml +0 -11
  118. data/Gemfile +0 -4
  119. data/Rakefile +0 -6
  120. data/boletosimples.gemspec +0 -37
  121. data/lib/boletosimples/extra.rb +0 -8
  122. data/lib/boletosimples/resources/partner/user.rb +0 -7
  123. data/lib/oauth2_patch.rb +0 -24
  124. data/spec/boletosimples/extra_spec.rb +0 -31
  125. data/spec/boletosimples/resources/partner/user_spec.rb +0 -19
  126. data/spec/fixtures/vcr_cassettes/configuration/client_credentials/invalid.yml +0 -64
  127. data/spec/fixtures/vcr_cassettes/configuration/client_credentials/valid.yml +0 -56
  128. data/spec/fixtures/vcr_cassettes/extra/userinfo/authenticated.yml +0 -58
  129. data/spec/fixtures/vcr_cassettes/extra/userinfo/not_authenticated.yml +0 -54
  130. data/spec/fixtures/vcr_cassettes/last_request/userinfo.yml +0 -58
  131. data/spec/fixtures/vcr_cassettes/resources/bank_billet/cancel/failure.yml +0 -118
  132. data/spec/fixtures/vcr_cassettes/resources/partner/user/create.yml +0 -60
  133. data/spec/spec.opts +0 -8
@@ -1,118 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://sandbox.boletosimples.com.br/api/v1/bank_billets/863?access_token=BOLETOSIMPLES_ACCESS_TOKEN
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - BoletoSimples Ruby Client v0.1.1 (contato@boletosimples.com.br)
12
- Authorization:
13
- - Token token="BOLETOSIMPLES_ACCESS_TOKEN"
14
- Accept-Encoding:
15
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
- Accept:
17
- - "*/*"
18
- response:
19
- status:
20
- code: 200
21
- message: OK
22
- headers:
23
- Server:
24
- - Cowboy
25
- Connection:
26
- - keep-alive
27
- Strict-Transport-Security:
28
- - max-age=2592000
29
- Content-Type:
30
- - application/json; charset=utf-8
31
- X-Ratelimit-Limit:
32
- - '500'
33
- X-Ratelimit-Remaining:
34
- - '476'
35
- Etag:
36
- - W/"c607d4b12f290939443ba87e9694bd72"
37
- Cache-Control:
38
- - must-revalidate, private, max-age=0
39
- X-Request-Id:
40
- - 1f3ceac5-3ed4-42b2-9365-83440f8f578d
41
- X-Runtime:
42
- - '0.033791'
43
- Date:
44
- - Sun, 08 Mar 2015 21:15:40 GMT
45
- X-Rack-Cache:
46
- - miss
47
- Vary:
48
- - Accept-Encoding
49
- Transfer-Encoding:
50
- - chunked
51
- Via:
52
- - 1.1 vegur
53
- body:
54
- encoding: UTF-8
55
- string: '{"id":863,"expire_at":"2014-01-01","paid_at":"2015-03-08","description":"Despesas
56
- do contrato 0012","status":"paid","shorten_url":"http://staging.bole.to/nis1avf8","customer_person_type":"individual","customer_person_name":"Joao
57
- da Silva","customer_cnpj_cpf":"012.345.678-90","customer_address":"Rua quinhentos","customer_state":"RJ","customer_neighborhood":"Sao
58
- Francisco","customer_zipcode":"12312-123","customer_address_number":"111","customer_address_complement":"Sala
59
- 4","customer_phone_number":"2112123434","customer_email":"cliente@example.com","notification_url":null,"send_email_on_creation":null,"created_via_api":true,"customer_city_name":"Rio
60
- de Janeiro","paid_amount":9.01,"amount":9.01}'
61
- http_version:
62
- recorded_at: Sun, 08 Mar 2015 21:15:40 GMT
63
- - request:
64
- method: put
65
- uri: https://sandbox.boletosimples.com.br/api/v1/bank_billets/863/cancel?access_token=BOLETOSIMPLES_ACCESS_TOKEN
66
- body:
67
- encoding: UTF-8
68
- string: "{}"
69
- headers:
70
- User-Agent:
71
- - BoletoSimples Ruby Client v0.1.1 (contato@boletosimples.com.br)
72
- Authorization:
73
- - Token token="BOLETOSIMPLES_ACCESS_TOKEN"
74
- Content-Type:
75
- - application/json
76
- Accept-Encoding:
77
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
78
- Accept:
79
- - "*/*"
80
- response:
81
- status:
82
- code: 422
83
- message: Unprocessable Entity
84
- headers:
85
- Server:
86
- - Cowboy
87
- Connection:
88
- - keep-alive
89
- Strict-Transport-Security:
90
- - max-age=2592000
91
- Content-Type:
92
- - application/json; charset=utf-8
93
- X-Ratelimit-Limit:
94
- - '500'
95
- X-Ratelimit-Remaining:
96
- - '475'
97
- Cache-Control:
98
- - no-cache
99
- X-Request-Id:
100
- - c81a3615-db53-4419-806d-5e35dc23aee8
101
- X-Runtime:
102
- - '0.035312'
103
- Date:
104
- - Sun, 08 Mar 2015 21:15:41 GMT
105
- X-Rack-Cache:
106
- - invalidate, pass
107
- Vary:
108
- - Accept-Encoding
109
- Transfer-Encoding:
110
- - chunked
111
- Via:
112
- - 1.1 vegur
113
- body:
114
- encoding: UTF-8
115
- string: '{"errors":{"status":["cannot transition via cancel"]}}'
116
- http_version:
117
- recorded_at: Sun, 08 Mar 2015 21:15:40 GMT
118
- recorded_with: VCR 2.9.3
@@ -1,60 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://sandbox.boletosimples.com.br/api/v1/partner/users?access_token=BOLETOSIMPLES_CLIENT_CREDENTIALS_TOKEN
6
- body:
7
- encoding: UTF-8
8
- string: '{"user":{"email":"user2@example.com"}}'
9
- headers:
10
- User-Agent:
11
- - BoletoSimples Ruby Client v0.1.0 (contato@boletosimples.com.br)
12
- Authorization:
13
- - Token token="BOLETOSIMPLES_CLIENT_CREDENTIALS_TOKEN"
14
- Content-Type:
15
- - application/json
16
- Accept-Encoding:
17
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
- Accept:
19
- - "*/*"
20
- response:
21
- status:
22
- code: 201
23
- message: Created
24
- headers:
25
- Server:
26
- - Cowboy
27
- Connection:
28
- - keep-alive
29
- Strict-Transport-Security:
30
- - max-age=2592000
31
- Content-Type:
32
- - application/json; charset=utf-8
33
- X-Ratelimit-Limit:
34
- - '500'
35
- X-Ratelimit-Remaining:
36
- - '499'
37
- Etag:
38
- - W/"ece5dc3afb4325911152bfc2bfc04d45"
39
- Cache-Control:
40
- - max-age=0, private, must-revalidate
41
- X-Request-Id:
42
- - 23bd5205-8955-4316-887f-b9e92643908b
43
- X-Runtime:
44
- - '4.385478'
45
- Date:
46
- - Sun, 08 Mar 2015 20:02:43 GMT
47
- X-Rack-Cache:
48
- - invalidate, pass
49
- Vary:
50
- - Accept-Encoding
51
- Transfer-Encoding:
52
- - chunked
53
- Via:
54
- - 1.1 vegur
55
- body:
56
- encoding: UTF-8
57
- string: '{"id":60,"email":"user2@example.com","account_type":null,"sex":null,"cpf":null,"address_street_name":null,"address_state":null,"address_neighborhood":null,"address_postal_code":null,"address_number":null,"address_complement":null,"phone_number":null,"withdrawal_period":"biweekly","notification_url":null,"first_name":null,"middle_name":null,"last_name":null,"date_of_birth":null,"business_category":null,"business_subcategory":null,"business_website":null,"business_name":null,"business_legal_name":null,"business_type":null,"business_cnpj":null,"address_city_name":null,"full_name":null,"login_url":"https://sandbox.boletosimples.com.br/welcome?email=user2%40example.com\u0026token=xxx","mother_name":null,"father_name":null,"application_access_token":"xxx"}'
58
- http_version:
59
- recorded_at: Sun, 08 Mar 2015 20:02:42 GMT
60
- recorded_with: VCR 2.9.3
data/spec/spec.opts DELETED
@@ -1,8 +0,0 @@
1
- --colour
2
- --format
3
- progress
4
- --loadby
5
- mtime
6
- --reverse
7
- -rubygems
8
- --debugger