Class: AdfBuilder::Contact
- Inherits:
-
Object
- Object
- AdfBuilder::Contact
- Defined in:
- lib/adf_builder/shared/contact.rb
Constant Summary collapse
- VALID_PARAMETERS =
{ name: [:part, :type, :primarycontact], email: [:preferredcontact], phone: [:type, :time, :preferredcontact] }
- VALID_VALUES =
{ name: { part: %w[first middle suffix last full], type: %w[individual business], primarycontact: %w[0 1] }, email: { preferredcontact: %w[0 1], }, phone: { preferredcontact: %w[0 1], type: %w[phone fax cellphone pager], time: %w[morning afternoon evening nopreference day] } }
Instance Method Summary collapse
- #add_email(email, params = {}) ⇒ Object
- #add_phone(phone, params = {}) ⇒ Object
-
#initialize(parent_node, name, params = {}) ⇒ Contact
constructor
A new instance of Contact.
Constructor Details
#initialize(parent_node, name, params = {}) ⇒ Contact
Returns a new instance of Contact.
25 26 27 28 29 30 |
# File 'lib/adf_builder/shared/contact.rb', line 25 def initialize(parent_node, name, params={}) @contact = Ox::Element.new('contact') params.merge!({valid_values: VALID_VALUES, valid_parameters: VALID_PARAMETERS}) AdfBuilder::Builder.update_node(@contact, :name, name, params) parent_node << @contact end |
Instance Method Details
#add_email(email, params = {}) ⇒ Object
37 38 39 40 |
# File 'lib/adf_builder/shared/contact.rb', line 37 def add_email(email, params={}) params.merge!({valid_values: VALID_VALUES, valid_parameters: VALID_PARAMETERS}) AdfBuilder::Builder.update_node(@contact, :email, email, params) end |
#add_phone(phone, params = {}) ⇒ Object
32 33 34 35 |
# File 'lib/adf_builder/shared/contact.rb', line 32 def add_phone(phone, params={}) params.merge!({valid_values: VALID_VALUES, valid_parameters: VALID_PARAMETERS}) AdfBuilder::Builder.update_node(@contact, :phone, phone, params) end |