boletosimples 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1eb29ddb6b2c82e29764003b755c4c2c7f718cf1
4
- data.tar.gz: d1514759d09ac255c99ee9388141d20db88fd151
3
+ metadata.gz: 17f2365a34061b7ab882790ebcfc88d82b538330
4
+ data.tar.gz: ab78d64b564c6df9fcf3c12b1aafc158e4f607b7
5
5
  SHA512:
6
- metadata.gz: 5ec76c9b2975b33dc9a880493952747a65d29c37d40409b9ab0dbbb395440665b70db731a360c9497d942c47dfd69e685ff5a0416e64c849691df5a81926587f
7
- data.tar.gz: d0939d09a6ae4c53838eee72a2028fb7a36d141f700e84e946c3e242f6daee4a40a2db24ad25bf31139cb662225cc4d483133e449bd5ed7333bc8dc176d39392
6
+ metadata.gz: 3e75fce8f07f2ee58d93d96aba3bd7938207cb88beab6a8abbe0dd14ded7d75240b6780c8cabb58b6ff30eaa34962175d2fcc636b5c7d834d33a21619661b90c
7
+ data.tar.gz: ec1d7073526605a7fedf983858cc6fad7c0226a65635de274e86a113dc8c170d91f2799f06cd7ccb2a0da946e975178fb71caef752abc0fe5ae607c41f4a690b
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.1.5
1
+ 2.2.1
data/.travis.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - '2.2.1'
3
4
  - '2.1.0'
4
5
  - '2.0.0'
5
- - '1.9.3'
6
6
  branches:
7
7
  only:
8
8
  - master
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Changelog
2
2
 
3
- ## 0.1.1 (unreleased)
3
+ ## 0.2.2
4
+
5
+ ### features
6
+
7
+ - Add BankBilletAccount resource
8
+
9
+ ## 0.1.1
4
10
 
5
11
  ### features
6
12
 
@@ -10,5 +16,3 @@
10
16
 
11
17
  - Changed `client.create_customer({ "customer" => params })` to `client.create_customer(params)`
12
18
  - Changed `client.create_bank_billet({ "bank_billet" => params })` to `client.create_bank_billet(params)`
13
-
14
- ### bug fixes
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Boleto Simples
1
+ # Boleto Simples Ruby
2
2
 
