Publitas Backend Code Challenge

A product feed XML file (click to download).
class ExternalService
  ONE_MEGA_BYTE = 1_048_576.0

  def initialize
    @batch_num = 0
  end

  def call(batch)
    @batch_num += 1
    pretty_print(batch)
  end

  private

  def pretty_print(batch)
    products = JSON.parse(batch)
    puts format("\e[1mReceived batch%4d\e[22m", @batch_num)
    puts format('Size: %10.2fMB', (batch.bytesize / ONE_MEGA_BYTE))
    puts format('Products: %8d', products.size)
    puts "\n"
  end
end
An imaginary external service (copy and paste).

The Task

Write a program that

A batch should

Deliverables

Please provide a GitHub repo with your code containing a README on how to build and run your assignment. The preferred way would be something like:

bundle install
ruby assignment.rb

The code should be written in ruby (compatible with version 2.x)

Extra Info