Sha256: 54222851831fc050b84fc7cba1c12ac6abb411f3399c39b6d3f5774c33c34a97

Contents?: true

Size: 883 Bytes

Versions: 25

Compression:

Stored size: 883 Bytes

Contents

module NetSuite
  module Records
    class ItemFulfillmentPackageList < Support::Sublist
      include Namespaces::TranSales

      sublist :package, ItemFulfillmentPackage

      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

      alias :packages :package

    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
netsuite-0.9.3 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.9.2 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.9.1 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.9.0 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.8.12 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.8.11 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.8.10 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.8.9 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.8.8 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.8.7 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.8.6 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.8.5 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.8.4 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.8.3 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.8.2 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.8.1 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.8.0 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.7.9 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.7.8 lib/netsuite/records/item_fulfillment_package_list.rb
netsuite-0.7.7 lib/netsuite/records/item_fulfillment_package_list.rb