Sha256: 7c7a32ee1fa497077d81dd0f1e488c51086d87f79cfc92585b30d39d31531f33

Contents?: true

Size: 1.58 KB

Versions: 38

Compression:

Stored size: 1.58 KB

Contents

module NetSuite
  module Records
    class Address
      include Support::Fields
      include Support::Records
      include Namespaces::PlatformCommon

      # internalId is a bit strange on this record
      # https://github.com/NetSweet/netsuite/wiki/Miscellaneous-Web-Services-Quirks#customer

      fields :addr1, :addr2, :addr3, :addressee, :addr_phone, :attention, :city, :internal_id, :override, :state, :zip

      field :country, NetSuite::Support::Country
      field :custom_field_list, CustomFieldList

      read_only_fields :addr_text

      def initialize(attributes_or_record = {})
        case attributes_or_record
        when self.class
          initialize_from_record(attributes_or_record)
        when Hash
          attributes_or_record = attributes_or_record[:address] if attributes_or_record[:address]
          initialize_from_attributes_hash(attributes_or_record)
        end
      end

      def initialize_from_record(obj)
        self.addr1                = obj.addr1
        self.addr2                = obj.addr2
        self.addressee            = obj.addressee
        self.addr_phone           = obj.addr_phone
        self.addr_text            = obj.addr_text
        self.attention            = obj.attention
        self.city                 = obj.city
        self.country              = obj.country
        self.custom_field_list    = obj.custom_field_list
        self.internal_id          = obj.internal_id
        self.override             = obj.override
        self.state                = obj.state
        self.zip                  = obj.zip
      end

    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
netsuite-0.9.3 lib/netsuite/records/address.rb
netsuite-0.9.2 lib/netsuite/records/address.rb
netsuite-0.9.1 lib/netsuite/records/address.rb
netsuite-0.9.0 lib/netsuite/records/address.rb
netsuite-0.8.12 lib/netsuite/records/address.rb
netsuite-0.8.11 lib/netsuite/records/address.rb
netsuite-0.8.10 lib/netsuite/records/address.rb
netsuite-0.8.9 lib/netsuite/records/address.rb
netsuite-0.8.8 lib/netsuite/records/address.rb
netsuite-0.8.7 lib/netsuite/records/address.rb
netsuite-0.8.6 lib/netsuite/records/address.rb
netsuite-0.8.5 lib/netsuite/records/address.rb
netsuite-0.8.4 lib/netsuite/records/address.rb
netsuite-0.8.3 lib/netsuite/records/address.rb
netsuite-0.8.2 lib/netsuite/records/address.rb
netsuite-0.8.1 lib/netsuite/records/address.rb
netsuite-0.8.0 lib/netsuite/records/address.rb
netsuite-0.7.9 lib/netsuite/records/address.rb
netsuite-0.7.8 lib/netsuite/records/address.rb
netsuite-0.7.7 lib/netsuite/records/address.rb