Generate and Preview Passbook Passes

Related tags

Utility dubai
Overview

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.

Comments
  • Allow to use Sinatra version 2.0.0

    Allow to use Sinatra version 2.0.0

    Привет! 😸

    I wonder if we can allow using Sinatra 2.x. I'd like to use the gem with Rails 5.x, which requires Rack 2.x. Since only the latest Sinatra versions support Rack 2.x, I can't use Dubai in the same project.

    Thanks!

    opened by exAspArk 5
  • Fixing 'serve' command summary

    Fixing 'serve' command summary

    running $ pk -h gives the following output:

    ...
    Commands:
        build    Creates a .pkpass archive
        generate Generates a template pass directory
        help     Display global or [command] help documentation
        serve    Creates a .pkpass archive
    ...
    

    the build and serve help is the same so I changed it to match the behaviour stated in the README.

    opened by ghecho 2
  • adding zip as a dependency

    adding zip as a dependency

    The first time I tried to run the pk binary, I encountered this error:

    ➜ pk generate sample.pass -T coupon
    /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/runner.rb:365:in `block in require_program': program version required (Commander::Runner::CommandError)
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/runner.rb:364:in `each'
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/runner.rb:364:in `require_program'
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/runner.rb:52:in `run!'
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/delegates.rb:7:in `run!'
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/commander-4.1.5/lib/commander/import.rb:10:in `block in <top (required)>'
    /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- zip (LoadError)
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/dubai-0.0.5/lib/dubai/pass.rb:5:in `<top (required)>'
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/dubai-0.0.5/lib/dubai.rb:1:in `<top (required)>'
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:58:in `require'
        from /opt/boxen/rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/dubai-0.0.5/bin/pk:7:in `<top (required)>'
        from /opt/boxen/rbenv/versions/2.0.0-p247/bin/pk:23:in `load'
        from /opt/boxen/rbenv/versions/2.0.0-p247/bin/pk:23:in `<main>'
    

    I then ran gem install zip:

    ➜ gem install zip
    Fetching: zip-2.0.2.gem (100%)
    Successfully installed zip-2.0.2
    1 gem installed
    

    Then attempted to use the pk binary again:

    ➜ pk generate quikly2.pass -T coupon
    Pass generated in quikly2.pass
    

    Success! I see rubyzip listed in in the dubai.gemspec but for not 'zip', which is required inside of lib/dubai/pass.rb.

    This pull request adds zip as a dependency.

    opened by stereoscott 2
  • In memory solution?

    In memory solution?

    Coming from the Rails world, seems like a lot of housekeeping to be done if directories have to be created, seeded, zipped and cleaned up in request response cycle.

    Do you think it is worthwhile having an in-memory solution? Would that be something you would consider for this gem or should we look elsewhere?

    Thanks for the guidance.

    opened by asanghi 2
  • Bundler fails unless sinatra is already installed.

    Bundler fails unless sinatra is already installed.

    The dubai.gemspec file requires dubai.rb, and this breaks unless all dependencies are already installed. E.g. a bundle install in a vanilla install breaks with

    There was a LoadError while evaluating dubai.gemspec:
    cannot load such file -- sinatra/base from
    blah blah ..../bundler/gems/dubai-918236eaa64b/dubai.gemspec:3:in `<main>'
    

    Gemspec only needs version, so split it into a separate file and include that only.

    Also bumped the version, 0.0.1 -> 0.0.2; not sure if that's okay.

    opened by jwoffindin 2
  • Command help for serve is the same as build

    Command help for serve is the same as build

    I just sent a PR(#14) for this, so I'm not sure if it's ok to put it also here or just a duplicate.

    The title is pretty much self-explanatory, this is just a typo-like fix to make the command help a bit better.

    opened by ghecho 1
  • Set Sinatra server default listen address to 0.0.0.0

    Set Sinatra server default listen address to 0.0.0.0

    This fix makes the Sinatra server ran by the pk serve command accessible from computers on the same local network. Pretty useful if you want to preview your pkpass on mobile devices.

    opened by loris 1
  • Typo in README

    Typo in README

    I noticed a pretty glaring typo in a code block in your README file. In the line shown below, you missed the closing quotation mark after certificate.p12. I noticed this because the syntax highlighting after that is messed up. I fixed the typo in the code snippet below.

    Dubai::Passbook.certificate, Dubai::Passbook.password = "/path/to/certificate.p12", "..."
    
    opened by wjk 1
  • Change rubyzip require.

    Change rubyzip require.

    As indicated here: rubyzip/rubyzip/issues/90

    As of rubyzip 1.0.0 the require has changed from require zip/zip to just plain ol' require zip. The other way around this little issue is to add this to your Gemfile.

    gem "rubyzip", "~> 0.9.9"

    Which will require to last version of rubyzip.

    opened by willrax 1
Owner
Nomad CLI
Command Line Utilities For iOS Development. This project is no longer maintained.
Nomad CLI
Verify New Zealand COVID Passes in iOS apps using Swift

NzCovidPass-Swift Swift library for verification of the NZ Covid Vaccination Pas

Gallagher Security 4 Jul 19, 2022
Preview extractor for news, articles and full-texts in Swift

ReadabilityKit Preview extractor for news, articles and full-texts in Swift We are a development agency building phenomenal apps. Features Extracts: T

Exyte 790 Dec 9, 2022
It makes a preview from an URL, grabbing all the information such as title, relevant texts and images.

Link Previewer for iOS, macOS, watchOS and tvOS It makes a preview from an URL, grabbing all the information such as title, relevant texts and images.

Leonardo Cardoso 1.3k Jan 2, 2023
DGPreview - Make UIKit project enable preview feature of SwiftUI

DGPreview Make UIKit project enable preview feature of SwiftUI Requirements iOS

donggyu 5 Feb 14, 2022
Generate Markdown documentation from source code

SourceDocs SourceDocs is a command line tool that generates markdown documentation files from inline source code comments. Similar to Sphinx or Jazzy,

Eneko Alonso 349 Dec 10, 2022
Generate a privacy policy for your iOS app

PrivacyFlash Pro To easily run PrivacyFlash Pro get the latest packaged release. Learn more about PrivacyFlash Pro in our research paper. PrivacyFlash

privacy-tech-lab 141 Dec 22, 2022
A utility to generate PreviewDevice presets from the available devices

SwiftUIGen A utility to generate PreviewDevice presets from the available devices Installation Manual Go to the GitHub page for the latest release Dow

Timberlane Labs 29 Nov 14, 2022
Generate protobuf message definitions from Swift structs

SwiftProtobufGen Generates protobuf definitions from Swift structs Building For some reason Xcode builds don't work at all but swiftpm command line bu

null 3 Nov 1, 2021
An extension for Xcode to generate builders from structs

Swift Struct Builder Generator Xcode Source Editor Extension An Xcode extension (plugin) to generate struct builders automatically. Install Swift Stru

Marius Wichtner 1 Nov 24, 2021
An eject button for Interface Builder to generate swift code

Eject Eject is a utility to transition from Interface Builder to programatic view layout. This is done by using code generation to create a .swift fil

Rightpoint 524 Dec 29, 2022
Minecraft-silicon - Generate Apple Silicon-native versions of Minecraft

Minecraft Silicon A dead simple utility to generate Apple Silicon-native Minecra

Cole Feuer 4 Jun 21, 2022
Swift Xid - Xid uses MongoDB Object ID algorighm1 to generate globally unique ids with base32 serialzation to produce shorter strings

Swift Xid - Xid uses MongoDB Object ID algorighm1 to generate globally unique ids with base32 serialzation to produce shorter strings

Uditha Atukorala 0 Jun 13, 2022
Zip - A Swift framework for zipping and unzipping files. Simple and quick to use. Built on top of minizip.

Zip A Swift framework for zipping and unzipping files. Simple and quick to use. Built on top of minizip. Usage Import Zip at the top of the Swift file

Roy Marmelstein 2.3k Jan 3, 2023
Useful Swift code samples, extensions, functionalities and scripts to cherry-pick and use in your projects

SwiftyPick ?? ?? Useful Swift code samples, extensions, functionalities and scripts to cherry-pick and use in your projects. Purpose The idea behind t

Manu Herrera 19 May 12, 2022
Validate iOS, Android, and Mac localizations. Find errors in .strings, .stringsdict, and strings.xml files.

Locheck An Xcode and Android localization file validator. Make sure your .strings, .stringsdict, and strings.xml files do not have any errors! What do

Asana 73 Dec 13, 2022
Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer documentation.

Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer docum

Apple 833 Jan 3, 2023
Customize and resize sheets in SwiftUI with SheeKit. Utilise the power of `UISheetPresentationController` and other UIKit features.

SheeKit Customize and resize sheets in SwiftUI with SheeKit. Utilise the power of UISheetPresentationController and other UIKit features. Overview She

Eugene Dudnyk 67 Dec 31, 2022
A handy collection of Swift method and Tools to build project faster and more efficient.

SwifterKnife is a collection of Swift extension method and some tools that often use in develop project, with them you might build project faster and

李阳 4 Dec 29, 2022