Class: AdfBuilder::Nodes::Customer

Inherits:
Node
  • Object
show all
Defined in:
lib/adf_builder/nodes/customer.rb

Instance Attribute Summary

Attributes inherited from Node

#attributes, #children, #tag_name, #value

Instance Method Summary collapse

Methods inherited from Node

#add_child, #method_missing, #remove_children, #respond_to_missing?, #to_xml

Methods included from Validations

included, #validate!

Constructor Details

#initializeCustomer

Returns a new instance of Customer.



6
7
8
9
# File 'lib/adf_builder/nodes/customer.rb', line 6

def initialize
  super
  @tag_name = :customer
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AdfBuilder::Nodes::Node

Instance Method Details

#comments(value) ⇒ Object



32
33
34
35
# File 'lib/adf_builder/nodes/customer.rb', line 32

def comments(value)
  remove_children(:comments)
  add_child(GenericNode.new(:comments, {}, value))
end

#contact(&block) ⇒ Object



13
14
15
16
17
18
# File 'lib/adf_builder/nodes/customer.rb', line 13

def contact(&block)
  remove_children(:contact)
  contact = Contact.new
  contact.instance_eval(&block) if block_given?
  add_child(contact)
end

#id(value, sequence: nil, source: nil) ⇒ Object



20
21
22
23
# File 'lib/adf_builder/nodes/customer.rb', line 20

def id(value, sequence: nil, source: nil)
  # id* is multiple
  add_child(Id.new(value, sequence: sequence, source: source))
end

#timeframe(&block) ⇒ Object



25
26
27
28
29
30
# File 'lib/adf_builder/nodes/customer.rb', line 25

def timeframe(&block)
  remove_children(:timeframe)
  tf = Timeframe.new
  tf.instance_eval(&block) if block_given?
  add_child(tf)
end