Class: AdfBuilder::Nodes::Provider

Inherits:
Node
  • Object
show all
Defined in:
lib/adf_builder/nodes/provider.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

#initializeProvider

Returns a new instance of Provider.



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

def initialize
  super
  @tag_name = :provider
end

Dynamic Method Handling

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

Instance Method Details

#contact(primary_contact: false, &block) ⇒ Object



41
42
43
44
45
46
# File 'lib/adf_builder/nodes/provider.rb', line 41

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

#email(value, preferredcontact: nil) ⇒ Object



31
32
33
34
# File 'lib/adf_builder/nodes/provider.rb', line 31

def email(value, preferredcontact: nil)
  remove_children(:email)
  add_child(Email.new(value, preferredcontact: preferredcontact))
end

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



12
13
14
# File 'lib/adf_builder/nodes/provider.rb', line 12

def id(value, sequence: nil, source: nil)
  add_child(Id.new(value, sequence: sequence, source: source))
end

#name(value, part: nil, type: nil) ⇒ Object



16
17
18
19
# File 'lib/adf_builder/nodes/provider.rb', line 16

def name(value, part: nil, type: nil)
  remove_children(:name)
  add_child(Name.new(value, part: part, type: type))
end

#phone(value, type: nil, time: nil, preferredcontact: nil) ⇒ Object



36
37
38
39
# File 'lib/adf_builder/nodes/provider.rb', line 36

def phone(value, type: nil, time: nil, preferredcontact: nil)
  remove_children(:phone)
  add_child(Phone.new(value, type: type, time: time, preferredcontact: preferredcontact))
end

#service(value) ⇒ Object



21
22
23
24
# File 'lib/adf_builder/nodes/provider.rb', line 21

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

#url(value) ⇒ Object



26
27
28
29
# File 'lib/adf_builder/nodes/provider.rb', line 26

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