boletosimples 0.6.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -12
  3. data/README.md +21 -59
  4. data/lib/boletosimples/configuration.rb +25 -28
  5. data/lib/boletosimples/last_request.rb +17 -10
  6. data/lib/boletosimples/middlewares/bearer.rb +12 -0
  7. data/lib/boletosimples/middlewares/custom_headers.rb +12 -0
  8. data/lib/boletosimples/middlewares/debug.rb +30 -0
  9. data/lib/boletosimples/middlewares/last_request.rb +3 -1
  10. data/lib/boletosimples/middlewares/raise_error.rb +9 -2
  11. data/lib/boletosimples/middlewares/user_agent.rb +3 -1
  12. data/lib/boletosimples/resources/bank_billet.rb +5 -11
  13. data/lib/boletosimples/resources/bank_billet_account.rb +3 -1
  14. data/lib/boletosimples/resources/bank_billet_discharge.rb +3 -1
  15. data/lib/boletosimples/resources/bank_billet_payment.rb +3 -1
  16. data/lib/boletosimples/resources/bank_billet_remittance.rb +3 -1
  17. data/lib/boletosimples/resources/base_model.rb +3 -1
  18. data/lib/boletosimples/resources/customer.rb +3 -1
  19. data/lib/boletosimples/resources/customer_import.rb +5 -3
  20. data/lib/boletosimples/resources/customer_subscription.rb +3 -10
  21. data/lib/boletosimples/resources/customer_subscription_import.rb +5 -3
  22. data/lib/boletosimples/resources/discharge.rb +4 -11
  23. data/lib/boletosimples/resources/email_delivery.rb +3 -1
  24. data/lib/boletosimples/resources/event.rb +3 -1
  25. data/lib/boletosimples/resources/installment.rb +3 -1
  26. data/lib/boletosimples/resources/remittance.rb +3 -1
  27. data/lib/boletosimples/resources/sms_delivery.rb +6 -0
  28. data/lib/boletosimples/resources/transaction.rb +3 -1
  29. data/lib/boletosimples/resources/webhook.rb +3 -1
  30. data/lib/boletosimples/resources/webhook_delivery.rb +3 -1
  31. data/lib/boletosimples/response_error.rb +10 -5
  32. data/lib/boletosimples/version.rb +3 -1
  33. data/lib/boletosimples.rb +6 -6
  34. data/spec/boletosimples/configuration_spec.rb +67 -80
  35. data/spec/boletosimples/last_request_spec.rb +17 -28
  36. data/spec/boletosimples/middlewares/custom_headers_spec.rb +26 -0
  37. data/spec/boletosimples/resources/bank_billet_account_spec.rb +57 -33
  38. data/spec/boletosimples/resources/bank_billet_discharge_spec.rb +7 -12
  39. data/spec/boletosimples/resources/bank_billet_payment_spec.rb +7 -12
  40. data/spec/boletosimples/resources/bank_billet_remittance_spec.rb +7 -12
  41. data/spec/boletosimples/resources/bank_billet_spec.rb +56 -42
  42. data/spec/boletosimples/resources/customer_import_spec.rb +41 -30
  43. data/spec/boletosimples/resources/customer_spec.rb +57 -39
  44. data/spec/boletosimples/resources/customer_subscription_import_spec.rb +41 -30
  45. data/spec/boletosimples/resources/customer_subscription_spec.rb +61 -33
  46. data/spec/boletosimples/resources/discharge_spec.rb +64 -11
  47. data/spec/boletosimples/resources/email_delivery_spec.rb +6 -11
  48. data/spec/boletosimples/resources/event_spec.rb +7 -12
  49. data/spec/boletosimples/resources/installment_spec.rb +61 -32
  50. data/spec/boletosimples/resources/remittance_spec.rb +7 -12
  51. data/spec/boletosimples/resources/sms_delivery_spec.rb +12 -0
  52. data/spec/boletosimples/resources/transactions_spec.rb +7 -12
  53. data/spec/boletosimples/resources/webhook_delivery_spec.rb +7 -12
  54. data/spec/boletosimples/resources/webhook_spec.rb +7 -12
  55. data/spec/fixtures/discharge.RET +3 -0
  56. data/spec/fixtures/vcr_cassettes/custom_headers.yml +113 -0
  57. data/spec/fixtures/vcr_cassettes/last_request/bank_billets.yml +409 -95
  58. data/spec/fixtures/vcr_cassettes/resources/bank_billet/all.yml +101 -99
  59. data/spec/fixtures/vcr_cassettes/resources/bank_billet/cancel/success.yml +55 -95
  60. data/spec/fixtures/vcr_cassettes/resources/bank_billet/create/invalid_params.yml +55 -27
  61. data/spec/fixtures/vcr_cassettes/resources/bank_billet/create/invalid_root.yml +51 -24
  62. data/spec/fixtures/vcr_cassettes/resources/bank_billet/create/valid.yml +64 -34
  63. data/spec/fixtures/vcr_cassettes/resources/bank_billet/duplicate/success.yml +97 -0
  64. data/spec/fixtures/vcr_cassettes/resources/bank_billet/find.yml +73 -34
  65. data/spec/fixtures/vcr_cassettes/resources/bank_billet_account/all.yml +82 -27
  66. data/spec/fixtures/vcr_cassettes/resources/bank_billet_account/create/invalid_params.yml +57 -27
  67. data/spec/fixtures/vcr_cassettes/resources/bank_billet_account/create/invalid_root.yml +53 -26
  68. data/spec/fixtures/vcr_cassettes/resources/bank_billet_account/create/valid.yml +64 -28
  69. data/spec/fixtures/vcr_cassettes/resources/bank_billet_account/find.yml +61 -25
  70. data/spec/fixtures/vcr_cassettes/resources/bank_billet_discharge/all.yml +59 -46
  71. data/spec/fixtures/vcr_cassettes/resources/bank_billet_payment/all.yml +74 -71
  72. data/spec/fixtures/vcr_cassettes/resources/bank_billet_remittance/all.yml +63 -47
  73. data/spec/fixtures/vcr_cassettes/resources/customer/all.yml +141 -39
  74. data/spec/fixtures/vcr_cassettes/resources/customer/create/invalid_params.yml +54 -25
  75. data/spec/fixtures/vcr_cassettes/resources/customer/create/invalid_root.yml +54 -24
  76. data/spec/fixtures/vcr_cassettes/resources/customer/create/valid.yml +56 -28
  77. data/spec/fixtures/vcr_cassettes/resources/customer/find.yml +56 -26
  78. data/spec/fixtures/vcr_cassettes/resources/customer_import/all.yml +58 -59
  79. data/spec/fixtures/vcr_cassettes/resources/customer_import/create/invalid_params.yml +53 -51
  80. data/spec/fixtures/vcr_cassettes/resources/customer_import/create/invalid_root.yml +54 -52
  81. data/spec/fixtures/vcr_cassettes/resources/customer_import/create/valid.yml +58 -67
  82. data/spec/fixtures/vcr_cassettes/resources/customer_import/find.yml +55 -53
  83. data/spec/fixtures/vcr_cassettes/resources/customer_subscription/all.yml +65 -51
  84. data/spec/fixtures/vcr_cassettes/resources/customer_subscription/create/invalid_params.yml +56 -50
  85. data/spec/fixtures/vcr_cassettes/resources/customer_subscription/create/invalid_root.yml +52 -48
  86. data/spec/fixtures/vcr_cassettes/resources/customer_subscription/create/valid.yml +63 -52
  87. data/spec/fixtures/vcr_cassettes/resources/customer_subscription/find.yml +61 -51
  88. data/spec/fixtures/vcr_cassettes/resources/customer_subscription/next_charge.yml +60 -132
  89. data/spec/fixtures/vcr_cassettes/resources/customer_subscription_import/all.yml +58 -54
  90. data/spec/fixtures/vcr_cassettes/resources/customer_subscription_import/create/invalid_params.yml +53 -52
  91. data/spec/fixtures/vcr_cassettes/resources/customer_subscription_import/create/invalid_root.yml +55 -53
  92. data/spec/fixtures/vcr_cassettes/resources/customer_subscription_import/create/valid.yml +58 -69
  93. data/spec/fixtures/vcr_cassettes/resources/customer_subscription_import/find.yml +55 -54
  94. data/spec/fixtures/vcr_cassettes/resources/discharge/all.yml +63 -34
  95. data/spec/fixtures/vcr_cassettes/resources/discharge/create/invalid_params.yml +86 -0
  96. data/spec/fixtures/vcr_cassettes/resources/discharge/create/invalid_root.yml +85 -0
  97. data/spec/fixtures/vcr_cassettes/resources/discharge/create/valid.yml +100 -0
  98. data/spec/fixtures/vcr_cassettes/resources/discharge/find.yml +89 -0
  99. data/spec/fixtures/vcr_cassettes/resources/email_delivery/all.yml +40 -43
  100. data/spec/fixtures/vcr_cassettes/resources/event/all.yml +326 -167
  101. data/spec/fixtures/vcr_cassettes/resources/installment/all.yml +113 -51
  102. data/spec/fixtures/vcr_cassettes/resources/installment/create/invalid_params.yml +57 -52
  103. data/spec/fixtures/vcr_cassettes/resources/installment/create/invalid_root.yml +52 -48
  104. data/spec/fixtures/vcr_cassettes/resources/installment/create/valid.yml +63 -52
  105. data/spec/fixtures/vcr_cassettes/resources/installment/find.yml +83 -51
  106. data/spec/fixtures/vcr_cassettes/resources/remittance/all.yml +83 -62
  107. data/spec/fixtures/vcr_cassettes/resources/sns_delivery/all.yml +89 -0
  108. data/spec/fixtures/vcr_cassettes/resources/transaction/all.yml +73 -60
  109. data/spec/fixtures/vcr_cassettes/resources/web_hook/all.yml +59 -34
  110. data/spec/fixtures/vcr_cassettes/resources/webhook_delivery/all.yml +2684 -55
  111. data/spec/spec_helper.rb +3 -20
  112. data/spec/support/stub_env.rb +7 -0
  113. data/spec/support/vcr.rb +3 -4
  114. metadata +42 -176
  115. data/.coveralls.yml +0 -2
  116. data/.gitignore +0 -19
  117. data/.ruby-version +0 -1
  118. data/.travis.yml +0 -46
  119. data/Gemfile +0 -4
  120. data/Rakefile +0 -14
  121. data/boletosimples.gemspec +0 -38
  122. data/gemfiles/rails_42.gemfile +0 -8
  123. data/gemfiles/rails_50.gemfile +0 -8
  124. data/gemfiles/rails_51.gemfile +0 -8
  125. data/gemfiles/rails_52.gemfile +0 -9
  126. data/lib/boletosimples/extra.rb +0 -8
  127. data/lib/boletosimples/resources/partner/user.rb +0 -7
  128. data/lib/oauth2_patch.rb +0 -24
  129. data/spec/boletosimples/extra_spec.rb +0 -31
  130. data/spec/boletosimples/resources/partner/user_spec.rb +0 -19
  131. data/spec/fixtures/vcr_cassettes/configuration/client_credentials/invalid.yml +0 -64
  132. data/spec/fixtures/vcr_cassettes/configuration/client_credentials/valid.yml +0 -56
  133. data/spec/fixtures/vcr_cassettes/extra/userinfo/authenticated.yml +0 -58
  134. data/spec/fixtures/vcr_cassettes/extra/userinfo/not_authenticated.yml +0 -54
  135. data/spec/fixtures/vcr_cassettes/last_request/userinfo.yml +0 -58
  136. data/spec/fixtures/vcr_cassettes/resources/bank_billet/cancel/failure.yml +0 -118
  137. data/spec/fixtures/vcr_cassettes/resources/partner/user/create.yml +0 -60
  138. data/spec/spec.opts +0 -8
