class Afterbuy::Representer::ShopInterfaceRequestRepresenter

Public Instance Methods

to_hash() click to toggle source
Calls superclass method
# File lib/afterbuy/representer/shop_interface_request_representer.rb, line 81
def to_hash
  super.tap do |hash|
    if hash.has_key? 'line_items'
      hash['PosAnz'] = hash['line_items'].count

      hash.delete('line_items').each.with_index do |line_item, index|
        line_item.map do |k, v|
          hash["#{k}_#{index+1}"] = v
        end
      end
    end
  end
end