项目作者: max-power

项目描述 :
VAT Identification Number validation
高级语言: Ruby
项目地址: git://github.com/max-power/vat_id.git
创建时间: 2013-09-11T12:46:12Z
项目社区:https://github.com/max-power/vat_id

开源协议:MIT License

下载


VAT Identification Number

VAT ID validation. Ships with an ActiveModel validator.

Gem Version
Build Status

Installation

Add this line to your application’s Gemfile:

  1. gem 'vat_id'

And then execute:

  1. $ bundle

Or install it yourself as:

  1. $ gem install vat_id

Usage

  1. v = VatId.new('DE123456789')
  2. v.valid? # true
  3. v.country_code # 'DE'
  4. v.identifier # '123456789'
  5. v.to_s # 'DE123456789'
  6. VatId.valid?('DE123456789') # true

or as ActiveModel Validator (make sure you have ‘active_model’ before ‘vat_id’ in your Gemfile)

  1. class Company
  2. include ActiveModel::Model
  3. attr_accessor :tax_number, :name
  4. validates :tax_number, vat_id: true
  5. end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request