Sha256: a37a3e0aa8ef43665714223b8f4710f413fc08cae02c9fb38bcc7d2073ad1bff

Contents?: true

Size: 933 Bytes

Versions: 36

Compression:

Stored size: 933 Bytes

Contents

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

      fields :record_ref

      def initialize(attrs = {})
        initialize_from_attributes_hash(attrs)
      end

      def record_ref=(items)
        case items
        when Hash
          self.record_ref << RecordRef.new(items)
        when Array
          items.each { |ref| self.record_ref << RecordRef.new(ref) }
        end
      end

      def record_ref
        @record_ref ||= []
      end

      def to_record
        {
          "#{record_namespace}:recordRef" => record_ref.map do |rr|
            rec = rr.to_record
            rec[:@internalId] = rr.internal_id if rr.internal_id
            rec[:@externalId] = rr.external_id if rr.external_id
            rec[:@type] = rr.type if rr.type
            rec
          end
        }
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
netsuite-0.7.1 lib/netsuite/records/record_ref_list.rb
netsuite-0.7.0 lib/netsuite/records/record_ref_list.rb
netsuite-0.6.9 lib/netsuite/records/record_ref_list.rb
netsuite-0.6.8 lib/netsuite/records/record_ref_list.rb
netsuite-0.6.7 lib/netsuite/records/record_ref_list.rb
netsuite-0.6.6 lib/netsuite/records/record_ref_list.rb
netsuite-0.6.5 lib/netsuite/records/record_ref_list.rb
netsuite-0.6.4 lib/netsuite/records/record_ref_list.rb
netsuite-0.6.3 lib/netsuite/records/record_ref_list.rb
netsuite-0.6.2 lib/netsuite/records/record_ref_list.rb
netsuite-0.6.1 lib/netsuite/records/record_ref_list.rb
netsuite-0.6.0 lib/netsuite/records/record_ref_list.rb
netsuite-0.5.9 lib/netsuite/records/record_ref_list.rb
netsuite-0.5.8 lib/netsuite/records/record_ref_list.rb
netsuite-0.5.7 lib/netsuite/records/record_ref_list.rb
netsuite-0.5.6 lib/netsuite/records/record_ref_list.rb
netsuite-0.5.5 lib/netsuite/records/record_ref_list.rb
netsuite-0.5.4 lib/netsuite/records/record_ref_list.rb
netsuite-0.5.3 lib/netsuite/records/record_ref_list.rb
netsuite-0.5.2 lib/netsuite/records/record_ref_list.rb