Class: NetSuite::Records::ItemFulfillmentPackageList
Instance Method Summary
collapse
#record_namespace
#record_type, #to_attributes!
#record_namespace
#attributes, #attributes=, #initialize_from_attributes_hash
included
Constructor Details
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
|