Sha256: 216bbbd5eb6024d5df0313eafbc9f4001336777f1559b48add57bfba560d9773

Contents?: true

Size: 813 Bytes

Versions: 14

Compression:

Stored size: 813 Bytes

Contents

module NetSuite
  module Records
    class CustomFieldList
      include Namespaces::PlatformCore

      def initialize(attributes = {})
        case attributes[:custom_field]
        when Hash
          custom_fields << CustomField.new(attributes[:custom_field])
        when Array
          attributes[:custom_field].each { |custom_field| custom_fields << CustomField.new(custom_field) }
        end
      end

      def custom_fields
        @custom_fields ||= []
      end

      def to_record
        custom_fields.map { |custom_field|
          Gyoku.xml({
            "#{record_namespace}:customField" => custom_field.to_record,
            :attributes! => {
              "#{record_namespace}:customField" => custom_field.attributes!
            }
          })
        }.join
      end

    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
netsuite-0.0.47 lib/netsuite/records/custom_field_list.rb
netsuite-0.0.45 lib/netsuite/records/custom_field_list.rb
netsuite-0.0.44 lib/netsuite/records/custom_field_list.rb
netsuite-0.0.43 lib/netsuite/records/custom_field_list.rb
netsuite-0.0.42 lib/netsuite/records/custom_field_list.rb
netsuite-0.0.41 lib/netsuite/records/custom_field_list.rb
netsuite-0.0.40 lib/netsuite/records/custom_field_list.rb
netsuite-0.0.39 lib/netsuite/records/custom_field_list.rb
netsuite-0.0.38 lib/netsuite/records/custom_field_list.rb
netsuite-0.0.37 lib/netsuite/records/custom_field_list.rb
netsuite-0.0.36 lib/netsuite/records/custom_field_list.rb
netsuite-0.0.35 lib/netsuite/records/custom_field_list.rb
netsuite-0.0.34 lib/netsuite/records/custom_field_list.rb
netsuite-0.0.33 lib/netsuite/records/custom_field_list.rb