3
3
  [![Gem Version](http://img.shields.io/gem/v/boletosimples.svg)][gem]
4
4
  [![Build Status](http://img.shields.io/travis/BoletoSimples/boletosimples-ruby.svg)][travis]
@@ -12,7 +12,7 @@
12
12
  [codeclimate]: https://codeclimate.com/github/BoletoSimples/boletosimples-ruby
13
13
  [coveralls]: https://coveralls.io/r/BoletoSimples/boletosimples-ruby
14
14
 
15
- Esta gem inclui todos os métodos disponíveis na [Boleto Simples JSON API](http://api.boletosimples.com.br).
15
+ Biblioteca Ruby para acessar informações do [Boleto Simples](http://boletosimples.com.br) através da [API](http://api.boletosimples.com.br).
16
16
 
17
17
  ## Instalação
18
18
 
data/lib/boletosimples.rb CHANGED
@@ -10,6 +10,7 @@ module BoletoSimples
10
10
  autoload :LastRequest, 'boletosimples/last_request'
11
11
 
12
12
  autoload :BankBillet, 'boletosimples/resources/bank_billet'
13
+ autoload :BankBilletAccount, 'boletosimples/resources/bank_billet_account'
13
14
  autoload :Customer, 'boletosimples/resources/customer'
14
15
  autoload :Transaction, 'boletosimples/resources/transaction'
15
16
  autoload :BaseModel, 'boletosimples/resources/base_model'
@@ -0,0 +1,4 @@
1
+ module BoletoSimples
2
+ class BankBilletAccount < BaseModel
3
+ end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module BoletoSimples
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -0,0 +1,62 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'spec_helper'
4
+
5
+ # Before running this spec again, you need to set environment variable BOLETOSIMPLES_ACCESS_TOKEN
6
+ RSpec.describe BoletoSimples::BankBilletAccount do
7
+ before {
8
+ BoletoSimples.configure do |c|
9
+ c.application_id = nil
10
+ c.application_secret = nil
11
+ end
12
+ }
13
+ describe 'methods' do
14
+ before {
15
+ VCR.use_cassette('resources/bank_billet_account/create/valid') do
16
+ @bank_billet_account = BoletoSimples::BankBilletAccount.create({
17
+ bank_contract_slug: 'sicoob-02',
18
+ next_our_number: '1',
19
+ agency_number: '4327',
20
+ agency_digit: '3',
21
+ account_number: '3666',
22
+ account_digit: '8',
23
+ extra1_length: '1234567'
24
+ })
25
+ end
26
+ }
27
+ describe 'create' do
28
+ context 'valid parameters' do
29
+ subject { @bank_billet_account }
30
+ it { expect(subject).to be_a_kind_of(BoletoSimples::BankBilletAccount) }
31
+ it { expect(subject.response_errors).to eq({}) }
32
+ it { expect(subject.attributes.keys).to match_array(["account_digit", "account_number", "agency_digit", "agency_number", "bank_contract_slug", "extra1", "extra1_digit", "extra1_length", "extra2", "extra2_digit", "id", "next_our_number"]) }
33
+ end
34
+ context 'invalid parameters' do
35
+ context 'empty bank_billet' do
36
+ subject {
37
+ VCR.use_cassette('resources/bank_billet_account/create/invalid_root') do
38
+ BoletoSimples::BankBilletAccount.create({})
39
+ end
40
+ }
41
+ it { expect(subject.response_errors).to eq({ bank_billet_account: ["não pode ficar em branco"] }) }
42
+ end
43
+ context 'invalid params' do
44
+ subject {
45
+ VCR.use_cassette('resources/bank_billet_account/create/invalid_params') do
46
+ BoletoSimples::BankBilletAccount.create({ bank_contract_slug: '' })
47
+ end
48
+ }
49
+ it { expect(subject.response_errors).to eq({ :agency_number => ["não pode ficar em branco"], :account_number => ["não pode ficar em branco"], :bank_contract_slug => ["não pode ficar em branco"] }) }
50
+ end
51
+ end
52
+ end
53
+ describe 'find', vcr: { cassette_name: 'resources/bank_billet_account/find' } do
54
+ subject { BoletoSimples::BankBilletAccount.find(@bank_billet_account.id) }
55
+ it { expect(subject).to be_a_kind_of(BoletoSimples::BankBilletAccount) }
56
+ end
57
+ describe 'all', vcr: { cassette_name: 'resources/bank_billet_account/all' } do
58
+ subject { BoletoSimples::BankBilletAccount.all }
59
+ it { expect(subject.first).to be_a_kind_of(BoletoSimples::BankBilletAccount) }
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,60 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandbox.boletosimples.com.br/api/v1/bank_billet_accounts?access_token=BOLETOSIMPLES_ACCESS_TOKEN
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - BoletoSimples Ruby Client v0.1.0 (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
+ Total:
30
+ - '1'
31
+ Content-Type:
32
+ - application/json; charset=utf-8
33
+ X-Ratelimit-Limit:
34
+ - '500'
35
+ X-Ratelimit-Remaining:
36
+ - '493'
37
+ Etag:
38
+ - W/"ca330f75ba0317e3c3566f31bf76171f"
39
+ Cache-Control:
40
+ - must-revalidate, private, max-age=0
41
+ X-Request-Id:
42
+ - 5fb90b12-2fb2-4b98-9a1d-11c5decca367
43
+ X-Runtime:
44
+ - '0.041115'
45
+ Date:
46
+ - Wed, 01 Apr 2015 17:47:58 GMT
47
+ X-Rack-Cache:
48
+ - miss
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":1,"bank_contract_slug":"sicoob-02","next_our_number":"0000001","agency_number":"4327","agency_digit":"3","account_number":"00003666","account_digit":"8","extra1":null,"extra1_digit":null,"extra2":null,"extra2_digit":null}]'
58
+ http_version:
59
+ recorded_at: Wed, 01 Apr 2015 17:47:58 GMT
60
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://sandbox.boletosimples.com.br/api/v1/bank_billet_accounts?access_token=BOLETOSIMPLES_ACCESS_TOKEN
6
+ body:
7
+ encoding: UTF-8
8
+ string: bank_billet_account%5Bbank_contract_slug%5D=
9
+ headers:
10
+ User-Agent:
11
+ - BoletoSimples Ruby Client v0.1.0 (contato@boletosimples.com.br)
12
+ Authorization:
13
+ - Token token="BOLETOSIMPLES_ACCESS_TOKEN"
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
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 422
23
+ message: Unprocessable Entity
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
+ - '495'
37
+ Cache-Control:
38
+ - no-cache
39
+ X-Request-Id:
40
+ - f05ec95b-ec7e-4f61-9f65-a0c72dd8a5a8
41
+ X-Runtime:
42
+ - '0.046546'
43
+ Date:
44
+ - Wed, 01 Apr 2015 17:47:56 GMT
45
+ X-Rack-Cache:
46
+ - invalidate, pass
47
+ Vary:
48
+ - Accept-Encoding
49
+ Transfer-Encoding:
50
+ - chunked
51
+ Via:
52
+ - 1.1 vegur
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"errors":{"agency_number":["não pode ficar em branco"],"account_number":["não
56
+ pode ficar em branco"],"bank_contract_slug":["não pode ficar em branco"]}}'
57
+ http_version:
58
+ recorded_at: Wed, 01 Apr 2015 17:47:56 GMT
59
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://sandbox.boletosimples.com.br/api/v1/bank_billet_accounts?access_token=BOLETOSIMPLES_ACCESS_TOKEN
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - BoletoSimples Ruby Client v0.1.0 (contato@boletosimples.com.br)
12
+ Authorization:
13
+ - Token token="BOLETOSIMPLES_ACCESS_TOKEN"
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
+ Accept:
19
+ - "*/*"
20
+ response:
21
+ status:
22
+ code: 422
23
+ message: Unprocessable Entity
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
+ - '494'
37
+ Cache-Control:
38
+ - no-cache
39
+ X-Request-Id:
40
+ - fd24cd69-8708-4881-a986-3ac26f089806
41
+ X-Runtime:
42
+ - '0.025828'
43
+ Date:
44
+ - Wed, 01 Apr 2015 17:47:57 GMT
45
+ X-Rack-Cache:
46
+ - invalidate, pass
47
+ Vary:
48
+ - Accept-Encoding
49
+ Transfer-Encoding:
50
+ - chunked
51
+ Via:
52
+ - 1.1 vegur
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"errors":{"bank_billet_account":["não pode ficar em branco"]}}'
56
+ http_version:
57
+ recorded_at: Wed, 01 Apr 2015 17:47:57 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,62 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://sandbox.boletosimples.com.br/api/v1/bank_billet_accounts?access_token=BOLETOSIMPLES_ACCESS_TOKEN
6
+ body:
7
+ encoding: UTF-8
8
+ string: bank_billet_account%5Baccount_digit%5D=8&bank_billet_account%5Baccount_number%5D=3666&bank_billet_account%5Bagency_digit%5D=3&bank_billet_account%5Bagency_number%5D=4327&bank_billet_account%5Bbank_contract_slug%5D=sicoob-02&bank_billet_account%5Bextra1_length%5D=1234567&bank_billet_account%5Bnext_our_number%5D=1
9
+ headers:
10
+ User-Agent:
11
+ - BoletoSimples Ruby Client v0.1.0 (contato@boletosimples.com.br)
12
+ Authorization:
13
+ - Token token="BOLETOSIMPLES_ACCESS_TOKEN"
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
+ 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
+ Location:
32
+ - https://sandbox.boletosimples.com.br/api/v1/bank_billet_accounts/1
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ X-Ratelimit-Limit:
36
+ - '500'
37
+ X-Ratelimit-Remaining:
38
+ - '497'
39
+ Etag:
40
+ - W/"e1004aeca30742932a4d8da7b82dba83"
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ X-Request-Id:
44
+ - 5dd95636-6cb1-42c3-b93b-e8c122d1bfa1
45
+ X-Runtime:
46
+ - '0.134357'
47
+ Date:
48
+ - Wed, 01 Apr 2015 17:47:54 GMT
49
+ X-Rack-Cache:
50
+ - invalidate, pass
51
+ Vary:
52
+ - Accept-Encoding
53
+ Transfer-Encoding:
54
+ - chunked
55
+ Via:
56
+ - 1.1 vegur
57
+ body:
58
+ encoding: UTF-8
59
+ string: '{"id":1,"bank_contract_slug":"sicoob-02","next_our_number":"0000001","agency_number":"4327","agency_digit":"3","account_number":"00003666","account_digit":"8","extra1":null,"extra1_digit":null,"extra2":null,"extra2_digit":null}'
60
+ http_version:
61
+ recorded_at: Wed, 01 Apr 2015 17:47:54 GMT
62
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandbox.boletosimples.com.br/api/v1/bank_billet_accounts/1?access_token=BOLETOSIMPLES_ACCESS_TOKEN
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - BoletoSimples Ruby Client v0.1.0 (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
+ - '496'
35
+ Etag:
36
+ - W/"e1004aeca30742932a4d8da7b82dba83"
37
+ Cache-Control:
38
+ - must-revalidate, private, max-age=0
39
+ X-Request-Id:
40
+ - faaa5b09-7f35-4535-b47d-f391dff84d7d
41
+ X-Runtime:
42
+ - '0.103545'
43
+ Date:
44
+ - Wed, 01 Apr 2015 17:47:55 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":1,"bank_contract_slug":"sicoob-02","next_our_number":"0000001","agency_number":"4327","agency_digit":"3","account_number":"00003666","account_digit":"8","extra1":null,"extra1_digit":null,"extra2":null,"extra2_digit":null}'
56
+ http_version:
57
+ recorded_at: Wed, 01 Apr 2015 17:47:55 GMT
58
+ recorded_with: VCR 2.9.3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boletosimples
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kivanio Barbosa
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-03-08 00:00:00.000000000 Z
13
+ date: 2015-04-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: her
@@ -180,6 +180,7 @@ files:
180
180
  - lib/boletosimples/middlewares/raise_error.rb
181
181
  - lib/boletosimples/middlewares/user_agent.rb
182
182
  - lib/boletosimples/resources/bank_billet.rb
183
+ - lib/boletosimples/resources/bank_billet_account.rb
183
184
  - lib/boletosimples/resources/base_model.rb
184
185
  - lib/boletosimples/resources/customer.rb
185
186
  - lib/boletosimples/resources/partner/user.rb
@@ -190,6 +191,7 @@ files:
190
191
  - spec/boletosimples/configuration_spec.rb
191
192
  - spec/boletosimples/extra_spec.rb
192
193
  - spec/boletosimples/last_request_spec.rb
194
+ - spec/boletosimples/resources/bank_billet_account_spec.rb
193
195
  - spec/boletosimples/resources/bank_billet_spec.rb
194
196
  - spec/boletosimples/resources/customer_spec.rb
195
197
  - spec/boletosimples/resources/partner/user_spec.rb
@@ -207,6 +209,11 @@ files:
207
209
  - spec/fixtures/vcr_cassettes/resources/bank_billet/create/invalid_root.yml
208
210
  - spec/fixtures/vcr_cassettes/resources/bank_billet/create/valid.yml
209
211
  - spec/fixtures/vcr_cassettes/resources/bank_billet/find.yml
212
+ - spec/fixtures/vcr_cassettes/resources/bank_billet_account/all.yml
213
+ - spec/fixtures/vcr_cassettes/resources/bank_billet_account/create/invalid_params.yml
214
+ - spec/fixtures/vcr_cassettes/resources/bank_billet_account/create/invalid_root.yml
215
+ - spec/fixtures/vcr_cassettes/resources/bank_billet_account/create/valid.yml
216
+ - spec/fixtures/vcr_cassettes/resources/bank_billet_account/find.yml
210
217
  - spec/fixtures/vcr_cassettes/resources/customer/all.yml
211
218
  - spec/fixtures/vcr_cassettes/resources/customer/create/invalid_params.yml
212
219
  - spec/fixtures/vcr_cassettes/resources/customer/create/invalid_root.yml
@@ -236,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
243
  version: '0'
237
244
  requirements: []
238
245
  rubyforge_project:
239
- rubygems_version: 2.2.2
246
+ rubygems_version: 2.4.5
240
247
  signing_key:
241
248
  specification_version: 4
242
249
  summary: Boleto Simples API wrapper.
@@ -244,6 +251,7 @@ test_files:
244
251
  - spec/boletosimples/configuration_spec.rb
245
252
  - spec/boletosimples/extra_spec.rb
246
253
  - spec/boletosimples/last_request_spec.rb
254
+ - spec/boletosimples/resources/bank_billet_account_spec.rb
247
255
  - spec/boletosimples/resources/bank_billet_spec.rb
248
256
  - spec/boletosimples/resources/customer_spec.rb
249
257
  - spec/boletosimples/resources/partner/user_spec.rb
@@ -261,6 +269,11 @@ test_files:
261
269
  - spec/fixtures/vcr_cassettes/resources/bank_billet/create/invalid_root.yml
262
270
  - spec/fixtures/vcr_cassettes/resources/bank_billet/create/valid.yml
263
271
  - spec/fixtures/vcr_cassettes/resources/bank_billet/find.yml
272
+ - spec/fixtures/vcr_cassettes/resources/bank_billet_account/all.yml
273
+ - spec/fixtures/vcr_cassettes/resources/bank_billet_account/create/invalid_params.yml
274
+ - spec/fixtures/vcr_cassettes/resources/bank_billet_account/create/invalid_root.yml
275
+ - spec/fixtures/vcr_cassettes/resources/bank_billet_account/create/valid.yml
276
+ - spec/fixtures/vcr_cassettes/resources/bank_billet_account/find.yml
264
277
  - spec/fixtures/vcr_cassettes/resources/customer/all.yml
265
278
  - spec/fixtures/vcr_cassettes/resources/customer/create/invalid_params.yml
266
279
  - spec/fixtures/vcr_cassettes/resources/customer/create/invalid_root.yml