@@ -1,17 +1,70 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- # Before running this spec again, you need to set environment variable BOLETOSIMPLES_ACCESS_TOKEN
5
+ # Before running this spec again, you need to set environment variable BOLETOSIMPLES_API_TOKEN
6
6
  RSpec.describe BoletoSimples::Discharge do
7
- before {
8
- BoletoSimples.configure do |c|
9
- c.application_id = nil
10
- c.application_secret = nil
7
+ describe 'methods' do
8
+ before do
9
+ VCR.use_cassette('resources/discharge/create/valid') do
10
+ @discharge = described_class.create({
11
+ file: Faraday::UploadIO.new(
12
+ File.join(File.dirname(__FILE__), '..', '..',
13
+ 'fixtures', 'discharge.RET'), 'text/plain', 'discharge.RET'
14
+ )
15
+ })
16
+ end
17
+ end
18
+
19
+ describe 'create' do
20
+ context 'valid parameters' do
21
+ subject { @discharge }
22
+
23
+ it do
24
+ expect(subject).to be_a_kind_of(described_class)
25
+ expect(subject.response_errors).to eq({})
26
+ end
27
+ end
28
+
29
+ context 'invalid parameters' do
30
+ context 'empty bank_billet' do
31
+ subject do
32
+ VCR.use_cassette('resources/discharge/create/invalid_root') do
33
+ described_class.create({})
34
+ end
35
+ end
36
+
37
+ it {
38
+ expect(subject.response_errors).to eq([{ code: 422, status: 422,
39
+ title: 'discharge não pode ficar em branco' }])
40
+ }
41
+ end
42
+
43
+ context 'invalid params' do
44
+ subject do
45
+ VCR.use_cassette('resources/discharge/create/invalid_params') do
46
+ described_class.create({ content: '' })
47
+ end
48
+ end
49
+
50
+ it {
51
+ expect(subject.response_errors).to eq({ content: ['não pode ficar em branco'],
52
+ filename: ['não pode ficar em branco'] })
53
+ }
54
+ end
55
+ end
56
+ end
57
+
58
+ describe 'find', vcr: { cassette_name: 'resources/discharge/find' } do
59
+ subject { described_class.find(@discharge.id) }
60
+
61
+ it { expect(subject).to be_a_kind_of(described_class) }
62
+ end
63
+
64
+ describe 'all', vcr: { cassette_name: 'resources/discharge/all' } do
65
+ subject { described_class.all }
66
+
67
+ it { expect(subject.first).to be_a_kind_of(described_class) }
11
68
  end
12
- }
13
- describe 'all', vcr: { cassette_name: 'resources/discharge/all'} do
14
- subject { BoletoSimples::Discharge.all }
15
- it { expect(subject.first).to be_a_kind_of(BoletoSimples::Discharge) }
16
69
  end
