boletosimples 1.0.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +6 -7
- data/lib/boletosimples/configuration.rb +2 -2
- data/lib/boletosimples/response_error.rb +2 -2
- data/lib/boletosimples/version.rb +1 -1
- data/spec/boletosimples/configuration_spec.rb +3 -3
- data/spec/boletosimples/resources/bank_billet_spec.rb +2 -2
- data/spec/boletosimples/resources/customer_spec.rb +9 -4
- data/spec/boletosimples/resources/customer_subscription_spec.rb +1 -1
- data/spec/boletosimples/resources/installment_spec.rb +1 -1
- data/spec/fixtures/vcr_cassettes/last_request/bank_billets.yml +386 -520
- data/spec/fixtures/vcr_cassettes/resources/bank_billet/all.yml +78 -522
- data/spec/fixtures/vcr_cassettes/resources/bank_billet/cancel/success.yml +30 -12
- data/spec/fixtures/vcr_cassettes/resources/bank_billet/create/invalid_params.yml +32 -16
- data/spec/fixtures/vcr_cassettes/resources/bank_billet/create/invalid_root.yml +31 -15
- data/spec/fixtures/vcr_cassettes/resources/bank_billet/create/valid.yml +42 -28
- data/spec/fixtures/vcr_cassettes/resources/bank_billet/duplicate/success.yml +41 -27
- data/spec/fixtures/vcr_cassettes/resources/bank_billet/find.yml +46 -31
- data/spec/fixtures/vcr_cassettes/resources/bank_billet_account/all.yml +47 -103
- data/spec/fixtures/vcr_cassettes/resources/bank_billet_account/create/invalid_params.yml +31 -15
- data/spec/fixtures/vcr_cassettes/resources/bank_billet_account/create/invalid_root.yml +31 -15
- data/spec/fixtures/vcr_cassettes/resources/bank_billet_account/create/valid.yml +35 -19
- data/spec/fixtures/vcr_cassettes/resources/bank_billet_account/find.yml +35 -19
- data/spec/fixtures/vcr_cassettes/resources/bank_billet_discharge/all.yml +35 -41
- data/spec/fixtures/vcr_cassettes/resources/bank_billet_payment/all.yml +73 -72
- data/spec/fixtures/vcr_cassettes/resources/bank_billet_remittance/all.yml +39 -70
- data/spec/fixtures/vcr_cassettes/resources/customer/all.yml +111 -56
- data/spec/fixtures/vcr_cassettes/resources/customer/create/invalid_params.yml +35 -19
- data/spec/fixtures/vcr_cassettes/resources/customer/create/invalid_root.yml +35 -16
- data/spec/fixtures/vcr_cassettes/resources/customer/create/valid.yml +37 -21
- data/spec/fixtures/vcr_cassettes/resources/customer/find.yml +36 -20
- data/spec/fixtures/vcr_cassettes/resources/customer_import/all.yml +34 -18
- data/spec/fixtures/vcr_cassettes/resources/customer_import/create/invalid_params.yml +31 -15
- data/spec/fixtures/vcr_cassettes/resources/customer_import/create/invalid_root.yml +31 -15
- data/spec/fixtures/vcr_cassettes/resources/customer_import/create/valid.yml +36 -20
- data/spec/fixtures/vcr_cassettes/resources/customer_import/find.yml +34 -18
- data/spec/fixtures/vcr_cassettes/resources/customer_subscription/all.yml +35 -71
- data/spec/fixtures/vcr_cassettes/resources/customer_subscription/create/invalid_params.yml +32 -16
- data/spec/fixtures/vcr_cassettes/resources/customer_subscription/create/invalid_root.yml +31 -15
- data/spec/fixtures/vcr_cassettes/resources/customer_subscription/create/valid.yml +35 -19
- data/spec/fixtures/vcr_cassettes/resources/customer_subscription/find.yml +36 -20
- data/spec/fixtures/vcr_cassettes/resources/customer_subscription/next_charge.yml +36 -20
- data/spec/fixtures/vcr_cassettes/resources/customer_subscription_import/all.yml +34 -19
- data/spec/fixtures/vcr_cassettes/resources/customer_subscription_import/create/invalid_params.yml +31 -15
- data/spec/fixtures/vcr_cassettes/resources/customer_subscription_import/create/invalid_root.yml +31 -15
- data/spec/fixtures/vcr_cassettes/resources/customer_subscription_import/create/valid.yml +36 -20
- data/spec/fixtures/vcr_cassettes/resources/customer_subscription_import/find.yml +34 -18
- data/spec/fixtures/vcr_cassettes/resources/discharge/all.yml +37 -39
- data/spec/fixtures/vcr_cassettes/resources/discharge/create/invalid_params.yml +31 -15
- data/spec/fixtures/vcr_cassettes/resources/discharge/create/invalid_root.yml +31 -15
- data/spec/fixtures/vcr_cassettes/resources/discharge/create/valid.yml +37 -21
- data/spec/fixtures/vcr_cassettes/resources/discharge/find.yml +36 -18
- data/spec/fixtures/vcr_cassettes/resources/email_delivery/all.yml +1 -1
- data/spec/fixtures/vcr_cassettes/resources/event/all.yml +267 -432
- data/spec/fixtures/vcr_cassettes/resources/installment/all.yml +71 -375
- data/spec/fixtures/vcr_cassettes/resources/installment/create/invalid_params.yml +32 -16
- data/spec/fixtures/vcr_cassettes/resources/installment/create/invalid_root.yml +31 -15
- data/spec/fixtures/vcr_cassettes/resources/installment/create/valid.yml +35 -19
- data/spec/fixtures/vcr_cassettes/resources/installment/find.yml +59 -19
- data/spec/fixtures/vcr_cassettes/resources/remittance/all.yml +82 -81
- data/spec/fixtures/vcr_cassettes/resources/sns_delivery/all.yml +31 -15
- data/spec/fixtures/vcr_cassettes/resources/transaction/all.yml +72 -71
- data/spec/fixtures/vcr_cassettes/resources/web_hook/all.yml +33 -17
- data/spec/fixtures/vcr_cassettes/resources/webhook_delivery/all.yml +2657 -1206
- metadata +5 -186
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45f7d3c3d88c50c61728838d4c3b1e3664c8dd555cadb1d57379220d51aaba9a
|
4
|
+
data.tar.gz: ea7d7fc35cb62433fc8fb7da44d01ff29d1a340f26c9f882c1ad91c4e3687b37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d22dd9edf36f28e3e0caf282a7ce20fc75a4652cdbe1270f66708912f17b35b6a6e17c18c9aac1f3c38f7c8e8de08b4951f9338e5828a158664731ce4a49c35
|
7
|
+
data.tar.gz: 3b3f5acf48399f3bf6964d1bd91c3208900fbc295f00b1755bf38435b4f6a1630e9247c84340eead8adef2b75ccc527bfccb57b8b8ea561d3a3337fa4a4ad1fe
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
[gem]: https://rubygems.org/gems/boletosimples
|
7
7
|
|
8
|
-
Biblioteca Ruby para acessar informações
|
8
|
+
Biblioteca Ruby para acessar informações da [Kobana](https://www.kobana.com.br) através da [API](https://api.kobana.com.br).
|
9
9
|
|
10
10
|
## Instalação
|
11
11
|
|
@@ -23,15 +23,15 @@ Ou instale você mesmo:
|
|
23
23
|
|
24
24
|
## Configuração
|
25
25
|
|
26
|
-
Saiba mais sobre o [Token de API ](https://
|
26
|
+
Saiba mais sobre o [Token de API ](https://developers.kobana.com.br/reference/token-de-acesso)
|
27
27
|
|
28
28
|
```ruby
|
29
29
|
require 'boletosimples'
|
30
30
|
|
31
31
|
BoletoSimples.configure do |c|
|
32
32
|
c.environment = :production # defaut :sandbox
|
33
|
-
# production - https://
|
34
|
-
# sandbox - https://sandbox.
|
33
|
+
# production - https://app.kobana.com.br/conta/api/tokens
|
34
|
+
# sandbox - https://app-sandbox.kobana.com.br/conta/api/tokens
|
35
35
|
c.api_token = 'api-token'
|
36
36
|
c.user_agent = 'email@minhaempresa.com.br' #Colocar um e-mail válido para contatos técnicos relacionado ao uso da API.
|
37
37
|
# c.debug = true
|
@@ -50,7 +50,7 @@ ENV['BOLETOSIMPLES_DEBUG']
|
|
50
50
|
|
51
51
|
### Configurando cache
|
52
52
|
|
53
|
-
É altamente recomendável utilizar o cache para evitar chegar no [limite de requisições](
|
53
|
+
É altamente recomendável utilizar o cache para evitar chegar no [limite de requisições](https://developers.kobana.com.br/reference/limite-de-requisições)
|
54
54
|
|
55
55
|
Para isso recomendamos a utilização da gem [Dalli](https://github.com/mperham/dalli)
|
56
56
|
|
@@ -113,8 +113,7 @@ Exemplo:
|
|
113
113
|
end
|
114
114
|
|
115
115
|
# Cancelar um boleto
|
116
|
-
@bank_billet = BoletoSimples::BankBillet.
|
117
|
-
@bank_billet.cancel
|
116
|
+
@bank_billet = BoletoSimples::BankBillet.cancel(id: 1)
|
118
117
|
|
119
118
|
```
|
120
119
|
|
@@ -5,8 +5,8 @@ module BoletoSimples
|
|
5
5
|
attr_accessor :environment, :cache, :user_agent, :api_token, :debug
|
6
6
|
|
7
7
|
BASE_URI = {
|
8
|
-
sandbox: 'https://sandbox.
|
9
|
-
production: 'https://
|
8
|
+
sandbox: 'https://api-sandbox.kobana.com.br/v1',
|
9
|
+
production: 'https://api.kobana.com.br/v1',
|
10
10
|
development: 'http://localhost:5000/api/v1'
|
11
11
|
}.freeze
|
12
12
|
|
@@ -9,14 +9,14 @@ module BoletoSimples
|
|
9
9
|
# Examples:
|
10
10
|
#
|
11
11
|
# BoletoSimples::BankBillet.all
|
12
|
-
# BoletoSimples::ResponseError: 401 POST https://sandbox.
|
12
|
+
# BoletoSimples::ResponseError: 401 POST https://api-sandbox.kobana.com.br/v1/bank_billets
|
13
13
|
#
|
14
14
|
# begin
|
15
15
|
# BoletoSimples::BankBillet.all
|
16
16
|
# rescue BoletoSimples::ResponseError => response
|
17
17
|
# response.status # => 401
|
18
18
|
# response.method # => "GET"
|
19
|
-
# response.url # => "https://sandbox.
|
19
|
+
# response.url # => "https://api-sandbox.kobana.com.br/v1/bank_billets"
|
20
20
|
# response.body # => "{"error":"Você precisa se logar ou registrar antes de prosseguir."}"
|
21
21
|
# response.error_message # => "Você precisa se logar ou registrar antes de prosseguir."
|
22
22
|
# end
|
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
# it do
|
16
16
|
# expect(subject.environment).to eq(:sandbox)
|
17
|
-
# expect(subject.base_uri).to eq('https://sandbox.
|
17
|
+
# expect(subject.base_uri).to eq('https://api-sandbox.kobana.com.br/v1')
|
18
18
|
# expect(subject.cache).to be_nil
|
19
19
|
# expect(subject.user_agent).to be_nil
|
20
20
|
# end
|
@@ -31,7 +31,7 @@
|
|
31
31
|
|
32
32
|
# it do
|
33
33
|
# expect(subject.environment).to eq(:production)
|
34
|
-
# expect(subject.base_uri).to eq('https://
|
34
|
+
# expect(subject.base_uri).to eq('https://api.kobana.com.br/v1')
|
35
35
|
# expect(subject.user_agent).to eq('email@minhaempresa.com.br')
|
36
36
|
# end
|
37
37
|
|
@@ -59,7 +59,7 @@
|
|
59
59
|
# it do
|
60
60
|
# expect(subject.environment).to eq(:production)
|
61
61
|
# expect(subject.user_agent).to eq('Meu agent')
|
62
|
-
# expect(subject.base_uri).to eq('https://
|
62
|
+
# expect(subject.base_uri).to eq('https://api.kobana.com.br/v1')
|
63
63
|
# end
|
64
64
|
|
65
65
|
# describe 'cache' do
|
@@ -10,7 +10,7 @@ RSpec.describe BoletoSimples::BankBillet do
|
|
10
10
|
@bank_billet = described_class.create(
|
11
11
|
amount: 9.01,
|
12
12
|
description: 'Despesas do contrato 0012',
|
13
|
-
expire_at: '
|
13
|
+
expire_at: '2024-01-01',
|
14
14
|
customer_address: 'Rua quinhentos',
|
15
15
|
customer_address_complement: 'Sala 4',
|
16
16
|
customer_address_number: '111',
|
@@ -60,7 +60,7 @@ RSpec.describe BoletoSimples::BankBillet do
|
|
60
60
|
|
61
61
|
it {
|
62
62
|
expect(subject.response_errors).to eq({ customer_person_name: ['não pode ficar em branco'],
|
63
|
-
customer_cnpj_cpf: ['não
|
63
|
+
customer_cnpj_cpf: ['não é um CNPJ ou CPF válido'],
|
64
64
|
customer_zipcode: ['não pode ficar em branco'],
|
65
65
|
expire_at: ['não pode ficar em branco', 'não é uma data válida'],
|
66
66
|
customer_address: ['não pode ficar em branco'],
|
@@ -9,7 +9,7 @@ RSpec.describe BoletoSimples::Customer do
|
|
9
9
|
VCR.use_cassette('resources/customer/create/valid') do
|
10
10
|
@customer = described_class.create(
|
11
11
|
person_name: 'Maria José',
|
12
|
-
cnpj_cpf: '
|
12
|
+
cnpj_cpf: '84.232.027/0001-08',
|
13
13
|
email: 'cliente@example.com',
|
14
14
|
address: 'Rua quinhentos',
|
15
15
|
city_name: 'Rio de Janeiro',
|
@@ -42,8 +42,13 @@ RSpec.describe BoletoSimples::Customer do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it {
|
45
|
-
expect(subject.response_errors).to eq(
|
46
|
-
|
45
|
+
expect(subject.response_errors).to eq({ address: ['não pode ficar em branco'],
|
46
|
+
city_name: ['não pode ficar em branco'],
|
47
|
+
cnpj_cpf: ['não é um CNPJ ou CPF válido'],
|
48
|
+
neighborhood: ['não pode ficar em branco'],
|
49
|
+
person_name: ['não pode ficar em branco'],
|
50
|
+
state: ['não está incluído na lista'],
|
51
|
+
zipcode: ['não pode ficar em branco'] })
|
47
52
|
}
|
48
53
|
end
|
49
54
|
|
@@ -56,7 +61,7 @@ RSpec.describe BoletoSimples::Customer do
|
|
56
61
|
|
57
62
|
it {
|
58
63
|
expect(subject.response_errors).to eq({ person_name: ['não pode ficar em branco'],
|
59
|
-
cnpj_cpf: ['não
|
64
|
+
cnpj_cpf: ['não é um CNPJ ou CPF válido'], zipcode: ['não pode ficar em branco'],
|
60
65
|
address: ['não pode ficar em branco'], neighborhood: ['não pode ficar em branco'],
|
61
66
|
city_name: ['não pode ficar em branco'], state: ['não está incluído na lista'] })
|
62
67
|
}
|
@@ -61,7 +61,7 @@ RSpec.describe BoletoSimples::CustomerSubscription do
|
|
61
61
|
|
62
62
|
it {
|
63
63
|
expect(subject.response_errors).to eq({ customer_person_name: ['não pode ficar em branco'],
|
64
|
-
customer_cnpj_cpf: ['não
|
64
|
+
customer_cnpj_cpf: ['não é um CNPJ ou CPF válido'],
|
65
65
|
customer_zipcode: ['não pode ficar em branco'],
|
66
66
|
amount: ['não pode ficar em branco'],
|
67
67
|
customer_address: ['não pode ficar em branco'],
|
@@ -62,7 +62,7 @@ RSpec.describe BoletoSimples::Installment do
|
|
62
62
|
|
63
63
|
it {
|
64
64
|
expect(subject.response_errors).to eq({ customer_person_name: ['não pode ficar em branco'],
|
65
|
-
customer_cnpj_cpf: ['não
|
65
|
+
customer_cnpj_cpf: ['não é um CNPJ ou CPF válido'],
|
66
66
|
customer_zipcode: ['não pode ficar em branco'],
|
67
67
|
total: ['não pode ficar em branco', 'não é um número'],
|
68
68
|
start_at: ['não pode ficar em branco'],
|