Class: NetSuite::Records::CustomerAddressbookList

Inherits:
Object
  • Object
show all
Includes:
Namespaces::ListRel
Defined in:
lib/netsuite/records/customer_addressbook_list.rb

Instance Method Summary collapse

Methods included from Namespaces::ListRel

#record_namespace

Constructor Details

#initialize(attributes = {}) ⇒ CustomerAddressbookList

Returns a new instance of CustomerAddressbookList.



6
7
8
9
10
11
12
13
14
15
# File 'lib/netsuite/records/customer_addressbook_list.rb', line 6

def initialize(attributes = {})
  case attributes[:addressbook]
  when Hash
    addressbooks << CustomerAddressbook.new(attributes[:addressbook])
  when Array
    attributes[:addressbook].each { |addressbook| addressbooks << CustomerAddressbook.new(addressbook) }
  end

  @replace_all = true
end

Instance Method Details

#addressbooksObject



17
18
19
# File 'lib/netsuite/records/customer_addressbook_list.rb', line 17

def addressbooks
  @addressbooks ||= []
end

#replace_allObject



21
22
23
# File 'lib/netsuite/records/customer_addressbook_list.rb', line 21

def replace_all
  @replace_all
end

#replace_all=(new_replace_all) ⇒ Object



25
26
27
# File 'lib/netsuite/records/customer_addressbook_list.rb', line 25

def replace_all= new_replace_all
  @replace_all = !!new_replace_all
end

#to_recordObject



29
30
31
32
33
# File 'lib/netsuite/records/customer_addressbook_list.rb', line 29

def to_record
  { "#{record_namespace}:addressbook" => addressbooks.map(&:to_record),
    "#{record_namespace}:replaceAll" => @replace_all
  }
end