17
- end
70
+ end
@@ -1,17 +1,12 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- # Before running this spec again, you need to set environment variable BOLETOSIMPLES_ACCESS_TOKEN
5
+ # Before running this spec again, you need to set environment variable BOLETOSIMPLES_API_TOKEN
6
6
  RSpec.describe BoletoSimples::EmailDelivery do
7
- before {
8
- BoletoSimples.configure do |c|
9
- c.application_id = nil
10
- c.application_secret = nil
11
- end
12
- }
13
- describe 'all', vcr: { cassette_name: 'resources/email_delivery/all'} do
14
- subject { BoletoSimples::EmailDelivery.all }
7
+ describe 'all', vcr: { cassette_name: 'resources/email_delivery/all' } do
8
+ subject { described_class.all }
9
+
15
10
  it { expect(subject.first).to be_nil }
16
11
  end
17
- end
12
+ end
@@ -1,17 +1,12 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- # Before running this spec again, you need to set environment variable BOLETOSIMPLES_ACCESS_TOKEN
5
+ # Before running this spec again, you need to set environment variable BOLETOSIMPLES_API_TOKEN
6
6
  RSpec.describe BoletoSimples::Event do
7
- before {
8
- BoletoSimples.configure do |c|
9
- c.application_id = nil
10
- c.application_secret = nil
11
- end
12
- }
13
- describe 'all', vcr: { cassette_name: 'resources/event/all'} do
14
- subject { BoletoSimples::Event.all }
15
- it { expect(subject.first).to be_a_kind_of(BoletoSimples::Event) }
7
+ describe 'all', vcr: { cassette_name: 'resources/event/all' } do
8
+ subject { described_class.all }
9
+
10
+ it { expect(subject.first).to be_a_kind_of(described_class) }
16
11
  end
