Class: NFE::Detail
Constant Summary collapse
- REQUIRED_FIELDS =
[ :rps_type, :rps_number, :issuing_date, :rps_status, :amount, :tax_amount, :service_code, :aliquot, :iss_by, :taker_type, :taker_document, :service_description ]
- VALID_FIELDS =
[ :rps_type, :rps_serial, :rps_number, :issuing_date, :rps_status, :amount, :tax_amount, :service_code, :aliquot, :iss_by, :taker_type, :taker_document, :taker_ccm, :state_registration, :taker_name, :address_type, :address, :address_number, :complement, :district, :city, #:uf, :zip_code, :taker_email, :pis_pasep, :cofins, :inss, :ir, :cssl, :total_tax_amount, :tributary_percentage, :tributary_source, :cei, :matriculation, :city_ibge_code, :private_blank_field, :service_description ]
- DEFAULTS =
{ rps_type: "RPS", issuing_date: Time.now.to_date.strftime("%Y%m%d") }
Constants inherited from Register
Instance Attribute Summary
Attributes inherited from Register
#fields, #required_fields, #type
Instance Method Summary collapse
-
#initialize ⇒ Detail
constructor
A new instance of Detail.
- #valid? ⇒ Boolean
Methods inherited from Register
#<<, #to_hash, #to_s, #valid_register_field?, #validate!
Constructor Details
#initialize ⇒ Detail
Returns a new instance of Detail.
63 64 65 |
# File 'lib/detail.rb', line 63 def initialize super 6 end |
Instance Method Details
#valid? ⇒ Boolean
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/detail.rb', line 67 def valid? fields_hash = self.to_hash if fields_hash[:taker_type].eql? "2" @required_fields.concat([ :taker_name, :taker_email, :address_type, :address, :address_number, :district, :city, #:uf, :zip_code ]) end if ["F", "B", "N", "V"].include?(fields_hash[:rps_status]) @required_fields << :city_ibge_code end super end |