topac / codice_fiscale Goto Github PK
View Code? Open in Web Editor NEWA Ruby gem that calculates the Italian Tax ID (Codice Fiscale)
License: MIT License
A Ruby gem that calculates the Italian Tax ID (Codice Fiscale)
License: MIT License
BTW I am also getting the same XXXXX code
[6] pry(main)> CodiceFiscale.calculate(
[6] pry(main)* :name => 'Mario',
[6] pry(main)* :surname => 'Rossi',
[6] pry(main)* :gender => :male,
[6] pry(main)* :birthdate => Date.new(1987, 1, 1),
[6] pry(main)* :province_code => 'LC',
[6] pry(main)* :city_name => 'Abbadia Lariana'
[6] pry(main)* )
=> "XXXXXX87A01A005D"
please advise on how to fix it
Gem name is correct
I'm using the gem but it does not work. It works just with the example provided in the homepage.
If I use other values like below:
2.1.8 :100 > CodiceFiscale.calculate(
2.1.8 :101 > :name => 'Mario',
2.1.8 :102 > :surname => 'Rossi',
2.1.8 :103 > :gender => :male,
2.1.8 :104 > :birthdate => Date.new(1987, 1, 1),
2.1.8 :105 > :province_code => 'RM',
2.1.8 :106 > :city_name => 'Roma'
2.1.8 :107?> )
=> "XXXXXX87A01H501J"
It does not work.
Hi there,
while using your gem, I've noticed that in case of ArgumentError
(raised here) does not give any clues about what generated the error:
#<ArgumentError: #<ActiveModel::Errors:0x007fd7680184b0>>
you should change the line with something like this:
raise ArgumentError.new("#{citizen.errors.inspect}") unless citizen.valid?
and now you'll get the entire ActiveModel::Errors
object:
#<ActiveModel::Errors:0x007f9d741933e0 @base=#<CodiceFiscale::ItalianCitizen:0x007f9d74193688 @attributes={:country_name=>"Italia", :name=>"Mario", :surname=>"Rossi", :gender=>:male, :birthdate=>Thu, 01 Jan 1987, :city_name=>654270}, @country_name="Italia", @name="Mario", @surname="Rossi", @gender=:male, @birthdate=Thu, 01 Jan 1987, @city_name=654270, @validation_context=nil, @errors=#<ActiveModel::Errors:0x007f9d741933e0 ...>>, @messages={:province_code=>["non può essere lasciato in bianco"]}>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.