17
- end
12
+ end
@@ -1,62 +1,91 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- # Before running this spec again, you need to set environment variable BOLETOSIMPLES_ACCESS_TOKEN
5
+ # Before running this spec again, you need to set environment variable BOLETOSIMPLES_API_TOKEN
6
6
  RSpec.describe BoletoSimples::Installment do
7
- before {
8
- BoletoSimples.configure do |c|
9
- c.application_id = nil
10
- c.application_secret = nil
11
- end
12
- }
13
7
  describe 'methods' do
14
- before {
8
+ before do
15
9
  VCR.use_cassette('resources/installment/create/valid') do
16
- @installment = BoletoSimples::Installment.create({
17
- customer_id: "11",
18
- bank_billet_account_id: "12",
19
- amount: "1.120,4",
20
- cycle: "monthly",
21
- start_at: "2016-09-15",
22
- total: "3",
23
- description: "Hospedagem"
24
- })
10
+ @installment = described_class.create(
11
+ amount: '1.120,4',
12
+ cycle: 'monthly',
13
+ start_at: '2022-09-15',
14
+ total: '3',
15
+ description: 'Hospedagem',
16
+ customer_address: 'Rua quinhentos',
17
+ customer_address_complement: 'Sala 4',
18
+ customer_address_number: '111',
19
+ customer_city_name: 'Rio de Janeiro',
20
+ customer_cnpj_cpf: '18.033.842/0001-05',
21
+ customer_email: 'cliente@example.com',
22
+ customer_neighborhood: 'Sao Francisco',
23
+ customer_person_name: 'Joao da Silva',
24
+ customer_person_type: 'individual',
25
+ customer_phone_number: '2112123434',
26
+ customer_state: 'RJ',
27
+ customer_zipcode: '12312-123'
28
+ )
25
29
  end
26
- }
30
+ end
31
+
27
32
  describe 'create' do
