Skip to content

Viserion77/nubank_sdk

Repository files navigation

NubankSdk

Version Downloads Quality Inspector

A gem to make it ease to monitorize your Nubank account.

Installation

Add this line to your application's Gemfile:

gem 'nubank_sdk'

And then execute:

bundle

Or install it yourself as:

gem install nubank_sdk

Usage

require 'nubank_sdk'

# instance a nubank account object
user = NubankSdk::User.new cpf: '12345678909'
password = 'dracarys'

First time? authenticate the account!

# request an email code
account_email = user.auth.request_email_code(password)

# get the email code from the user
puts "Enter the code sent to #{account_email}: "
email_code = gets.chomp
user.auth.exchange_certs(email_code, password)

Has a certificate? generate a access token :D

user.auth.authenticate_with_certificate(password)

get the account balance

account_balance = user.account.balance # => 77.0

Development

Prerequisites
  • Ruby 2.7.2
  • Bundler
  • git

Clone the repository:

git clone https://github.com/viserion77/nubank_sdk.git

Install the dependencies:

bundle install
  • Create a new branch for your feature or bugfix
  • Commit your changes, and push your branch to GitHub
  • Open a Pull Request to the develop branch
  • Write a description for your PR, and how to test it!
  • Wait for the CI to run the tests and check the code quality
  • If everything is ok, your PR will be merged

Deployment

Prerequisites
  • Ruby 2.7.2
  • Bundler
  • git

Clone the repository:

git clone https://github.com/viserion77/nubank_sdk.git

Install the dependencies:

bundle install
  • Create a new branch from develop for bumping the version
  • run bundle exec rake start_new_release to bump the version and a new tag
  • Open a Pull Request to the main branch
  • If everything is ok, your PR will be merged
  • After the merge, the CI will publish the new version to rubygems.org
  • If all goes well, you need release the new tag to GitHub. (tags)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/viserion77/nubank_sdk.

This project was based on the python implementation in this project: andreroggeri/pynubank