Module: IntacctRuby::ContactsHelper
- Included in:
- Functions::CustomerBaseFunction, Functions::EmployeeBaseFunction, Functions::UpdateCustomer
- Defined in:
- lib/intacct_ruby/helpers/contacts_helper.rb
Overview
methods to avoid duplication when creating and updating contact records
Instance Method Summary collapse
- #contact_params(attributes, id, person_type) ⇒ Object
- #contactname(name, id, person_type) ⇒ Object
- #full_name(attrs = {}) ⇒ Object
Instance Method Details
#contact_params(attributes, id, person_type) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/intacct_ruby/helpers/contacts_helper.rb', line 4 def contact_params(attributes, id, person_type) xml = Builder::XmlMarkup.new name = full_name(attributes) xml.contact do xml.contactname contactname(name, id, person_type) xml.printas full_name(attributes) xml.firstname attributes[:first_name] xml.lastname attributes[:last_name] xml.email1 attributes[:email1] end xml.target! end |
#contactname(name, id, person_type) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/intacct_ruby/helpers/contacts_helper.rb', line 20 def contactname(name, id, person_type) # a unique identifier for a contact, to be used for Intacct's # contactname field. Person Type required to ensure that there aren't # duplicates (e.g. a customer and employee w/ ID 1 both named # 'John Smith') "#{name} (#{person_type} \##{id})" end |
#full_name(attrs = {}) ⇒ Object
28 29 30 |
# File 'lib/intacct_ruby/helpers/contacts_helper.rb', line 28 def full_name(attrs = {}) "#{attrs[:first_name]} #{attrs[:last_name]}" end |