Class: NetSuite::Records::ContactList
- Inherits:
-
Object
- Object
- NetSuite::Records::ContactList
- Includes:
- Namespaces::ActSched
- Defined in:
- lib/netsuite/records/contact_list.rb
Instance Method Summary collapse
- #<<(contact) ⇒ Object
- #contacts ⇒ Object
-
#initialize(attributes = {}) ⇒ ContactList
constructor
A new instance of ContactList.
- #to_record ⇒ Object
Methods included from Namespaces::ActSched
Constructor Details
#initialize(attributes = {}) ⇒ ContactList
Returns a new instance of ContactList.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/netsuite/records/contact_list.rb', line 6 def initialize(attributes = {}) # - the contact list on the NS GUI doesn't show the assigned contact which shows up in the XML # - you can't add an arbitary number of contacts through the NS GUI # TODO the contact list doesn't really work because of the strange XML below (2 assigned companies, one contact) # <actSched:contactList> # <actSched:contact> # <actSched:company xmlns:platformCore="urn:core_2012_1.platform.webservices.netsuite.com" internalId="12345"> # <platformCore:name>10001 Another Customer</platformCore:name> # </actSched:company> # </actSched:contact> # <actSched:contact> # <actSched:company xmlns:platformCore="urn:core_2012_1.platform.webservices.netsuite.com" internalId="12346"> # <platformCore:name>31500 A Customer</platformCore:name> # </actSched:company> # <actSched:contact xmlns:platformCore="urn:core_2012_1.platform.webservices.netsuite.com" internalId="12347"> # <platformCore:name>A Person</platformCore:name> # </actSched:contact> # </actSched:contact> # </actSched:contactList> case attributes[:contact] when Hash contacts << Contact.new(attributes[:contact]) when Array attributes[:contact].each { |contact| contacts << Contact.new(contact) } end end |
Instance Method Details
#<<(contact) ⇒ Object
36 37 38 |
# File 'lib/netsuite/records/contact_list.rb', line 36 def <<(contact) @contacts << contact end |
#contacts ⇒ Object
40 41 42 |
# File 'lib/netsuite/records/contact_list.rb', line 40 def contacts @contacts ||= [] end |
#to_record ⇒ Object
44 45 46 |
# File 'lib/netsuite/records/contact_list.rb', line 44 def to_record { "#{record_namespace}:contact" => contacts.map(&:to_record) } end |