Skip to content
This repository has been archived by the owner on Jun 20, 2021. It is now read-only.
/ dubai Public archive

Generate and Preview Passbook Passes

License

Notifications You must be signed in to change notification settings

nomad-cli/dubai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

69d79a5 · Jun 20, 2021

History

58 Commits
Feb 20, 2013
Jul 12, 2019
Jul 12, 2019
Nov 16, 2013
Jul 12, 2019
Mar 6, 2015
Jun 20, 2021
Jul 12, 2019
Jul 12, 2019

Repository files navigation

Dubai

Note: This project is no longer being maintained.

Passbook is an iOS 6 feature that manages boarding passes, movie tickets, retail coupons, & loyalty cards. Using the PassKit API, developers can register web services to automatically update content on the pass, such as gate changes on a boarding pass, or adding credit to a loyalty card.

Dubai makes it easy to generate .pkpass from a script or the command line, allowing you to rapidly iterate on the design and content of your passes, or generate one-offs on the fly.

Dubai is named for Dubai, UAE, a center of commerce and trade (and as Dave Rupert was all-too-eager to point out, an unfortunate pun on "Do Buy!").

Installation

$ gem install dubai

Usage

require 'dubai'

Dubai::Passbook.certificate, Dubai::Passbook.password = "/path/to/certificate.p12", "..."

# Example.pass is a directory with files "pass.json", "icon.png" & "[email protected]"
File.open("Example.pkpass", 'w') do |f|
  f.write Dubai::Passbook::Pass.new("Example.pass").pkpass.string
end

Command Line Interface

Dubai also comes with the pk binary, which provides a convenient way to generate and preview passes

$ pk generate Example.pass -T boarding-pass

Dubai comes with templates for all of the different Passbook layouts:

  • boarding-pass
  • coupon
  • event-ticket
  • store-card
  • generic

Build a .pkpass file (which can previewed with a drag-and-drop onto the iOS Simulator):

$ pk build Example.pass -c /path/to/certificate.p12

...or serve them from a webserver (which can be previewed by visiting the address on a device or the simulator):

$ pk serve Example.pass -c /path/to/certificate.p12
$ open http://localhost:4567/pass.pkpass

Specify a -H / --host option to bind the server to a particular host. Binding on 0.0.0.0 will listen for all incoming connections on the local network, such as an iPhone or iPad:

$ pk serve Example.pass -H 0.0.0.0

License

Dubai is available under the MIT license. See the LICENSE file for more info.