28
33
  context 'valid parameters' do
29
34
  subject { @installment }
30
- it { expect(subject).to be_a_kind_of(BoletoSimples::Installment) }
31
- it { expect(subject.response_errors).to eq({}) }
32
- it { expect(subject.attributes.keys).to match_array(["amount", "bank_billet_account_id", "created_at", "created_via_api", "customer_id", "cycle", "description", "end_at", "id", "instructions", "start_at", "status", "total", "updated_at"]) }
35
+
36
+ it do
37
+ expect(subject).to be_a_kind_of(described_class)
38
+ expect(subject.response_errors).to eq({})
39
+ end
33
40
  end
41
+
34
42
  context 'invalid parameters' do
35
43
  context 'empty bank_billet' do
36
- subject {
44
+ subject do
37
45
  VCR.use_cassette('resources/installment/create/invalid_root') do
38
- BoletoSimples::Installment.create({})
46
+ described_class.create({})
39
47
  end
48
+ end
49
+
50
+ it {
51
+ expect(subject.response_errors).to eq([{ code: 422, status: 422,
52
+ title: 'installment não pode ficar em branco' }])
40
53
  }
41
- it { expect(subject.response_errors).to eq({ :installment => ["não pode ficar em branco"] }) }
42
54
  end
55
+
43
56
  context 'invalid params' do
44
- subject {
57
+ subject do
45
58
  VCR.use_cassette('resources/installment/create/invalid_params') do
46
- BoletoSimples::Installment.create({ person_name: '' })
59
+ described_class.create({ person_name: '' })
47
60
  end
61
+ end
62
+
63
+ it {
64
+ expect(subject.response_errors).to eq({ customer_person_name: ['não pode ficar em branco'],
65
+ customer_cnpj_cpf: ['não é um CNPJ ou CPF válido'],
66
+ customer_zipcode: ['não pode ficar em branco'],
67
+ total: ['não pode ficar em branco', 'não é um número'],
68
+ start_at: ['não pode ficar em branco'],
69
+ amount: ['não pode ficar em branco'],
70
+ customer_address: ['não pode ficar em branco'],
71
+ customer_neighborhood: ['não pode ficar em branco'],
72
+ customer_city_name: ['não pode ficar em branco'],
73
+ customer_state: ['não está incluído na lista'] })
48
74
  }
49
- it { expect(subject.response_errors).to eq({ :customer=>["não pode ficar em branco"], :bank_billet_account=>["não pode ficar em branco"], :cycle=>["não pode ficar em branco", "não está incluído na lista"], :total=>["não pode ficar em branco"], :start_at=>["não pode ficar em branco"], :description=>["não pode ficar em branco"], :amount=>["deve ser maior que 0"] }) }
50
75
  end
51
76
  end
52
77
  end
78
+
53
79
  describe 'find', vcr: { cassette_name: 'resources/installment/find' } do
54
- subject { BoletoSimples::Installment.find(@installment.id) }
55
- it { expect(subject).to be_a_kind_of(BoletoSimples::Installment) }
80
+ subject { described_class.find(@installment.id) }
81
+
82
+ it { expect(subject).to be_a_kind_of(described_class) }
56
83
  end
84
+
57
85
  describe 'all', vcr: { cassette_name: 'resources/installment/all' } do
58
- subject { BoletoSimples::Installment.all }
59
- it { expect(subject.first).to be_a_kind_of(BoletoSimples::Installment) }
86
+ subject { described_class.all }
87
+
88
+ it { expect(subject.first).to be_a_kind_of(described_class) }
60
89
  end
61
90
  end
62
91
  end
@@ -1,17 +1,12 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- # Before running this spec again, you need to set environment variable BOLETOSIMPLES_ACCESS_TOKEN
5
+ # Before running this spec again, you need to set environment variable BOLETOSIMPLES_API_TOKEN
6
6
  RSpec.describe BoletoSimples::Remittance do
7
- before {
8
- BoletoSimples.configure do |c|
9
- c.application_id = nil
10
- c.application_secret = nil
11
- end
12
- }
13
- describe 'all', vcr: { cassette_name: 'resources/remittance/all'} do
14
- subject { BoletoSimples::Remittance.all }
15
- it { expect(subject.first).to be_a_kind_of(BoletoSimples::Remittance) }
7
+ describe 'all', vcr: { cassette_name: 'resources/remittance/all' } do
8
+ subject { described_class.all }
9
+
10
+ it { expect(subject.first).to be_a_kind_of(described_class) }
16
11
  end
17
- end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ # Before running this spec again, you need to set environment variable BOLETOSIMPLES_API_TOKEN
6
+ RSpec.describe BoletoSimples::SmsDelivery do
7
+ describe 'all', vcr: { cassette_name: 'resources/sns_delivery/all' } do
8
+ subject { described_class.all }
9
+
10
+ it { expect(subject.first).to be_nil }
11
+ end
12
+ end
@@ -1,17 +1,12 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- # Before running this spec again, you need to set environment variable BOLETOSIMPLES_ACCESS_TOKEN
5
+ # Before running this spec again, you need to set environment variable BOLETOSIMPLES_API_TOKEN
6
6
  RSpec.describe BoletoSimples::Transaction do
7
- before {
8
- BoletoSimples.configure do |c|
9
- c.application_id = nil
10
- c.application_secret = nil
11
- end
12
- }
13
- describe 'all', vcr: { cassette_name: 'resources/transaction/all'} do
14
- subject { BoletoSimples::Transaction.all }
15
- it { expect(subject.first).to be_a_kind_of(BoletoSimples::Transaction) }
7
+ describe 'all', vcr: { cassette_name: 'resources/transaction/all' } do
8
+ subject { described_class.all }
9
+
10
+ it { expect(subject.first).to be_a_kind_of(described_class) }
16
11
  end
17
- end
12
+ end
@@ -1,17 +1,12 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- # Before running this spec again, you need to set environment variable BOLETOSIMPLES_ACCESS_TOKEN
5
+ # Before running this spec again, you need to set environment variable BOLETOSIMPLES_API_TOKEN
6
6
  RSpec.describe BoletoSimples::WebhookDelivery do
7
- before {
8
- BoletoSimples.configure do |c|
9
- c.application_id = nil
10
- c.application_secret = nil
11
- end
12
- }
13
- describe 'all', vcr: { cassette_name: 'resources/webhook_delivery/all'} do
14
- subject { BoletoSimples::WebhookDelivery.all }
15
- it { expect(subject.first).to be_a_kind_of(BoletoSimples::WebhookDelivery) }
7
+ describe 'all', vcr: { cassette_name: 'resources/webhook_delivery/all' } do
8
+ subject { described_class.all }
9
+
10
+ it { expect(subject.first).to be_a_kind_of(described_class) }
16
11
  end
17
- end
12
+ end
@@ -1,17 +1,12 @@
1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- # Before running this spec again, you need to set environment variable BOLETOSIMPLES_ACCESS_TOKEN
5
+ # Before running this spec again, you need to set environment variable BOLETOSIMPLES_API_TOKEN
6
6
  RSpec.describe BoletoSimples::Webhook do
7
- before {
8
- BoletoSimples.configure do |c|
9
- c.application_id = nil
10
- c.application_secret = nil
11
- end
12
- }
13
- describe 'all', vcr: { cassette_name: 'resources/web_hook/all'} do
14
- subject { BoletoSimples::Webhook.all }
15
- it { expect(subject.first).to be_a_kind_of(BoletoSimples::Webhook) }
7
+ describe 'all', vcr: { cassette_name: 'resources/web_hook/all' } do
8
+ subject { described_class.all }
9
+
10
+ it { expect(subject.first).to be_a_kind_of(described_class) }
16
11
  end
17
- end
12
+ end
@@ -0,0 +1,3 @@
1
+ 02RETORNO01COBRANCA 16511300049999999999 SISTEMAS S.A 033SANTANDER 20032000000000009483012 325000001
2
+ 1027879661300014165199000999990009999 04958535 510200320495853 0495853500 12111900000000300350331651901000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 N 200320 SOLUCOES DIGITAIS L 00000000000000000000000000000000000000000C 325000002
3
+ 9201033 000025050000053763329700000518 000000000000000000000000000000 000000000000000000000000000000 325000632
@@ -0,0 +1,113 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api-sandbox.kobana.com.br/v1/bank_billets?page=2
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Authorization:
11
+ - Bearer BOLETOSIMPLES_API_TOKEN
12
+ X-Custom:
13
+ - CONTENT
14
+ Accept:
15
+ - application/json
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: 200
23
+ message: OK
24
+ headers:
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Server:
32
+ - Cowboy
33
+ X-Frame-Options:
34
+ - DENY
35
+ X-Xss-Protection:
36
+ - 1; mode=block
37
+ X-Content-Type-Options:
38
+ - nosniff
39
+ X-Download-Options:
40
+ - noopen
41
+ X-Permitted-Cross-Domain-Policies:
42
+ - none
43
+ Referrer-Policy:
44
+ - strict-origin-when-cross-origin
45
+ Expect-Ct:
46
+ - max-age=0, report-uri="https://boletosimples.report-uri.com/r/d/ct/reportOnly"
47
+ Cross-Origin-Resource-Policy:
48
+ - cross-origin
49
+ Cross-Origin-Embedder-Policy:
50
+ - unsafe-none
51
+ Cross-Origin-Opener-Policy:
52
+ - unsafe-none
53
+ Link:
54
+ - <https://api-sandbox.kobana.com.br/api/v1/bank_billets?page=1>; rel="first",
55
+ <https://api-sandbox.kobana.com.br/api/v1/bank_billets?page=>; rel="prev",
56
+ <https://api-sandbox.kobana.com.br/api/v1/bank_billets?page=>; rel="next"
57
+ Per-Page:
58
+ - '50'
59
+ Page:
60
+ - '2'
61
+ X-Ratelimit-Limit:
62
+ - '60'
63
+ X-Ratelimit-Remaining:
64
+ - '59'
65
+ Etag:
66
+ - W/"4f53cda18c2baa0c0354bb5f9a3ecbe5"
67
+ Cache-Control:
68
+ - must-revalidate, private, max-age=0
69
+ Content-Security-Policy-Report-Only:
70
+ - 'default-src ''self'' https: app-sandbox.kobana.com.br; font-src ''self''
71
+ https: data: app-sandbox.kobana.com.br fonts.googleapis.com fonts.gstatic.com
72
+ themes.googleusercontent.com; img-src ''self'' https: data: maps.googleapis.com
73
+ bole.test:5001 bole.to www.google-analytics.com boletosimples-sandbox.s3.amazonaws.com
74
+ d3caatrp30sdc5.cloudfront.net; object-src ''self'' https: app-sandbox.kobana.com.br;
75
+ media-src ''self'' https: data: app-sandbox.kobana.com.br; script-src ''self''
76
+ https: ''unsafe-inline'' app-sandbox.kobana.com.br zapier.com www.google-analytics.com
77
+ www.googleadservices.com app.popupdomination.com js-agent.newrelic.com doug1izaerwt3.cloudfront.net
78
+ cdn.ywxi.net bam.nr-data.net cdnjs.cloudflare.com widget.pluga.co www.google.com
79
+ www.gstatic.com cdn.mxpnl.com cdn.amplitude.com www.draw.io; style-src ''self''
80
+ https: ''unsafe-inline'' app-sandbox.kobana.com.br fonts.googleapis.com; child-src
81
+ ''self'' app-sandbox.kobana.com.br www.googleadservices.com docs.google.com
82
+ googleads.g.doubleclick.net www.google.com www.google.com.br app.popupdomination.com
83
+ bid.g.doubleclick.net widget.pluga.co www.googletagmanager.com www.facebook.com
84
+ www.youtube.com; connect-src ''self'' https: ws: wss: boletosimples.com.br
85
+ *.boletosimples.com.br kobana.com.br *.kobana.com.br api.mixpanel.com *.cloudfront.net
86
+ *.google-analytics.com *.amplitude.com; report-uri https://boletosimples.report-uri.com/r/d/csp/reportOnly'
87
+ X-Request-Id:
88
+ - 97404e79-3ee9-4b3b-ac85-73bf55a49eb9
89
+ X-Runtime:
90
+ - '0.031604'
91
+ Date:
92
+ - Mon, 16 May 2022 01:47:15 GMT
93
+ X-Rack-Cache:
94
+ - miss
95
+ Strict-Transport-Security:
96
+ - max-age=31556952; includeSubDomains; preload
97
+ Vary:
98
+ - Origin,Accept-Encoding
99
+ X-Rack-Cors:
100
+ - miss; no-origin
101
+ Via:
102
+ - 1.1 vegur, 1.1 5d90b9fb6ab804caa33b8aa5260094e8.cloudfront.net (CloudFront)
103
+ X-Cache:
104
+ - Miss from cloudfront
105
+ X-Amz-Cf-Pop:
106
+ - BOS50-C3
107
+ X-Amz-Cf-Id:
108
+ - BgmGgAdTdYoBOyDh0-HynXgB_vgYgX8s41CtoUxRaGOuAtdOJer_-A==
109
+ body:
110
+ encoding: UTF-8
111
+ string: "[]"
112
+ recorded_at: Mon, 16 May 2022 01:47:14 GMT
113
+ recorded_with: VCR 6.1.0