Class: ACube::Schema::Header::Customer
- Inherits:
-
Object
- Object
- ACube::Schema::Header::Customer
- Defined in:
- lib/acube/schema/header/customer.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#city ⇒ Object
Returns the value of attribute city.
-
#civic_number ⇒ Object
Returns the value of attribute civic_number.
-
#denomination ⇒ Object
Returns the value of attribute denomination.
-
#eori_code ⇒ Object
Returns the value of attribute eori_code.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#fiscal_code ⇒ Object
Returns the value of attribute fiscal_code.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#nation ⇒ Object
Returns the value of attribute nation.
-
#province ⇒ Object
Returns the value of attribute province.
-
#title ⇒ Object
Returns the value of attribute title.
-
#vat_fiscal_id ⇒ Object
Returns the value of attribute vat_fiscal_id.
-
#zip ⇒ Object
Returns the value of attribute zip.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
8 9 10 |
# File 'lib/acube/schema/header/customer.rb', line 8 def address @address end |
#city ⇒ Object
Returns the value of attribute city.
8 9 10 |
# File 'lib/acube/schema/header/customer.rb', line 8 def city @city end |
#civic_number ⇒ Object
Returns the value of attribute civic_number.
8 9 10 |
# File 'lib/acube/schema/header/customer.rb', line 8 def civic_number @civic_number end |
#denomination ⇒ Object
Returns the value of attribute denomination.
7 8 9 |
# File 'lib/acube/schema/header/customer.rb', line 7 def denomination @denomination end |
#eori_code ⇒ Object
Returns the value of attribute eori_code.
7 8 9 |
# File 'lib/acube/schema/header/customer.rb', line 7 def eori_code @eori_code end |
#first_name ⇒ Object
Returns the value of attribute first_name.
7 8 9 |
# File 'lib/acube/schema/header/customer.rb', line 7 def first_name @first_name end |
#fiscal_code ⇒ Object
Returns the value of attribute fiscal_code.
6 7 8 |
# File 'lib/acube/schema/header/customer.rb', line 6 def fiscal_code @fiscal_code end |
#last_name ⇒ Object
Returns the value of attribute last_name.
7 8 9 |
# File 'lib/acube/schema/header/customer.rb', line 7 def last_name @last_name end |
#nation ⇒ Object
Returns the value of attribute nation.
8 9 10 |
# File 'lib/acube/schema/header/customer.rb', line 8 def nation @nation end |
#province ⇒ Object
Returns the value of attribute province.
8 9 10 |
# File 'lib/acube/schema/header/customer.rb', line 8 def province @province end |
#title ⇒ Object
Returns the value of attribute title.
7 8 9 |
# File 'lib/acube/schema/header/customer.rb', line 7 def title @title end |
#vat_fiscal_id ⇒ Object
Returns the value of attribute vat_fiscal_id.
5 6 7 |
# File 'lib/acube/schema/header/customer.rb', line 5 def vat_fiscal_id @vat_fiscal_id end |
#zip ⇒ Object
Returns the value of attribute zip.
8 9 10 |
# File 'lib/acube/schema/header/customer.rb', line 8 def zip @zip end |
Class Method Details
.from(customer) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/acube/schema/header/customer.rb', line 10 def self.from(customer) new.tap do |cust| customer.customer_data.each do |key, value| value = value.is_a?(Symbol) ? customer.send(value).to_s : value.to_s cust.send("#{key}=", value) end end end |
Instance Method Details
#to_xml ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/acube/schema/header/customer.rb', line 19 def to_xml Nokogiri::XML::Builder.new do |xml| xml.CessionarioCommittente { xml.DatiAnagrafici { xml.CodiceFiscale fiscal_code xml.Anagrafica { if (first_name && last_name) xml.Nome first_name xml.Cognome last_name else xml.Denominazione denomination end xml.Titolo title if title xml.CodEORI eori_code if eori_code } } xml.Sede { xml.Indirizzo address xml.NumeroCivico civic_number if civic_number xml.CAP zip xml.Comune city xml.Provincia province xml.Nazione nation } } end.to_xml(save_with: 2) end |