Sha256: ff70c8890ac00e600bc4b6fbb7b2c646bedb04b17382bdd0dfa69e1f17e012fc

Contents?: true

Size: 858 Bytes

Versions: 15

Compression:

Stored size: 858 Bytes

Contents

module NetSuite
  module Records
    class CustomerAddressbookList
      include Namespaces::ListRel

      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

      def addressbooks
        @addressbooks ||= []
      end

      def replace_all
        @replace_all
      end

      def replace_all= new_replace_all
        @replace_all = !!new_replace_all
      end

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

    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
netsuite-0.5.0 lib/netsuite/records/customer_addressbook_list.rb
netsuite-0.4.9 lib/netsuite/records/customer_addressbook_list.rb
netsuite-0.4.8 lib/netsuite/records/customer_addressbook_list.rb
netsuite-0.4.7 lib/netsuite/records/customer_addressbook_list.rb
netsuite-0.4.6 lib/netsuite/records/customer_addressbook_list.rb
netsuite-0.4.5 lib/netsuite/records/customer_addressbook_list.rb
netsuite-0.4.4 lib/netsuite/records/customer_addressbook_list.rb
netsuite-0.4.3 lib/netsuite/records/customer_addressbook_list.rb
netsuite-0.4.2 lib/netsuite/records/customer_addressbook_list.rb
netsuite-0.4.1 lib/netsuite/records/customer_addressbook_list.rb
netsuite-0.4.0 lib/netsuite/records/customer_addressbook_list.rb
netsuite-0.3.3 lib/netsuite/records/customer_addressbook_list.rb
netsuite-0.3.2 lib/netsuite/records/customer_addressbook_list.rb
netsuite-0.3.1 lib/netsuite/records/customer_addressbook_list.rb
netsuite-0.3.0 lib/netsuite/records/customer_addressbook_list.rb