nubank_sdk 0.6.1 → 0.7.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.
- checksums.yaml +4 -4
- data/.github/workflows/quality-inspector.yml +41 -0
- data/.vscode/settings.json +2 -1
- data/Gemfile.lock +13 -1
- data/README.md +72 -22
- data/lib/graphql/account/feed.gql +44 -0
- data/lib/nubank_sdk/account.rb +22 -1
- data/lib/nubank_sdk/api_routes.rb +3 -0
- data/lib/nubank_sdk/auth.rb +14 -17
- data/lib/nubank_sdk/certificate.rb +13 -0
- data/lib/nubank_sdk/client.rb +9 -0
- data/lib/nubank_sdk/credit.rb +16 -0
- data/lib/nubank_sdk/user.rb +7 -4
- data/lib/nubank_sdk/utils.rb +18 -0
- data/lib/nubank_sdk/version.rb +1 -1
- data/lib/nubank_sdk.rb +1 -0
- data/nubank_sdk.gemspec +5 -2
- metadata +40 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 053f6750d8819dc5c05fa23831829106314f7002357d65083f45a234a28233f0
|
4
|
+
data.tar.gz: 827596b59873ca86d556323dda076f710ee9dc19494bba206ee53cd748fa62ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf061fa7d6423a5c356418a5e9b2a823fa4492766e5b6bb92503bca7118cd323ce220a1042863b715a4af2297547c0539f44de35e95dd4ee1e814accbd8935df
|
7
|
+
data.tar.gz: e103553e8c83693f918437f7d4ac7ae5d9121af6f88c71b759c1b0ef9878b0be84c81a9775b770b60b64bbabd9d59be52dca2a985a225fa51829594ab3ac249f
|
@@ -0,0 +1,41 @@
|
|
1
|
+
name: Quality Inspector
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches: [ "develop" ]
|
5
|
+
pull_request:
|
6
|
+
branches: [ "develop" ]
|
7
|
+
jobs:
|
8
|
+
Rspec:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
ruby-version: ['3.0']
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v3
|
16
|
+
- name: Set up Ruby
|
17
|
+
uses: ruby/setup-ruby@ee2113536afb7f793eed4ce60e8d3b26db912da4 # v1.127.0
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby-version }}
|
20
|
+
bundler-cache: true
|
21
|
+
- name: Run tests
|
22
|
+
run: bundle exec rspec
|
23
|
+
- uses: joshmfrankel/simplecov-check-action@main
|
24
|
+
with:
|
25
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
26
|
+
|
27
|
+
Rubocop:
|
28
|
+
runs-on: ubuntu-latest
|
29
|
+
strategy:
|
30
|
+
matrix:
|
31
|
+
ruby-version: ['3.0']
|
32
|
+
|
33
|
+
steps:
|
34
|
+
- uses: actions/checkout@v3
|
35
|
+
- name: Set up Ruby
|
36
|
+
uses: ruby/setup-ruby@ee2113536afb7f793eed4ce60e8d3b26db912da4 # v1.127.0
|
37
|
+
with:
|
38
|
+
ruby-version: ${{ matrix.ruby-version }}
|
39
|
+
bundler-cache: true
|
40
|
+
- name: Run rubocop
|
41
|
+
run: bundle exec rubocop --format=g
|
data/.vscode/settings.json
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nubank_sdk (0.
|
4
|
+
nubank_sdk (0.7.0)
|
5
5
|
faraday (~> 2.7.1)
|
6
6
|
json (~> 2.3)
|
7
7
|
|
@@ -16,6 +16,7 @@ GEM
|
|
16
16
|
ast (2.4.2)
|
17
17
|
concurrent-ruby (1.1.10)
|
18
18
|
diff-lcs (1.5.0)
|
19
|
+
docile (1.4.0)
|
19
20
|
factory_bot (4.8.2)
|
20
21
|
activesupport (>= 3.0.0)
|
21
22
|
faraday (2.7.2)
|
@@ -63,6 +64,15 @@ GEM
|
|
63
64
|
rubocop (~> 1.33)
|
64
65
|
ruby-progressbar (1.11.0)
|
65
66
|
ruby2_keywords (0.0.5)
|
67
|
+
simplecov (0.21.2)
|
68
|
+
docile (~> 1.1)
|
69
|
+
simplecov-html (~> 0.11)
|
70
|
+
simplecov_json_formatter (~> 0.1)
|
71
|
+
simplecov-html (0.12.3)
|
72
|
+
simplecov-json (0.2.3)
|
73
|
+
json
|
74
|
+
simplecov
|
75
|
+
simplecov_json_formatter (0.1.4)
|
66
76
|
thread_safe (0.3.6)
|
67
77
|
tzinfo (1.2.10)
|
68
78
|
thread_safe (~> 0.1)
|
@@ -83,6 +93,8 @@ DEPENDENCIES
|
|
83
93
|
rspec (~> 3.0)
|
84
94
|
rubocop (~> 1.41.0)
|
85
95
|
rubocop-rspec (~> 2.16.0)
|
96
|
+
simplecov (~> 0.21.2)
|
97
|
+
simplecov-json (~> 0.2.3)
|
86
98
|
yard (~> 0.9.12)
|
87
99
|
|
88
100
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
|
1
|
+
# NubankSdk
|
2
2
|
|
3
|
-
|
3
|
+
[](https://rubygems.org/gems/nubank_sdk)
|
4
|
+
[](https://rubygems.org/gems/nubank_sdk)
|
5
|
+
[](https://github.com/Viserion77/nubank_sdk/actions/workflows/quality-inspector.yml?branch=develop)
|
4
6
|
|
5
7
|
A gem to make it ease to monitorize your Nubank account.
|
6
8
|
|
7
|
-
<!-- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/nubank_sdk`. To experiment with that code, run `bin/console` for an interactive prompt. -->
|
8
|
-
|
9
9
|
## Installation
|
10
10
|
|
11
11
|
Add this line to your application's Gemfile:
|
@@ -16,11 +16,15 @@ gem 'nubank_sdk'
|
|
16
16
|
|
17
17
|
And then execute:
|
18
18
|
|
19
|
-
|
19
|
+
```shell
|
20
|
+
bundle
|
21
|
+
```
|
20
22
|
|
21
23
|
Or install it yourself as:
|
22
24
|
|
23
|
-
|
25
|
+
```shell
|
26
|
+
gem install nubank_sdk
|
27
|
+
```
|
24
28
|
|
25
29
|
## Usage
|
26
30
|
|
@@ -28,13 +32,11 @@ Or install it yourself as:
|
|
28
32
|
require 'nubank_sdk'
|
29
33
|
|
30
34
|
# instance a nubank account object
|
31
|
-
user = NubankSdk::User.new
|
35
|
+
user = NubankSdk::User.new cpf: '12345678909'
|
32
36
|
password = 'dracarys'
|
33
37
|
```
|
34
38
|
|
35
|
-
> First time?
|
36
|
-
>
|
37
|
-
> authenticate the account
|
39
|
+
> First time? authenticate the account!
|
38
40
|
>
|
39
41
|
> ```ruby
|
40
42
|
> # request an email code
|
@@ -46,27 +48,75 @@ password = 'dracarys'
|
|
46
48
|
> user.auth.exchange_certs(email_code, password)
|
47
49
|
> ```
|
48
50
|
>
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
>
|
55
|
-
> ```ruby
|
56
|
-
> user.auth.authenticate_with_certificate(password)
|
57
|
-
> ```
|
51
|
+
|
52
|
+
Has a certificate? generate a access token :D
|
53
|
+
```ruby
|
54
|
+
user.auth.authenticate_with_certificate(password)
|
55
|
+
```
|
58
56
|
|
59
57
|
get the account balance
|
60
58
|
|
61
59
|
```ruby
|
62
|
-
user.account.balance # => 77.0
|
60
|
+
account_balance = user.account.balance # => 77.0
|
63
61
|
```
|
64
62
|
|
65
63
|
## Development
|
66
64
|
|
67
|
-
|
65
|
+
> <details>
|
66
|
+
>
|
67
|
+
> <summary>Prerequisites</summary>
|
68
|
+
>
|
69
|
+
> - Ruby 2.7.2
|
70
|
+
> - Bundler
|
71
|
+
> - git
|
72
|
+
>
|
73
|
+
> Clone the repository:
|
74
|
+
> ```shell
|
75
|
+
> git clone https://github.com/viserion77/nubank_sdk.git
|
76
|
+
> ```
|
77
|
+
>
|
78
|
+
> Install the dependencies:
|
79
|
+
> ```shell
|
80
|
+
> bundle install
|
81
|
+
> ```
|
82
|
+
>
|
83
|
+
> </details>
|
84
|
+
|
85
|
+
- Create a new branch for your feature or bugfix
|
86
|
+
- Commit your changes, and push your branch to GitHub
|
87
|
+
- Open a Pull Request to the `develop` branch
|
88
|
+
- Write a description for your PR, and how to test it!
|
89
|
+
- Wait for the CI to run the tests and check the code quality
|
90
|
+
- If everything is ok, your PR will be merged
|
91
|
+
|
92
|
+
## Deployment
|
68
93
|
|
69
|
-
|
94
|
+
> <details>
|
95
|
+
>
|
96
|
+
> <summary>Prerequisites</summary>
|
97
|
+
>
|
98
|
+
> - Ruby 2.7.2
|
99
|
+
> - Bundler
|
100
|
+
> - git
|
101
|
+
>
|
102
|
+
> Clone the repository:
|
103
|
+
> ```shell
|
104
|
+
> git clone https://github.com/viserion77/nubank_sdk.git
|
105
|
+
> ```
|
106
|
+
>
|
107
|
+
> Install the dependencies:
|
108
|
+
> ```shell
|
109
|
+
> bundle install
|
110
|
+
> ```
|
111
|
+
>
|
112
|
+
> </details>
|
113
|
+
|
114
|
+
- Create a new branch from `develop` for bumping the version
|
115
|
+
- run `bundle exec rake start_new_release` to bump the version and a new tag
|
116
|
+
- Open a Pull Request to the `main` branch
|
117
|
+
- If everything is ok, your PR will be merged
|
118
|
+
- After the merge, the CI will publish the new version to rubygems.org
|
119
|
+
- If all goes well, you need release the new tag to GitHub. ([tags](https://github.com/Viserion77/nubank_sdk/tags))
|
70
120
|
|
71
121
|
## Contributing
|
72
122
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
{
|
2
|
+
viewer {
|
3
|
+
savingsAccount {
|
4
|
+
id
|
5
|
+
feed {
|
6
|
+
id
|
7
|
+
__typename
|
8
|
+
title
|
9
|
+
detail
|
10
|
+
postDate
|
11
|
+
... on TransferInEvent {
|
12
|
+
amount
|
13
|
+
originAccount {
|
14
|
+
name
|
15
|
+
}
|
16
|
+
}
|
17
|
+
... on TransferOutEvent {
|
18
|
+
amount
|
19
|
+
destinationAccount {
|
20
|
+
name
|
21
|
+
}
|
22
|
+
}
|
23
|
+
... on TransferOutReversalEvent {
|
24
|
+
amount
|
25
|
+
}
|
26
|
+
... on BillPaymentEvent {
|
27
|
+
amount
|
28
|
+
}
|
29
|
+
... on DebitPurchaseEvent {
|
30
|
+
amount
|
31
|
+
}
|
32
|
+
... on BarcodePaymentEvent {
|
33
|
+
amount
|
34
|
+
}
|
35
|
+
... on DebitWithdrawalFeeEvent {
|
36
|
+
amount
|
37
|
+
}
|
38
|
+
... on DebitWithdrawalEvent {
|
39
|
+
amount
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
data/lib/nubank_sdk/account.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module NubankSdk
|
4
|
+
#
|
5
|
+
# Returns the account statement
|
6
|
+
#
|
4
7
|
class Account
|
5
8
|
#
|
6
9
|
# Returns the account statement
|
@@ -26,8 +29,26 @@ module NubankSdk
|
|
26
29
|
}
|
27
30
|
)
|
28
31
|
|
29
|
-
data =
|
32
|
+
data = Client.get_body(response)
|
30
33
|
data[:data][:viewer][:savingsAccount][:currentSavingsBalance][:netAmount]
|
31
34
|
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# Returns the account feed
|
38
|
+
#
|
39
|
+
# @return [Array<Hash>]
|
40
|
+
def feed
|
41
|
+
query_url = @api_routes.entrypoint(path: :ssl, entrypoint: :query)
|
42
|
+
|
43
|
+
response = @connection.post(
|
44
|
+
query_url, {
|
45
|
+
'variables': {},
|
46
|
+
'query': Utils.read_graphql_query('account', 'feed')
|
47
|
+
}
|
48
|
+
)
|
49
|
+
|
50
|
+
data = Client.get_body(response)
|
51
|
+
data[:data][:viewer][:savingsAccount][:feed]
|
52
|
+
end
|
32
53
|
end
|
33
54
|
end
|
data/lib/nubank_sdk/auth.rb
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
require 'securerandom'
|
4
4
|
|
5
5
|
module NubankSdk
|
6
|
+
#
|
7
|
+
# Auth method to connect with the nubank api
|
8
|
+
#
|
6
9
|
class Auth
|
7
10
|
attr_reader :refresh_token, :refresh_before, :access_token
|
8
11
|
|
@@ -16,7 +19,7 @@ module NubankSdk
|
|
16
19
|
def initialize(cpf:, device_id: nil, api_routes: nil, connection_adapter: nil)
|
17
20
|
@cpf = cpf
|
18
21
|
@device_id = device_id || generate_device_id
|
19
|
-
@api_routes = api_routes ||
|
22
|
+
@api_routes = api_routes || ApiRoutes.new
|
20
23
|
|
21
24
|
@connection_adapter = connection_adapter
|
22
25
|
end
|
@@ -26,7 +29,7 @@ module NubankSdk
|
|
26
29
|
#
|
27
30
|
# @return [NubankSdk::Certificate] the certificate instance
|
28
31
|
def certificate
|
29
|
-
@certificate ||=
|
32
|
+
@certificate ||= Certificate.new(@cpf)
|
30
33
|
end
|
31
34
|
|
32
35
|
#
|
@@ -41,9 +44,8 @@ module NubankSdk
|
|
41
44
|
|
42
45
|
response_hash = Client.get_body(response)
|
43
46
|
|
44
|
-
@refresh_token = response_hash
|
45
|
-
|
46
|
-
@access_token = response_hash[:access_token]
|
47
|
+
@refresh_token, @refresh_before, @access_token = response_hash.values_at(:refresh_token, :refresh_before,
|
48
|
+
:access_token)
|
47
49
|
|
48
50
|
update_api_routes(response_hash[:_links])
|
49
51
|
end
|
@@ -68,10 +70,9 @@ module NubankSdk
|
|
68
70
|
#
|
69
71
|
# @return [File] the certificate file
|
70
72
|
def exchange_certs(email_code, password)
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
}))
|
73
|
+
new_payload = payload(password)
|
74
|
+
.merge({ code: email_code, 'encrypted-code': @encrypted_code })
|
75
|
+
response = default_connection.post(@gen_certificate_path, new_payload)
|
75
76
|
|
76
77
|
response_data = Client.get_body(response)
|
77
78
|
certificate.process_decoded(key, response_data[:certificate])
|
@@ -146,16 +147,12 @@ module NubankSdk
|
|
146
147
|
#
|
147
148
|
# @return [NubankSdk::ApiRoutes] the api routes with the new links
|
148
149
|
def update_api_routes(links)
|
149
|
-
feed_url_keys = %i[events magnitude]
|
150
|
-
bills_url_keys = [:bills_summary]
|
151
|
-
customer_url_keys = [:customer]
|
152
|
-
account_url_keys = [:account]
|
153
150
|
@api_routes.add_entrypoint(path: :ssl, entrypoint: :revoke_token, url: links[:revoke_token][:href])
|
154
151
|
@api_routes.add_entrypoint(path: :ssl, entrypoint: :query, url: links[:ghostflame][:href])
|
155
|
-
@api_routes.add_entrypoint(path: :ssl, entrypoint: :feed, url: find_url(
|
156
|
-
@api_routes.add_entrypoint(path: :ssl, entrypoint: :bills, url: find_url(
|
157
|
-
@api_routes.add_entrypoint(path: :ssl, entrypoint: :customer, url: find_url(
|
158
|
-
@api_routes.add_entrypoint(path: :ssl, entrypoint: :account, url: find_url(
|
152
|
+
@api_routes.add_entrypoint(path: :ssl, entrypoint: :feed, url: find_url(%i[events magnitude], links))
|
153
|
+
@api_routes.add_entrypoint(path: :ssl, entrypoint: :bills, url: find_url([:bills_summary], links))
|
154
|
+
@api_routes.add_entrypoint(path: :ssl, entrypoint: :customer, url: find_url([:customer], links))
|
155
|
+
@api_routes.add_entrypoint(path: :ssl, entrypoint: :account, url: find_url([:account], links))
|
159
156
|
@api_routes
|
160
157
|
end
|
161
158
|
|
@@ -3,6 +3,9 @@
|
|
3
3
|
require 'openssl'
|
4
4
|
|
5
5
|
module NubankSdk
|
6
|
+
#
|
7
|
+
# Controller of certifications
|
8
|
+
#
|
6
9
|
class Certificate
|
7
10
|
FILES_PATH = './certificates/'
|
8
11
|
|
@@ -53,11 +56,21 @@ module NubankSdk
|
|
53
56
|
#
|
54
57
|
# @return [File]
|
55
58
|
def save(p12)
|
59
|
+
create_folder
|
60
|
+
|
56
61
|
File.open("#{FILES_PATH}#{@cpf}.p12", 'wb') do |file|
|
57
62
|
file.write p12.to_der
|
58
63
|
end
|
59
64
|
end
|
60
65
|
|
66
|
+
# @!visibility private
|
67
|
+
# Create certificates folder
|
68
|
+
#
|
69
|
+
# @return [File]
|
70
|
+
def create_folder
|
71
|
+
Dir.mkdir(FILES_PATH) unless Dir.exist?(FILES_PATH)
|
72
|
+
end
|
73
|
+
|
61
74
|
# @!visibility private
|
62
75
|
# crypt key and certificate to pkcs12
|
63
76
|
#
|
data/lib/nubank_sdk/client.rb
CHANGED
@@ -4,6 +4,9 @@ require 'faraday'
|
|
4
4
|
require 'json'
|
5
5
|
|
6
6
|
module NubankSdk
|
7
|
+
#
|
8
|
+
# Wrapper for Faraday::Connection
|
9
|
+
#
|
7
10
|
module Client
|
8
11
|
#
|
9
12
|
# Parse the response body symbolizing keys
|
@@ -15,6 +18,9 @@ module NubankSdk
|
|
15
18
|
JSON.parse(response.body, symbolize_names: true)
|
16
19
|
end
|
17
20
|
|
21
|
+
#
|
22
|
+
# create a new connection with the given url in Faraday
|
23
|
+
#
|
18
24
|
class HTTP
|
19
25
|
#
|
20
26
|
# create a new connection with the given url in Faraday
|
@@ -53,6 +59,9 @@ module NubankSdk
|
|
53
59
|
end
|
54
60
|
end
|
55
61
|
|
62
|
+
#
|
63
|
+
# Create a new instance of Faraday::Connection with client certificate
|
64
|
+
#
|
56
65
|
class HTTPS
|
57
66
|
attr_accessor :headers
|
58
67
|
|
data/lib/nubank_sdk/credit.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module NubankSdk
|
4
|
+
#
|
5
|
+
# Returns the credit statement
|
6
|
+
#
|
4
7
|
class Credit
|
5
8
|
#
|
6
9
|
# Returns the credit statement
|
@@ -24,5 +27,18 @@ module NubankSdk
|
|
24
27
|
|
25
28
|
response_hash[:account][:balances]
|
26
29
|
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# Returns the credit feed
|
33
|
+
#
|
34
|
+
# @return [Array<Hash>] the credit feed
|
35
|
+
def feed
|
36
|
+
feed_url = @api_routes.entrypoint(path: :ssl, entrypoint: :feed)
|
37
|
+
|
38
|
+
response = @connection.get(feed_url)
|
39
|
+
|
40
|
+
data = Client.get_body(response)
|
41
|
+
data[:events]
|
42
|
+
end
|
27
43
|
end
|
28
44
|
end
|
data/lib/nubank_sdk/user.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module NubankSdk
|
4
|
+
#
|
5
|
+
# Controller of user actions in nubank
|
6
|
+
#
|
4
7
|
class User
|
5
8
|
#
|
6
9
|
# Controller of user actions in nubank
|
@@ -17,7 +20,7 @@ module NubankSdk
|
|
17
20
|
#
|
18
21
|
# @return [NubankSdk::Auth]
|
19
22
|
def auth
|
20
|
-
@auth ||=
|
23
|
+
@auth ||= Auth.new(
|
21
24
|
cpf: @cpf,
|
22
25
|
api_routes: api_routes,
|
23
26
|
connection_adapter: @connection_adapter
|
@@ -29,7 +32,7 @@ module NubankSdk
|
|
29
32
|
#
|
30
33
|
# @return [NubankSdk::Account]
|
31
34
|
def account
|
32
|
-
@account ||=
|
35
|
+
@account ||= Account.new(connection: connection, api_routes: api_routes)
|
33
36
|
end
|
34
37
|
|
35
38
|
#
|
@@ -37,7 +40,7 @@ module NubankSdk
|
|
37
40
|
#
|
38
41
|
# @return [NubankSdk::Credit]
|
39
42
|
def credit
|
40
|
-
@credit ||=
|
43
|
+
@credit ||= Credit.new(connection: connection, api_routes: api_routes)
|
41
44
|
end
|
42
45
|
|
43
46
|
#
|
@@ -45,7 +48,7 @@ module NubankSdk
|
|
45
48
|
#
|
46
49
|
# @return [NubankSdk::ApiRoutes]
|
47
50
|
def api_routes
|
48
|
-
@api_routes ||=
|
51
|
+
@api_routes ||= ApiRoutes.new
|
49
52
|
end
|
50
53
|
|
51
54
|
private
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module NubankSdk
|
4
|
+
#
|
5
|
+
# Utils
|
6
|
+
module Utils
|
7
|
+
#
|
8
|
+
# read graphQL query from file in ../graphql/{path}/{query}.gql
|
9
|
+
#
|
10
|
+
# @param [String] path - path to the query account, credit
|
11
|
+
# @param [String] query - query name
|
12
|
+
#
|
13
|
+
# @return [String]
|
14
|
+
def self.read_graphql_query(path, query)
|
15
|
+
File.read(File.join('.', 'lib', 'graphql', path, "#{query}.gql"))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/nubank_sdk/version.rb
CHANGED
data/lib/nubank_sdk.rb
CHANGED
data/nubank_sdk.gemspec
CHANGED
@@ -13,10 +13,11 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.summary = 'A gem to make it ease to monitorize your Nubank account.'
|
14
14
|
spec.description = 'Monitorize balances, recent transactions, credit limit etc...'
|
15
15
|
spec.homepage = 'https://github.com/Viserion77/nubank_sdk'
|
16
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
|
16
17
|
|
17
18
|
# Specify which files should be added to the gem when it is released.
|
18
19
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
-
spec.files
|
20
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
20
21
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
22
|
end
|
22
23
|
spec.bindir = 'exe'
|
@@ -25,12 +26,14 @@ Gem::Specification.new do |spec|
|
|
25
26
|
|
26
27
|
spec.add_development_dependency 'bundler', '~> 2.3.26'
|
27
28
|
spec.add_development_dependency 'factory_bot', '~> 4.8.2'
|
29
|
+
spec.add_development_dependency 'gem-release', '~> 2.2.2'
|
28
30
|
spec.add_development_dependency 'rake', '~> 13.0'
|
29
31
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
32
|
spec.add_development_dependency 'rubocop', '~> 1.41.0'
|
31
33
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.16.0'
|
34
|
+
spec.add_development_dependency 'simplecov', '~> 0.21.2'
|
35
|
+
spec.add_development_dependency 'simplecov-json', '~> 0.2.3'
|
32
36
|
spec.add_development_dependency 'yard', '~> 0.9.12'
|
33
|
-
spec.add_development_dependency 'gem-release', '~> 2.2.2'
|
34
37
|
|
35
38
|
spec.add_dependency 'faraday', '~> 2.7.1'
|
36
39
|
spec.add_dependency 'json', '~> 2.3'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nubank_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Viserion77
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 4.8.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: gem-release
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.2.2
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.2.2
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,33 +109,47 @@ dependencies:
|
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: 2.16.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
112
|
+
name: simplecov
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
117
|
+
version: 0.21.2
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
124
|
+
version: 0.21.2
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
126
|
+
name: simplecov-json
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
131
|
+
version: 0.2.3
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
138
|
+
version: 0.2.3
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: yard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.9.12
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.9.12
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
154
|
name: faraday
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,6 +187,7 @@ extra_rdoc_files: []
|
|
159
187
|
files:
|
160
188
|
- ".github/FUNDING.yml"
|
161
189
|
- ".github/workflows/gem-push.yml"
|
190
|
+
- ".github/workflows/quality-inspector.yml"
|
162
191
|
- ".gitignore"
|
163
192
|
- ".rspec"
|
164
193
|
- ".rubocop.yml"
|
@@ -172,6 +201,7 @@ files:
|
|
172
201
|
- bin/console
|
173
202
|
- bin/setup
|
174
203
|
- certificates/.gitkeep
|
204
|
+
- lib/graphql/account/feed.gql
|
175
205
|
- lib/nubank_sdk.rb
|
176
206
|
- lib/nubank_sdk/account.rb
|
177
207
|
- lib/nubank_sdk/api_routes.rb
|
@@ -180,6 +210,7 @@ files:
|
|
180
210
|
- lib/nubank_sdk/client.rb
|
181
211
|
- lib/nubank_sdk/credit.rb
|
182
212
|
- lib/nubank_sdk/user.rb
|
213
|
+
- lib/nubank_sdk/utils.rb
|
183
214
|
- lib/nubank_sdk/version.rb
|
184
215
|
- nubank_sdk.gemspec
|
185
216
|
homepage: https://github.com/Viserion77/nubank_sdk
|
@@ -193,7 +224,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
193
224
|
requirements:
|
194
225
|
- - ">="
|
195
226
|
- !ruby/object:Gem::Version
|
196
|
-
version:
|
227
|
+
version: 2.7.0
|
197
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
229
|
requirements:
|
199
230
|
- - ">="
|