class NetSuite::Records::CustomRecordRef

Attributes

external_id[RW]
internal_id[R]
type_id[RW]

Public Class Methods

new(attributes_or_record = {}) click to toggle source
# File lib/netsuite/records/custom_record_ref.rb, line 13
def initialize(attributes_or_record = {})
  case attributes_or_record
  when Hash
    attributes = attributes_or_record.clone
    attributes.delete(:"@xmlns:platform_core")
    @internal_id = attributes.delete(:internal_id) || attributes.delete(:@internal_id)
    @external_id = attributes.delete(:external_id) || attributes.delete(:@external_id)
    @type_id     = attributes.delete(:type_id) || attributes.delete(:@type_id)
    @type_id     = @type_id.to_s if @type_id
    initialize_from_attributes_hash(attributes)
  else
    record = attributes_or_record
    @internal_id = record.internal_id if record.respond_to?(:internal_id)
    @external_id = record.external_id if record.respond_to?(:external_id)
    @type_id     = record.class.type_id if record.class.respond_to?(:type_id) && record.class.type_id
    @type_id     = @type_id.to_s if @type_id
  end
end

Public Instance Methods

method_missing(m, *args, &block) click to toggle source
Calls superclass method
# File lib/netsuite/records/custom_record_ref.rb, line 32
def method_missing(m, *args, &block)
  if attributes.keys.map(&:to_sym).include?(m.to_sym)
    attributes[m.to_sym]
  else
    super
  end
end
to_record() click to toggle source
Calls superclass method NetSuite::Support::Records#to_record
# File lib/netsuite/records/custom_record_ref.rb, line 40
def to_record
  rec = super
  rec[:@internalId] = @internal_id if @internal_id
  rec[:@externalId] = @external_id if @external_id
  rec[:@typeId] = @type_id if @type_id
  rec
end