boletosimples 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CHANGELOG.md +14 -0
  4. data/boletosimples.gemspec +3 -1
  5. data/example/access_token_example.rb +29 -4
  6. data/example/oauth_example.rb +28 -4
  7. data/lib/boletosimples/client.rb +11 -4
  8. data/lib/boletosimples/version.rb +1 -1
  9. data/spec/boletosimples/client_spec.rb +407 -4
  10. data/spec/boletosimples/oauth_client_spec.rb +6 -3
  11. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_bank_billet/existing_bank_billet.yml +61 -0
  12. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_bank_billet/not_found.yml +44 -0
  13. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_bank_billets.yml +63 -0
  14. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_cancel_bank_billet/already_canceled.yml +58 -0
  15. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_cancel_bank_billet/with_invalid_bank_billet.yml +54 -0
  16. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_cancel_bank_billet/with_valid_bank_billet.yml +71 -0
  17. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_create_bank_billet/with_invalid_data.yml +64 -0
  18. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_create_bank_billet/with_valid_data.yml +66 -0
  19. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_create_customer/with_invalid_data.yml +59 -0
  20. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_create_customer/with_valid_data.yml +61 -0
  21. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_customer/existing_customer.yml +57 -0
  22. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_customer/not_found.yml +58 -0
  23. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_customers.yml +59 -0
  24. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_transactions.yml +67 -0
  25. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_userinfo/with_authentication.yml +56 -0
  26. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_userinfo/with_authentication/.yml +56 -0
  27. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_userinfo/without_authentication.yml +54 -0
  28. data/spec/fixtures/vcr_cassettes/BoletoSimples_Client/_userinfo/without_authentication/.yml +54 -0
  29. data/spec/fixtures/vcr_cassettes/BoletoSimples_OAuthClient/_userinfo/without_authentication/.yml +62 -0
  30. data/spec/spec_helper.rb +18 -0
  31. data/spec/support/vcr.rb +7 -0
  32. metadata +72 -2
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://sandbox.boletosimples.com.br/api/v1/customers?access_token=9e616874dbf0674ace28170a748c9258ac1f0f87e0a544441ebffe976645bc09
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"customer":{"person_name":"Joao da Silva","cnpj_cpf":"foo","email":"cliente@bom.com","address":"Rua
9
+ quinhentos","city_name":"Rio de Janeiro","state":"RJ","neighborhood":"bairro","zipcode":"123","address_number":"111","address_complement":"Sala
10
+ 4","phone_number":"2123434"}}'
11
+ headers:
12
+ Content-Type:
13
+ - application/json
14
+ User-Agent:
15
+ - Meu e-Commerce (meuecommerce@example.com)
16
+ response:
17
+ status:
18
+ code: 422
19
+ message: Unprocessable Entity
20
+ headers:
21
+ Server:
22
+ - Cowboy
23
+ Connection:
24
+ - close
25
+ Date:
26
+ - Fri, 24 Oct 2014 18:06:42 GMT
27
+ Status:
28
+ - 422 Unprocessable Entity
29
+ Strict-Transport-Security:
30
+ - max-age=2592000
31
+ X-Frame-Options:
32
+ - SAMEORIGIN
33
+ X-Xss-Protection:
34
+ - 1; mode=block
35
+ X-Content-Type-Options:
36
+ - nosniff
37
+ Content-Type:
38
+ - application/json; charset=utf-8
39
+ Cache-Control:
40
+ - no-cache
41
+ X-Request-Id:
42
+ - aca78138-b786-4179-9186-796e5a67d273
43
+ X-Ratelimit-Limit:
44
+ - '500'
45
+ X-Ratelimit-Remaining:
46
+ - '499'
47
+ X-Runtime:
48
+ - '0.035539'
49
+ Via:
50
+ - 1.1 vegur
51
+ body:
52
+ encoding: ASCII-8BIT
53
+ string: !binary |-
54
+ eyJlcnJvcnMiOnsiY25wal9jcGYiOlsibsOjbyBwb2RlIGZpY2FyIGVtIGJy
55
+ YW5jbyJdLCJwaG9uZV9udW1iZXIiOlsiw6kgbXVpdG8gY3VydG8gKG3DrW5p
56
+ bW86IDEwIGNhcmFjdGVyZXMpIl19fQ==
57
+ http_version:
58
+ recorded_at: Fri, 24 Oct 2014 18:06:42 GMT
59
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,61 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://sandbox.boletosimples.com.br/api/v1/customers?access_token=9e616874dbf0674ace28170a748c9258ac1f0f87e0a544441ebffe976645bc09
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"customer":{"person_name":"Joao da Silva","cnpj_cpf":"012.345.678-90","email":"cliente@bom.com","address":"Rua
9
+ quinhentos","city_name":"Rio de Janeiro","state":"RJ","neighborhood":"bairro","zipcode":"12312-123","address_number":"111","address_complement":"Sala
10
+ 4","phone_number":"2112123434"}}'
11
+ headers:
12
+ Content-Type:
13
+ - application/json
14
+ User-Agent:
15
+ - Meu e-Commerce (meuecommerce@example.com)
16
+ response:
17
+ status:
18
+ code: 201
19
+ message: Created
20
+ headers:
21
+ Server:
22
+ - Cowboy
23
+ Connection:
24
+ - close
25
+ Date:
26
+ - Fri, 24 Oct 2014 17:59:16 GMT
27
+ Status:
28
+ - 201 Created
29
+ Strict-Transport-Security:
30
+ - max-age=2592000
31
+ X-Frame-Options:
32
+ - SAMEORIGIN
33
+ X-Xss-Protection:
34
+ - 1; mode=block
35
+ X-Content-Type-Options:
36
+ - nosniff
37
+ Location:
38
+ - https://sandbox.boletosimples.com.br/api/v1/customers/32
39
+ Content-Type:
40
+ - application/json; charset=utf-8
41
+ Etag:
42
+ - '"4ed60beb3944fda9bb1e0c5d319c4bb3"'
43
+ Cache-Control:
44
+ - max-age=0, private, must-revalidate
45
+ X-Request-Id:
46
+ - 0bf0c4a8-d29c-47a1-98f6-0d08b786ed7a
47
+ X-Ratelimit-Limit:
48
+ - '500'
49
+ X-Ratelimit-Remaining:
50
+ - '499'
51
+ X-Runtime:
52
+ - '0.205672'
53
+ Via:
54
+ - 1.1 vegur
55
+ body:
56
+ encoding: UTF-8
57
+ string: '{"id":32,"city_name":"Rio de Janeiro","person_name":"Joao da Silva","address":"Rua
58
+ quinhentos","address_complement":"Sala 4","address_number":"111","mobile_number":null,"cnpj_cpf":"012.345.678-90","email":"cliente@bom.com","neighborhood":"bairro","person_type":"individual","phone_number":"2112123434","zipcode":"12312-123","mobile_local_code":null,"state":"RJ"}'
59
+ http_version:
60
+ recorded_at: Fri, 24 Oct 2014 17:59:16 GMT
61
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandbox.boletosimples.com.br/api/v1/customers/32?access_token=9e616874dbf0674ace28170a748c9258ac1f0f87e0a544441ebffe976645bc09
6
+ body:
7
+ encoding: UTF-8
8
+ string: "{}"
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - Meu e-Commerce (meuecommerce@example.com)
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Server:
20
+ - Cowboy
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Fri, 24 Oct 2014 18:33:53 GMT
25
+ Status:
26
+ - 200 OK
27
+ Strict-Transport-Security:
28
+ - max-age=2592000
29
+ X-Frame-Options:
30
+ - SAMEORIGIN
31
+ X-Xss-Protection:
32
+ - 1; mode=block
33
+ X-Content-Type-Options:
34
+ - nosniff
35
+ Content-Type:
36
+ - application/json; charset=utf-8
37
+ Etag:
38
+ - '"4ed60beb3944fda9bb1e0c5d319c4bb3"'
39
+ Cache-Control:
40
+ - max-age=0, private, must-revalidate
41
+ X-Request-Id:
42
+ - 34045230-871c-4a10-aeb3-780b94d8efbe
43
+ X-Ratelimit-Limit:
44
+ - '500'
45
+ X-Ratelimit-Remaining:
46
+ - '499'
47
+ X-Runtime:
48
+ - '0.099872'
49
+ Via:
50
+ - 1.1 vegur
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"id":32,"city_name":"Rio de Janeiro","person_name":"Joao da Silva","address":"Rua
54
+ quinhentos","address_complement":"Sala 4","address_number":"111","mobile_number":null,"cnpj_cpf":"012.345.678-90","email":"cliente@bom.com","neighborhood":"bairro","person_type":"individual","phone_number":"2112123434","zipcode":"12312-123","mobile_local_code":null,"state":"RJ"}'
55
+ http_version:
56
+ recorded_at: Fri, 24 Oct 2014 18:33:53 GMT
57
+ 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/customers/42?access_token=9e616874dbf0674ace28170a748c9258ac1f0f87e0a544441ebffe976645bc09
6
+ body:
7
+ encoding: UTF-8
8
+ string: "{}"
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - Meu e-Commerce (meuecommerce@example.com)
14
+ response:
15
+ status:
16
+ code: 404
17
+ message: Not Found
18
+ headers:
19
+ Server:
20
+ - Cowboy
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Fri, 05 Dec 2014 20:18:46 GMT
25
+ Status:
26
+ - 404 Not Found
27
+ Strict-Transport-Security:
28
+ - max-age=2592000
29
+ X-Frame-Options:
30
+ - SAMEORIGIN
31
+ X-Xss-Protection:
32
+ - 1; mode=block
33
+ X-Content-Type-Options:
34
+ - nosniff
35
+ Content-Type:
36
+ - application/json; charset=utf-8
37
+ Cache-Control:
38
+ - no-cache
39
+ X-Request-Id:
40
+ - a977a921-e10f-4cdb-b64a-ee9b527f4e21
41
+ X-Ratelimit-Limit:
42
+ - '500'
43
+ X-Ratelimit-Remaining:
44
+ - '499'
45
+ X-Runtime:
46
+ - '0.020316'
47
+ X-Rack-Cache:
48
+ - miss
49
+ Vary:
50
+ - Accept-Encoding
51
+ Via:
52
+ - 1.1 vegur
53
+ body:
54
+ encoding: UTF-8
55
+ string: '{"status":404,"error":"Not Found"}'
56
+ http_version:
57
+ recorded_at: Fri, 05 Dec 2014 20:18:47 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandbox.boletosimples.com.br/api/v1/customers?access_token=9e616874dbf0674ace28170a748c9258ac1f0f87e0a544441ebffe976645bc09
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"page":1}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - Meu e-Commerce (meuecommerce@example.com)
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Server:
20
+ - Cowboy
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Fri, 24 Oct 2014 18:26:06 GMT
25
+ Status:
26
+ - 200 OK
27
+ Strict-Transport-Security:
28
+ - max-age=2592000
29
+ X-Frame-Options:
30
+ - SAMEORIGIN
31
+ X-Xss-Protection:
32
+ - 1; mode=block
33
+ X-Content-Type-Options:
34
+ - nosniff
35
+ Total:
36
+ - '1'
37
+ Content-Type:
38
+ - application/json; charset=utf-8
39
+ Etag:
40
+ - '"f63a901ac28c3fb92064b5264897384e"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ X-Request-Id:
44
+ - 0f30030a-efc3-41f8-9e9c-275efc32fdb5
45
+ X-Ratelimit-Limit:
46
+ - '500'
47
+ X-Ratelimit-Remaining:
48
+ - '499'
49
+ X-Runtime:
50
+ - '1.722992'
51
+ Via:
52
+ - 1.1 vegur
53
+ body:
54
+ encoding: UTF-8
55
+ string: '[{"id":32,"city_name":"Rio de Janeiro","person_name":"Joao da Silva","address":"Rua
56
+ quinhentos","address_complement":"Sala 4","address_number":"111","mobile_number":null,"cnpj_cpf":"012.345.678-90","email":"cliente@bom.com","neighborhood":"bairro","person_type":"individual","phone_number":"2112123434","zipcode":"12312-123","mobile_local_code":null,"state":"RJ"}]'
57
+ http_version:
58
+ recorded_at: Fri, 24 Oct 2014 18:26:06 GMT
59
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,67 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandbox.boletosimples.com.br/api/v1/transactions?access_token=9e616874dbf0674ace28170a748c9258ac1f0f87e0a544441ebffe976645bc09
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"page":1}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - Meu e-Commerce (meuecommerce@example.com)
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Server:
20
+ - Cowboy
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Mon, 03 Nov 2014 22:35:47 GMT
25
+ Status:
26
+ - 200 OK
27
+ Strict-Transport-Security:
28
+ - max-age=2592000
29
+ X-Frame-Options:
30
+ - SAMEORIGIN
31
+ X-Xss-Protection:
32
+ - 1; mode=block
33
+ X-Content-Type-Options:
34
+ - nosniff
35
+ Total:
36
+ - '2'
37
+ Content-Type:
38
+ - application/json; charset=utf-8
39
+ Etag:
40
+ - '"44e7beba54834116cc3eb1cbfc5c0b89"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ X-Request-Id:
44
+ - 9520fe3c-9f4d-4bab-ad35-3ada0fff892a
45
+ X-Ratelimit-Limit:
46
+ - '500'
47
+ X-Ratelimit-Remaining:
48
+ - '499'
49
+ X-Runtime:
50
+ - '0.073431'
51
+ Via:
52
+ - 1.1 vegur
53
+ body:
54
+ encoding: ASCII-8BIT
55
+ string: !binary |-
56
+ W3siaWQiOjE1LCJhbW91bnQiOjkuMDEsImNyZWF0ZWRfYXQiOiIyMDE0LTEx
57
+ LTAzIiwiZGVzY3JpcHRpb24iOiJCb2xldG8gQmFuY8OhcmlvIDExMyIsImtp
58
+ bmQiOiJjcmVkaXQiLCJwcm9jZXNzZWRfYXQiOm51bGwsInNlbnRfYXQiOm51
59
+ bGwsInN0YXR1cyI6InVucHJvY2Vzc2VkIiwiY3JlZGl0X2F0IjoiMjAxNC0x
60
+ MS0wNiJ9LHsiaWQiOjE2LCJhbW91bnQiOi01LjAsImNyZWF0ZWRfYXQiOiIy
61
+ MDE0LTExLTAzIiwiZGVzY3JpcHRpb24iOiJCb2xldG8gQmFuY8OhcmlvIDEx
62
+ MyIsImtpbmQiOiJmZWUiLCJwcm9jZXNzZWRfYXQiOm51bGwsInNlbnRfYXQi
63
+ Om51bGwsInN0YXR1cyI6InVucHJvY2Vzc2VkIiwiY3JlZGl0X2F0IjoiMjAx
64
+ NC0xMS0wNiJ9XQ==
65
+ http_version:
66
+ recorded_at: Mon, 03 Nov 2014 22:35:47 GMT
67
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandbox.boletosimples.com.br/api/v1/userinfo?access_token=9e616874dbf0674ace28170a748c9258ac1f0f87e0a544441ebffe976645bc09
6
+ body:
7
+ encoding: UTF-8
8
+ string: "{}"
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - Meu e-Commerce (meuecommerce@example.com)
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Server:
20
+ - Cowboy
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Fri, 24 Oct 2014 17:15:09 GMT
25
+ Status:
26
+ - 200 OK
27
+ Strict-Transport-Security:
28
+ - max-age=2592000
29
+ X-Frame-Options:
30
+ - SAMEORIGIN
31
+ X-Xss-Protection:
32
+ - 1; mode=block
33
+ X-Content-Type-Options:
34
+ - nosniff
35
+ Content-Type:
36
+ - application/json; charset=utf-8
37
+ Etag:
38
+ - '"a5e53c2911f6654ee16b5d63fc3fa120"'
39
+ Cache-Control:
40
+ - max-age=0, private, must-revalidate
41
+ X-Request-Id:
42
+ - 43370077-7a00-4f85-a655-3cf584d21e98
43
+ X-Ratelimit-Limit:
44
+ - '500'
45
+ X-Ratelimit-Remaining:
46
+ - '499'
47
+ X-Runtime:
48
+ - '0.059536'
49
+ Via:
50
+ - 1.1 vegur
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"id":38,"login_url":"https://sandbox.boletosimples.com.br/welcome?email=marciojunior1991%40gmail.com\u0026token=Z94HQ9Uzn2Cc1gzp9PWG","email":"marciojunior1991@gmail.com","account_type":null,"first_name":null,"middle_name":null,"last_name":null,"full_name":null,"cpf":null,"date_of_birth":null,"mother_name":null,"father_name":null,"account_level":2,"phone_number":null,"address_street_name":null,"address_number":null,"address_complement":null,"address_neighborhood":null,"address_postal_code":null,"address_city_name":null,"address_state":null,"business_name":null,"business_cnpj":null,"business_legal_name":null}'
54
+ http_version:
55
+ recorded_at: Fri, 24 Oct 2014 17:15:09 GMT
56
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://sandbox.boletosimples.com.br/api/v1/userinfo?access_token=9e616874dbf0674ace28170a748c9258ac1f0f87e0a544441ebffe976645bc09
6
+ body:
7
+ encoding: UTF-8
8
+ string: "{}"
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ User-Agent:
13
+ - Meu e-Commerce (meuecommerce@example.com)
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Server:
20
+ - Cowboy
21
+ Connection:
22
+ - close
23
+ Date:
24
+ - Fri, 24 Oct 2014 17:09:25 GMT
25
+ Status:
26
+ - 200 OK
27
+ Strict-Transport-Security:
28
+ - max-age=2592000
29
+ X-Frame-Options:
30
+ - SAMEORIGIN
31
+ X-Xss-Protection:
32
+ - 1; mode=block
33
+ X-Content-Type-Options:
34
+ - nosniff
35
+ Content-Type:
36
+ - application/json; charset=utf-8
37
+ Etag:
38
+ - '"a5e53c2911f6654ee16b5d63fc3fa120"'
39
+ Cache-Control:
40
+ - max-age=0, private, must-revalidate
41
+ X-Request-Id:
42
+ - 8024d2e8-0c30-40a4-97e7-3b657eceed9f
43
+ X-Ratelimit-Limit:
44
+ - '500'
45
+ X-Ratelimit-Remaining:
46
+ - '499'
47
+ X-Runtime:
48
+ - '0.102692'
49
+ Via:
50
+ - 1.1 vegur
51
+ body:
52
+ encoding: UTF-8
53
+ string: '{"id":38,"login_url":"https://sandbox.boletosimples.com.br/welcome?email=marciojunior1991%40gmail.com\u0026token=Z94HQ9Uzn2Cc1gzp9PWG","email":"marciojunior1991@gmail.com","account_type":null,"first_name":null,"middle_name":null,"last_name":null,"full_name":null,"cpf":null,"date_of_birth":null,"mother_name":null,"father_name":null,"account_level":2,"phone_number":null,"address_street_name":null,"address_number":null,"address_complement":null,"address_neighborhood":null,"address_postal_code":null,"address_city_name":null,"address_state":null,"business_name":null,"business_cnpj":null,"business_legal_name":null}'
54
+ http_version:
55
+ recorded_at: Fri, 24 Oct 2014 17:09:25 GMT
56
+ recorded_with: VCR 2.9.3