Sha256: 578c935afb6fdf4d47a9ed21f6f181c2b50152e4e4f55b3d9a760e294e410c84

Contents?: true

Size: 775 Bytes

Versions: 1

Compression:

Stored size: 775 Bytes

Contents

# From the gem root repository, run:
# $ ruby example/sinatra_tracker.rb

require 'sinatra'
$: << "lib"
require "colissimo"

get '/' do
  tracking_code = params[:tracking_code]
  output = "<form method='get'><input name='tracking_code' placeholder='Colissimo Tracking Code' value='#{tracking_code}' /></form>"

  if tracking_code
    tracking_rows = Colissimo::Tracker.new(tracking_code).tracking_rows

    output += "<table>"
    tracking_rows.each do |row|
      output += "  <tr>"
      output += "    <td><img src='#{row.date_base64_png}' /></td>"
      output += "    <td><img src='#{row.label_base64_png}' /></td>"
      output += "    <td><img src='#{row.localization_base64_png}' /></td>"
      output += "  </tr>"
    end
    output += "</table>"
  end

  output
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
colissimo-0.1.0 example/sinatra_tracker.rb