boletosimples 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +2 -0
- data/.travis.yml +3 -0
- data/Gemfile.lock +1 -1
- data/example/basic_auth_example.rb +0 -13
- data/example/oauth_example.rb +42 -16
- data/lib/boletosimples/client.rb +1 -1
- data/lib/boletosimples/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87a25bc0cf4aeb8c63532d6664cd4565427cf12f
|
4
|
+
data.tar.gz: fcb04b4a768d980a8d9b0b77560f5bd151cb0142
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9e33c126e1e1fbac9a3c50454192dfbf63915d028f5eca497d0b7bd931163aad347cdc074624308ccae37c3f67a9a8a2b38c0ee8bcdf69842a5e5fb4de63d0f
|
7
|
+
data.tar.gz: 2e15cae5d44af832e7543e1505a9a207882348bb61580f77bd002a22ea9dd4fe381dcc1a0569f5fd9cbf55775733b81ed6716d3bea3c17100617b46ebb44e2ff
|
data/.coveralls.yml
ADDED
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -52,16 +52,3 @@ client = BoletoSimples::Client.new('seu email', 'sua senha', {user_agent: 'Meu e
|
|
52
52
|
# notification_url: 'http://example.com.br/notify',
|
53
53
|
# }
|
54
54
|
# })
|
55
|
-
|
56
|
-
|
57
|
-
# pp client.partner_create_user(
|
58
|
-
# {
|
59
|
-
# user: {
|
60
|
-
# email: 'email@example.com',
|
61
|
-
# notification_url: 'http://example.com.br/notify'
|
62
|
-
# }
|
63
|
-
# }
|
64
|
-
# )
|
65
|
-
#
|
66
|
-
|
67
|
-
|
data/example/oauth_example.rb
CHANGED
@@ -2,18 +2,57 @@ $: << File.expand_path('../../lib', __FILE__)
|
|
2
2
|
require 'boletosimples'
|
3
3
|
require 'pp'
|
4
4
|
|
5
|
+
# If you need create users in Boleto Simples
|
6
|
+
# you can get a access token with app_id and app_secret
|
7
|
+
# def get_access_token
|
8
|
+
# response = RestClient.post 'http://sandbox.boletosimples.com.br/api/v1/oauth2/token', {
|
9
|
+
# grant_type: 'client_credentials',
|
10
|
+
# client_id: 'app_id',
|
11
|
+
# client_secret: 'app_secret'
|
12
|
+
# }
|
13
|
+
#
|
14
|
+
# access_app_token = JSON.parse(response)["access_token"]
|
15
|
+
# end
|
16
|
+
|
5
17
|
credentials = {
|
6
|
-
:token => '
|
18
|
+
:token => 'access_app_token'
|
7
19
|
}
|
20
|
+
|
8
21
|
client_options = {
|
9
22
|
user_agent: 'Meu e-Commerce (meuecommerce@example.com)'
|
10
23
|
}
|
11
24
|
|
12
|
-
client = BoletoSimples::OAuthClient.new('
|
13
|
-
'
|
25
|
+
client = BoletoSimples::OAuthClient.new('app_id',
|
26
|
+
'app_secret',
|
14
27
|
credentials,
|
15
28
|
client_options)
|
29
|
+
|
30
|
+
# create user with oauth
|
31
|
+
# pp client.partner_create_user(
|
32
|
+
# {
|
33
|
+
# user: {
|
34
|
+
# email: 'new_user@example.com'
|
35
|
+
# }
|
36
|
+
# }
|
37
|
+
# )
|
38
|
+
|
39
|
+
|
40
|
+
# Other operations need access tokens from user oatuh autorization process
|
41
|
+
# Use our omniauth-boletosimples (https://github.com/BoletoSimples/omniauth-boletosimples) to archive these tokens
|
42
|
+
|
43
|
+
credentials = {
|
44
|
+
:token => 'access token'
|
45
|
+
}
|
16
46
|
|
47
|
+
client_options = {
|
48
|
+
user_agent: 'Meu e-Commerce (meuecommerce@example.com)'
|
49
|
+
}
|
50
|
+
|
51
|
+
client = BoletoSimples::OAuthClient.new('app_id',
|
52
|
+
'app_secret',
|
53
|
+
credentials,
|
54
|
+
client_options)
|
55
|
+
|
17
56
|
# pp client.userinfo
|
18
57
|
|
19
58
|
# pp client.transactions
|
@@ -62,16 +101,3 @@ client = BoletoSimples::OAuthClient.new('api id',
|
|
62
101
|
# notification_url: 'http://example.com.br/notify',
|
63
102
|
# }
|
64
103
|
# })
|
65
|
-
|
66
|
-
# pp client.partner_create_user(
|
67
|
-
# {
|
68
|
-
# user: {
|
69
|
-
# email: 'email@example.com',
|
70
|
-
# notification_url: 'http://example.com.br/notify'
|
71
|
-
# }
|
72
|
-
# }
|
73
|
-
# )
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
data/lib/boletosimples/client.rb
CHANGED
@@ -15,7 +15,7 @@ module BoletoSimples
|
|
15
15
|
|
16
16
|
# defaults
|
17
17
|
@production = options.delete(:production)
|
18
|
-
@base_uri = (@production ? PRODUCTION_BASE_URI : SANDBOX_BASE_URI)
|
18
|
+
@base_uri = options[:base_uri] || (@production ? PRODUCTION_BASE_URI : SANDBOX_BASE_URI)
|
19
19
|
@user_agent = options.delete(:user_agent)
|
20
20
|
|
21
21
|
options[:format] ||= :json
|
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.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kivanio Barbosa
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|
@@ -103,6 +103,7 @@ executables: []
|
|
103
103
|
extensions: []
|
104
104
|
extra_rdoc_files: []
|
105
105
|
files:
|
106
|
+
- ".coveralls.yml"
|
106
107
|
- ".gitignore"
|
107
108
|
- ".ruby-gemset"
|
108
109
|
- ".ruby-version"
|