Giter VIP home page Giter VIP logo

passbook's Introduction

Passbook

This is inspired by Passifier which i couldn't get to run with p12 signing. So here is my take on iOS Passbook passes. It's used here: https://chefcards.herokuapp.com

Installation

Add this line to your application's Gemfile:

gem 'power-passbook', github: 'max-power/passbook'

And then execute:

$ bundle

Usage

First setup Signing:

signer = Passbook::Authority.new(File.read("/path/to/certificate.p12"), "secret-password")

The basic usage is:

pass = Passbook::PKPass.new(pass_specifications, pass_assets, signer)
pass.to_file("my/path/to/the/pass.pkpass")
pass.to_s
pass.content_type  # "application/vnd.apple.pkpass"

Pass specifications is a hash that should match the Apple Passbook Format Reference.

pass_specifications = {
  "formatVersion"      => 1,
  "passTypeIdentifier" => "pass.com.flycheap.boardingpass",
  "teamIdentifier"     => "XXXXXXXX",
  "organizationName"   => "XXXXXXXX",
  "labelColor"         => "#ffffff",
  "backgroundColor"    => "#618d04",
  "foregroundColor"    => "#ffffff",
  "serialNumber"       => "123",
  "logoText"           => "Hi",
  ...
}

The assets parameter is a hash with filenames as keys and local or remote paths to the file as value. See the Apple Pass Design and Creation guidelines to see which files are used for the different pass types.

pass_assets = {
  "background.png"    => "assets/background.png",
  "[email protected]" => "assets/[email protected]",
  "icon.png"          => "assets/icon.png",
  "[email protected]"       => "assets/[email protected]",
  "logo.png"          => "http://i.imgur.com/WLUf6.png",
  "[email protected]"       => "http://i.imgur.com/mOpQo.png",
  "thumbnail.png"     => "assets/thumbnail.png",
  "[email protected]"  => "assets/[email protected]"
}

See Also

There is also a very tiny (60 LOC) version available here: https://gist.github.com/max-power/9262053

Contributing

  1. Fork it ( http://github.com/max-power/passbook/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

passbook's People

Contributors

max-power avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

passbook's Issues

uninitialized constant Passbook

I was going through your instructions to set it up, and I got an "uninitialized constant Passbook", on the first line " Passbook::Authority.new(File.read("/path/to/certificate.p12"), "secret-password") ". I generated my certificate and I verified the passTypeIdentifier (from the Developer Portal) and also that teamIdentified that are correct. I added the gem to the Gemfile pointing to the git repo. Am I missing something? @max-power

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.