Class: InvoiceVatItem

Inherits:
Object
  • Object
show all
Defined in:
lib/fastbill/invoice_vat_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ InvoiceVatItem

Returns a new instance of InvoiceVatItem.



4
5
6
7
8
# File 'lib/fastbill/invoice_vat_item.rb', line 4

def initialize(body)
  @vat_percent = body["VAT_PERCENT"]
  @vat_value = body["VAT_VALUE"]
  self
end

Instance Attribute Details

#vat_percentObject

Returns the value of attribute vat_percent.



2
3
4
# File 'lib/fastbill/invoice_vat_item.rb', line 2

def vat_percent
  @vat_percent
end

#vat_valueObject

Returns the value of attribute vat_value.



2
3
4
# File 'lib/fastbill/invoice_vat_item.rb', line 2

def vat_value
  @vat_value
end

Instance Method Details

#to_xmlObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/fastbill/invoice_vat_item.rb', line 9

def to_xml
  xml = "<VAT_ITEM>"
  unless @vat_percent.nil?
    xml = "<VAT_PERCENT>#{@vat_percent}</VAT_PERCENT>"
  end
  unless @vat_value.nil?
    xml = "<VAT_VALUE>#{@vat_value}</VAT_VALUE>"
  end
  xml + "</VAT_ITEM>"
end