Class: VatInfo::Models::VatPayerExtended
- Defined in:
- lib/vat_info/models/vat_payer_extended.rb
Instance Attribute Summary
Attributes inherited from VatPayer
Instance Method Summary collapse
-
#initialize(params) ⇒ VatPayerExtended
constructor
A new instance of VatPayerExtended.
- #normalize(string) ⇒ Object
Methods inherited from VatPayer
#create_accounts, #non_standard_account, #standard_account
Constructor Details
#initialize(params) ⇒ VatPayerExtended
Returns a new instance of VatPayerExtended.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/vat_info/models/vat_payer_extended.rb', line 4 def initialize(params) super(params) @data[:nazev_subjektu] = normalize(params[:nazev_subjektu]) address = params.fetch(:adresa, {}) @data[:ulice_cislo] = normalize(address[:ulice_cislo]) @data[:cast_obce] = normalize(address[:cast_obce]) @data[:mesto] = normalize(address[:mesto]) @data[:psc] = normalize(address[:psc]) @data[:stat] = address[:stat] rescue KeyError => e raise InvalidStructure, "Response XML is missing required attributes.\n" \ "Input params were: #{params}\n" \ "Rescued error: #{e}" end |
Instance Method Details
#normalize(string) ⇒ Object
21 22 23 |
# File 'lib/vat_info/models/vat_payer_extended.rb', line 21 def normalize(string) VatInfo::Utils.normalize(string) end |