Class: NetSuite::Records::ItemFulfillmentPackageList
- Inherits:
-
Object
- Object
- NetSuite::Records::ItemFulfillmentPackageList
- Includes:
- Namespaces::TranSales, Support::Fields, Support::Records
- Defined in:
- lib/netsuite/records/item_fulfillment_package_list.rb
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ ItemFulfillmentPackageList
constructor
A new instance of ItemFulfillmentPackageList.
- #package=(packages) ⇒ Object
- #packages ⇒ Object
- #to_record ⇒ Object
Methods included from Namespaces::TranSales
Methods included from Support::Records
#record_type, #refresh, #to_attributes!
Methods included from Namespaces::PlatformCore
Methods included from Support::Attributes
#attributes, #attributes=, #initialize_from_attributes_hash
Methods included from Support::Fields
Constructor Details
#initialize(attributes = {}) ⇒ ItemFulfillmentPackageList
Returns a new instance of ItemFulfillmentPackageList.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/netsuite/records/item_fulfillment_package_list.rb', line 10 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 |
Instance Method Details
#package=(packages) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/netsuite/records/item_fulfillment_package_list.rb', line 35 def package=(packages) case packages when Hash self.packages << ItemFulfillmentPackage.new(packages) when Array packages.each { |package| self.packages << ItemFulfillmentPackage.new(package) } end end |
#packages ⇒ Object
44 45 46 |
# File 'lib/netsuite/records/item_fulfillment_package_list.rb', line 44 def packages @packages ||= [] end |
#to_record ⇒ Object
48 49 50 |
# File 'lib/netsuite/records/item_fulfillment_package_list.rb', line 48 def to_record { "#{record_namespace}:package" => packages.map(&:to_record) } end |