Class: NetSuite::Records::ItemFulfillmentPackageList

Inherits:
Support::Sublist show all
Includes:
Namespaces::TranSales
Defined in:
lib/netsuite/records/item_fulfillment_package_list.rb

Instance Method Summary collapse

Methods included from Namespaces::TranSales

#record_namespace

Methods inherited from Support::Sublist

#<<, inherited, sublist, #to_record

Methods included from Support::Fields

included

Methods included from Support::Attributes

#attributes, #attributes=, #initialize_from_attributes_hash

Constructor Details

#initialize(attributes = {}) ⇒ ItemFulfillmentPackageList

Returns a new instance of ItemFulfillmentPackageList.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/netsuite/records/item_fulfillment_package_list.rb', line 8

def initialize(attributes = {})
  if attributes.keys != [:package] && attributes.first

    transformed_attrs = {}
    object = attributes.first.last

    case object
    when Hash
      object.each do |k, v|
        transformed_attrs.merge!(k[0..-5].to_sym => v)
      end
    when Array
      object.each do |hash|
        hash.each do |k, v|
          transformed_attrs.merge!(k[0..-5].to_sym => v)
        end
      end
    end

    attributes = { package: transformed_attrs }
  end

  initialize_from_attributes_hash(attributes)
end