Skip to main content
The BankScrap adapter generator creates a complete project structure for building a new bank adapter, including all necessary files and boilerplate code.

Installation

Before using the generator, install the bankscrap gem:
gem install bankscrap

Generating an Adapter

1

Run the generator

Use the bankscrap generate_adapter command with your bank’s name:
bankscrap generate_adapter BankName
Replace BankName with your bank’s name (e.g., HSBC, ChaseBank, WellsFargo).
2

Review the generated structure

The generator creates a complete gem structure:
bankscrap-bank-name/
├── bankscrap-bank-name.gemspec
├── .gitignore
├── Gemfile
├── LICENSE.txt
├── README.md
├── Rakefile
└── lib/
    ├── bankscrap-bank-name.rb
    └── bankscrap/
        └── bank-name/
            ├── bank.rb
            └── version.rb
3

Initialize git repository

Navigate to the newly created directory and initialize git:
cd bankscrap-bank-name
git init
git add .
git commit -m "Initial commit from generator"
4

Start implementing

The main file to edit is:
lib/bankscrap/bank-name/bank.rb
This file contains template code with comments guiding you through the implementation.

Generated Files

Gemspec File

The .gemspec file contains the gem metadata. Update the following fields:
  • spec.authors - Your name
  • spec.email - Your email address
  • spec.summary - A brief description of the adapter
  • spec.homepage - GitHub repository URL

Bank Implementation File

The main bank.rb file includes:
  • Endpoint constants - Define your API URLs
  • REQUIRED_CREDENTIALS - Specify what credentials are needed
  • initialize - Constructor for custom setup
  • login - Authentication method
  • fetch_accounts - Retrieve user accounts
  • fetch_transactions_for - Get account transactions
  • fetch_loans - (Optional) Retrieve loans
  • fetch_cards - (Optional) Retrieve credit cards
  • Builder methods - Convert API data to BankScrap objects

README Template

The generated README includes:
  • Installation instructions
  • Usage examples (CLI and Ruby)
  • Credential requirements
  • Contributing guidelines
The generator uses Thor templates with variable interpolation. Your bank name is automatically converted to the correct format (dasherized for file names, module case for Ruby modules).

Name Formatting

The generator automatically handles name formatting:
InputGem NameModule NameFile Path
HSBCbankscrap-hsbcBankscrap::HSBClib/bankscrap/hsbc/bank.rb
ChaseBankbankscrap-chase-bankBankscrap::ChaseBanklib/bankscrap/chase-bank/bank.rb
WellsFargobankscrap-wells-fargoBankscrap::WellsFargolib/bankscrap/wells-fargo/bank.rb

Next Steps

After generating your adapter:
  1. Define credentials - Update REQUIRED_CREDENTIALS constant
  2. Implement login - Add authentication logic
  3. Fetch accounts - Implement account retrieval
  4. Fetch transactions - Implement transaction retrieval
  5. Test thoroughly - Ensure all methods work correctly
  6. Publish - Push to GitHub and share with the community
Before publishing your adapter, ensure you’re not exposing any sensitive information like API keys, credentials, or proprietary bank data in your code.

Getting Help

If you need assistance while building your adapter:

Build docs developers (and LLMs) love