Giter VIP home page Giter VIP logo

rack-passbook's Introduction

Rack::Passbook

This project is no longer maintained.

Passbook 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.

Apple provides a specification for a REST-style web service protocol to communicate with Passbook, with endpoints to get the latest version of a pass, register / unregister devices to receive push notifications for a pass, and query for passes registered for a device.

Rack::Passbook provides those specified endpoints.

Requirements

  • Ruby 1.9 or higher
  • PostgreSQL 9.1 or higher

Installation

Gemfile

gem 'rack-passbook', require: 'rack/passbook'

Example Usage

Rack::Passbook can be run as Rack middleware or as a single web application. All that's required is a connection to a Postgres database.

An example application can be found in the /example directory of this repository.

config.ru

require 'bundler'
Bundler.require

run Rack::Passbook

Specification

What follows is a summary of the specification. The complete specification can be found in the Passbook Web Service Reference.

Getting the Latest Version of a Pass

GET https://example.com/v1/passes/:passTypeIdentifier/:serialNumber
  • passTypeIdentifier The pass’s type, as specified in the pass.
  • serialNumber The unique pass identifier, as specified in the pass.

Response

  • If request is authorized, return HTTP status 200 with a payload of the pass data.
  • If the request is not authorized, return HTTP status 401.
  • Otherwise, return the appropriate standard HTTP status.

Getting the Serial Numbers for Passes Associated with a Device

GET https://example.com/v1/devices/:deviceLibraryIdentifier/registrations/:passTypeIdentifier[?passesUpdatedSince=tag]
  • deviceLibraryIdentifier A unique identifier that is used to identify and authenticate the device.
  • passTypeIdentifier The pass’s type, as specified in the pass.
  • serialNumber The unique pass identifier, as specified in the pass.
  • passesUpdatedSince Optional A tag from a previous request.

Response

If the passesUpdatedSince parameter is present, return only the passes that have been updated since the time indicated by tag. Otherwise, return all passes.

  • If there are matching passes, return HTTP status 200 with a JSON dictionary with the following keys and values:
    • lastUpdated (string) The current modification tag.
    • serialNumbers (array of strings) The serial numbers of the matching passes.
  • If there are no matching passes, return HTTP status 204.
  • Otherwise, return the appropriate standard HTTP status.

Registering a Device to Receive Push Notifications for a Pass

POST https://example.com/v1/devices/:deviceLibraryIdentifier/registrations/:passTypeIdentifier/:serialNumber
  • deviceLibraryIdentifier A unique identifier that is used to identify and authenticate the device.
  • passTypeIdentifier The pass’s type, as specified in the pass.
  • serialNumber The unique pass identifier, as specified in the pass.

The POST payload is a JSON dictionary, containing a single key and value:

  • pushToken The push token that the server can use to send push notifications to this device.

Response

  • If the serial number is already registered for this device, return HTTP status 200.
  • If registration succeeds, return HTTP status 201.
  • If the request is not authorized, return HTTP status 401.
  • Otherwise, return the appropriate standard HTTP status.

Unregistering a Device

DELETE https://example.com/v1/devices/:deviceLibraryIdentifier/registrations/:passTypeIdentifier/:serialNumber
  • deviceLibraryIdentifier A unique identifier that is used to identify and authenticate the device.
  • passTypeIdentifier The pass’s type, as specified in the pass.
  • serialNumber The unique pass identifier, as specified in the pass.

Response

  • If disassociation succeeds, return HTTP status 200.
  • If the request is not authorized, return HTTP status 401.
  • Otherwise, return the appropriate standard HTTP status.

Contact

Mattt

License

Rack::Passbook is available under the MIT license. See the LICENSE file for more info.

rack-passbook's People

Contributors

mattt avatar cbx avatar

Stargazers

 avatar Derick Warshaw avatar Zach Holman avatar Bhasker Surnida avatar Paulo Rui Pires Gonçalves avatar Omachonu Ogali avatar brian tiger chow avatar Tomohiro Taira avatar Naoki Fujii avatar Angus H. avatar Shenouda Bertel avatar Lin Chia Hua avatar Fagner Moura avatar Robb Fitzsimmons avatar Nick Toumpelis avatar Isi Robayna avatar midnightSuyama avatar Bilawal Hameed avatar J-P Teti avatar Chad Boyd avatar fannar avatar Almog Melamed avatar  avatar Ludovic Landry avatar Dmitry Tsepelev avatar Chris Hale avatar David Barry avatar Madson Mac avatar Alberto Jerez avatar Eli Perkins avatar Oliver Clark Rickard avatar Phillip Reichelt avatar Mohammad Hanif avatar  avatar Josep avatar Roman Efimov avatar Ivan Kotelnikov avatar Elliot avatar uraimo avatar Markus Heurung avatar David Condrau avatar Karsten avatar Yosi Taguri avatar Ricki Y. HAN avatar Imran Ansari avatar Steve Agalloco avatar  avatar Blake Watters avatar Adam Burmister avatar Graham Siener avatar Riccardo Cambiassi avatar Colin Schlueter avatar d11n avatar

Watchers

Renzo G. Pretto avatar mayulu avatar James Cloos avatar  avatar

rack-passbook's Issues

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.