Class: NetSuite::Records::RecordRefList

Inherits:
Object
  • Object
show all
Includes:
Namespaces::PlatformCore, Support::Fields, Support::Records
Defined in:
lib/netsuite/records/record_ref_list.rb

Instance Method Summary collapse

Methods included from Namespaces::PlatformCore

#record_namespace

Methods included from Support::Records

#record_type, #refresh, #to_attributes!

Methods included from Support::Attributes

#attributes, #attributes=, #initialize_from_attributes_hash

Methods included from Support::Fields

included

Constructor Details

#initialize(attrs = {}) ⇒ RecordRefList

Returns a new instance of RecordRefList.



10
11
12
# File 'lib/netsuite/records/record_ref_list.rb', line 10

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

Instance Method Details

#record_refObject



23
24
25
# File 'lib/netsuite/records/record_ref_list.rb', line 23

def record_ref
  @record_ref ||= []
end

#record_ref=(items) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/netsuite/records/record_ref_list.rb', line 14

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

#to_recordObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/netsuite/records/record_ref_list.rb', line 27

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