Sha256: e6c41cf9e34d07368d268dc807b86b6f9647d8d23e6058fc543ea934795665e6

Contents?: true

Size: 1.27 KB

Versions: 17

Compression:

Stored size: 1.27 KB

Contents

module NetSuite
  module Records
    class CustomRecordRef
      include Support::Fields
      include Support::Records
      include Namespaces::PlatformCore

      attr_reader   :internal_id
      attr_accessor :external_id, :type_id

      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_id     = attributes.delete(:type_id) || attributes.delete(:@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.respond_to?(:type_id) && record.class.type_id
        end
      end

      def method_missing(m, *args, &block)
        if attributes.keys.map(&:to_sym).include?(m.to_sym)
          attributes[m.to_sym]
        else
          super
        end
      end

    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
netsuite-0.0.35 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.34 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.33 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.32 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.31 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.30 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.29 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.28 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.27 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.26 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.25 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.23 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.22 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.21 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.20 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.19 lib/netsuite/records/custom_record_ref.rb
netsuite-0.0.18 lib/netsuite/records/custom_record_ref.rb