Skip to content
Jeferson Alves edited this page Dec 4, 2022 · 3 revisions

WIKI: nubank_sdk

Get Started

Add this line to your application's Gemfile:

gem 'nubank_sdk'

And then execute:

$ bundle

Or install it yourself as:

$ gem install nubank_sdk

How-to: get my account balance of nubank? (Como obter o saldo da conta do nubank?)

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

user.auth.authenticate_with_certificate(password)

get the account balance

user.account.balance # => 77.0

Classes to explore

User

Account

Credit

Auth

Gem classes open to use

CLient

ApiRoutes