bb_statements

BancoBrasilStatements - The Ruby gem for the the Banco do Brasil Statements API

Installation

Build a gem

To build the Ruby code into a gem:

gem build bb_statements.gemspec

Then either install the gem locally:

gem install ./bb_statements-1.0.0.gem

(for development, run gem install --dev ./bb_statements-1.0.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'bb_statements', '~> 1.0.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'bb_statements', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'bb_statements'
# Setup authorization
BancoBrasilStatements.configure do |config|
  # Configure OAuth2 access token for authorization: OAuth2-CC
  config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = BancoBrasilStatements::StatementsApi.new
id = 'id_example' # String | Código identificador do pagamento.
gw_dev_app_key = 'gw_dev_app_key_example' # String | Chave de acesso do aplicativo do desenvolvedor. Esta chave é única e obtida no Portal “BB for Developers” e usada para identificar as requisições da aplicação do desenvolvedor.  Example: 0021239456d80136bebf005056891bed
authorization = 'authorization_example' # String | É um “token” de acesso fornecido pelo OAuth 2.0.  Example: Bearer [ACCESS_TOKEN]
opts = {
  start_date: Date.yesterday,
  end_date: Date.current,
  page_size: 50,
  page_index: 1
}

begin
  # branch_office, account, opts
  result = api_instance.consult_statements(1505, 1348, opts)
  p result
rescue BancoBrasilStatements::ApiError => e
  puts "Exception when calling StatementsApi->consult_statements: #{e}"
end
# Setup authorization
BancoBrasilStatements.configure do |config|
  # Configure OAuth2 access token for authorization: OAuth2-CC
  config.access_token = 'YOUR ACCESS TOKEN'
end