Sha256: 6b8eb3650d10778d0d4587fffc4b1567f9e14f42137ee289935fb244c2147a4e
Contents?: true
Size: 1.87 KB
Versions: 6
Compression:
Stored size: 1.87 KB
Contents
module NetSuite module Records class MatrixOptionList # Deals with both hash and arrays of attributes[:matrix_option_list] # # Hash: # # <listAcct:matrixOptionList> # <listAcct:matrixOption internalId="47" scriptId="custitem15"> # <platformCore:value internalId="2" typeId="36"/> # </listAcct:matrixOption> # </listAcct:matrixOptionList> # # Array: # # <listAcct:matrixOptionList> # <listAcct:matrixOption internalId="45" scriptId="custitem13"> # <platformCore:value internalId="4" typeId="28"> # <platformCore:name>foo</platformCore:name> # </platformCore:value> # </listAcct:matrixOption> # <listAcct:matrixOption internalId="46" scriptId="custitem14"> # <platformCore:value internalId="1" typeId="29"> # <platformCore:name>bar</platformCore:name> # </platformCore:value> # </listAcct:matrixOption> # </listAcct:matrixOptionList> # def initialize(attributes = {}) case attributes[:matrix_option] when Hash options << OpenStruct.new( type_id: attributes[:matrix_option][:value][:'@type_id'], value_id: attributes[:matrix_option][:value][:'@internal_id'], script_id: attributes[:matrix_option][:@script_id], name: attributes[:matrix_option][:value][:name] ) when Array attributes[:matrix_option].each do |option| options << OpenStruct.new( type_id: option[:value][:'@type_id'], value_id: option[:value][:'@internal_id'], script_id: option[:@script_id], name: option[:value][:name] ) end end end def options @options ||= [] end end end end
Version data entries
6 entries across 6 versions & 1 rubygems