class NetSuite::Records::RecordRef

Attributes

external_id[RW]
internal_id[R]
type[R]

Public Class Methods

new(attributes_or_record = {}) click to toggle source
# File lib/netsuite/records/record_ref.rb, line 11
def initialize(attributes_or_record = {})
  case attributes_or_record
  when Hash
    attributes = attributes_or_record
    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        = attributes.delete(:type) || attributes.delete(:@type) || attributes.delete(:"@xsi:type")
    @attributes  = 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        = record.class.to_s.split('::').last.lower_camelcase
  end
end

Public Instance Methods

method_missing(m, *args, &block) click to toggle source
Calls superclass method
# File lib/netsuite/records/record_ref.rb, line 28
def method_missing(m, *args, &block)
  if attributes.keys.map(&:to_sym).include?(m.to_sym)
    attributes[m.to_sym]
  else
    super
  end
end