class Pohoda::Builders::Idp::SetPricesType

Public Instance Methods

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

  if data.key? :stocks
    element = Ox::Element.new('idp:stocks')
    data[:stocks].each { |i| element << Idp::StockItemType.new('idp:stockItem', i).builder }
    root << element
  end
  if data.key? :price_groups
    element = Ox::Element.new('idp:priceGroups')
    data[:price_groups].each { |i| element << Idp::PriceGroupItemType.new('idp:priceGroupItem', i).builder }
    root << element
  end

  root
end