0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Validate argentine CBU and CUIT codes in ruby See https://github.com/bitex-la/bureaucrat
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 9.0
~> 10.0
~> 3.0

Runtime

 Project Readme

BureaucratRuby

Build Status

Validate Argentine CBUs and CUIT codes.

Installation

Add this line to your application's Gemfile:

gem 'bureaucrat_ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install bureaucrat_ruby

Usage

This gem is a binary distribution with ruby wrappers for bureaucrat, see the main bureaucrat library for more variants.

    cbu = BureaucratRuby::Cbu.create(id: "0170035040000002373188")
    cbu.errors.should be_empty

    cbu.attributes.should == {
      "id"=>"0170035040000002373188",
      "type"=>"cbus",
      "meta"=>nil,
      "bank"=>"017",
      "branch"=>"0035",
      "bank_name"=>"BBVA Banco Francés S.A.",
      "account"=>"40000002373188"
    }

    bad_cbu = BureaucratRuby::Cbu.create(id: "foo")
    bad_cbu.errors[:base].should == ['InvalidCbuFormat']

    cuit = BureaucratRuby::Cuit.create(id: "20319274228")
    cuit.errors.should be_empty
    
    cuit.attributes.should == {
      "id" => "20319274228",
      "type"=>"cuits",
      "meta"=>nil,
      "kind"=>"20",
      "person_id"=>"31927422",
    }

    bad_cuit = BureaucratRuby::Cuit.create(id: "foo")
    bad_cuit.errors[:base].should == ['InvalidCuitFormat']

Development & Contributions

See the main Bureaucrat library. We'll likely accept any pull request or issue asking for more validations to be added. Not limited to Argentina.

License

The gem is available as open source under the terms of the MIT License.