Class: FE::Document::PhoneType
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/facturacr/document/phone_type.rb
Instance Attribute Summary collapse
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#number ⇒ Object
Returns the value of attribute number.
-
#tag_name ⇒ Object
Returns the value of attribute tag_name.
Attributes inherited from Element
Instance Method Summary collapse
- #build_xml(node, document) ⇒ Object
-
#initialize(tag_name, country_code, number) ⇒ PhoneType
constructor
A new instance of PhoneType.
- #to_xml(builder, document) ⇒ Object
Constructor Details
#initialize(tag_name, country_code, number) ⇒ PhoneType
Returns a new instance of PhoneType.
13 14 15 16 17 |
# File 'lib/facturacr/document/phone_type.rb', line 13 def initialize(tag_name, country_code, number) @tag_name = tag_name @country_code = country_code @number = number end |
Instance Attribute Details
#country_code ⇒ Object
Returns the value of attribute country_code.
6 7 8 |
# File 'lib/facturacr/document/phone_type.rb', line 6 def country_code @country_code end |
#number ⇒ Object
Returns the value of attribute number.
6 7 8 |
# File 'lib/facturacr/document/phone_type.rb', line 6 def number @number end |
#tag_name ⇒ Object
Returns the value of attribute tag_name.
6 7 8 |
# File 'lib/facturacr/document/phone_type.rb', line 6 def tag_name @tag_name end |
Instance Method Details
#build_xml(node, document) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/facturacr/document/phone_type.rb', line 19 def build_xml(node, document) raise FE::Error.new("phone type invalid",class: self.class, messages: errors.) unless valid? node = Nokogiri::XML::Builder.new if node.nil? node.send(tag_name) do |xml| xml.CodigoPais country_code xml.NumTelefono number end end |
#to_xml(builder, document) ⇒ Object
29 30 31 |
# File 'lib/facturacr/document/phone_type.rb', line 29 def to_xml(builder,document) build_xml(builder, document).to_xml end |