lib/itax_code.rb in itax_code-0.1.3 vs lib/itax_code.rb in itax_code-0.1.4
- old
+ new
@@ -1,65 +1,51 @@
-require "itax_code/version"
require "active_support/all"
+
+require "itax_code/version"
require "itax_code/utils"
require "itax_code/encoder"
require "itax_code/parser"
require "itax_code/validator"
module ItaxCode
class << self
- ##
- # This method encodes user tax code.
+ # Encodes user tax code.
#
- # @example
+ # @param [Hash] data The user attributes
#
- # ItaxCode.encode({
- # surname: [String]
- # name: [String]
- # gender: [String]
- # birthdate: [Date, DateTime, Time]
- # birthplace: [String]
- # })
+ # @option data [String] :surname
+ # @option data [String] :name
+ # @option data [String] :gender
+ # @option data [String, Date] :birthdate
+ # @option data [String] :birthplace
#
- # @param [Hash] data The user data attributes
- #
# @return [String]
-
def encode(data)
Encoder.new(data).encode
end
- ##
- # This method decodes tax code in its components.
+ # Decodes tax code in its components.
#
- # @example
- #
- # ItaxCode.decode("CCCFBA85D03L219P")
- #
# @param [String] tax_code The user tax code
#
# @return [Hash]
-
def decode(tax_code)
Parser.new(tax_code).decode
end
- ##
- # This method check given tax code validity
- # against new one encoded from user informations.
+ # Checks the given tax code validity against new one
+ # encoded from user informations.
#
- # @example
+ # @param [String] tax_code The user tax code
+ # @param [Hash] data The user attributes
#
- # ItaxCode.valid?(tax_code [String], {
- # surname: [String]
- # name: [String]
- # gender: [String]
- # birthdate: [Date, DateTime, Time]
- # birthplace: [String]
- # })
+ # @option data [String] :surname
+ # @option data [String] :name
+ # @option data [String] :gender
+ # @option data [String, Date] :birthdate
+ # @option data [String] :birthplace
#
- # @return [true, false]
-
+ # @return [Boolean]
def valid?(tax_code, data)
Validator.new(data).valid?(tax_code)
end
end