Class: FE::Document::PhoneType
- Inherits:
-
Object
- Object
- 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.
Instance Method Summary collapse
- #build_xml(node) ⇒ Object
-
#initialize(tag_name, country_code, number) ⇒ PhoneType
constructor
A new instance of PhoneType.
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(tag_name, country_code, number) ⇒ PhoneType
Returns a new instance of PhoneType.
17 18 19 20 21 |
# File 'lib/facturacr/document/phone_type.rb', line 17 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.
10 11 12 |
# File 'lib/facturacr/document/phone_type.rb', line 10 def country_code @country_code end |
#number ⇒ Object
Returns the value of attribute number.
10 11 12 |
# File 'lib/facturacr/document/phone_type.rb', line 10 def number @number end |
#tag_name ⇒ Object
Returns the value of attribute tag_name.
10 11 12 |
# File 'lib/facturacr/document/phone_type.rb', line 10 def tag_name @tag_name end |
Instance Method Details
#build_xml(node) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/facturacr/document/phone_type.rb', line 23 def build_xml(node) raise "Invalid Record: #{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) ⇒ Object
32 33 34 |
# File 'lib/facturacr/document/phone_type.rb', line 32 def to_xml(builder) build_xml(builder).to_xml end |