class Pohoda::Builders::Grs::GroupStocksType

Public Instance Methods

builder() click to toggle source
# File lib/pohoda/builders/grs/group_stocks_type.rb, line 7
def builder
  root = Ox::Element.new(name)
  root = add_attributes_and_namespaces(root)

  root << build_element('grs:actionType', data[:action_type], data[:action_type_attributes]) if data.key? :action_type
  if data.key? :group_stocks_header
    root << Grs::GroupStocksHeaderType.new('grs:groupStocksHeader', data[:group_stocks_header]).builder
  end
  if data.key? :group_stocks_detail
    element = Ox::Element.new('grs:groupStocksDetail')
    data[:group_stocks_detail].each { |i| element << Gr::VariantsItemType.new('grs:variant', i).builder }
    root << element
  end

  root
end