Skip to content

A Ruby interface for the Pass2U API, allowing the management of digital passes.

License

Notifications You must be signed in to change notification settings

heychimpy/pass2u-ruby

Repository files navigation

pass2u-ruby

Github Chimpy

Continuous Integration codecov License: MIT Ruby Style Guide Reek Badge Brakeman Badge

A Ruby interface for the Pass2u API, allowing the management of digital passes.

Installation

Add this line to your application's Gemfile:

gem 'pass2u-ruby'

Then run:

bundle

Usage

Configuration

Before using the gem, configure it with your API key and the base uri:

Pass2u.configure do |config|
  # The API key provided by Pass2u
  config.api_key = 'your_pass2u_api_key_here'
  # The base URI for all API calls
  config.base_uri = 'https://api.pass2u.net/v2'  # default value
end

Basic usage

Creating a Client

client = Pass2u::Client.new

Creating a Pass

Use the create_pass method to create a new pass. You need to provide the model ID and barcode ID, along with any optional parameters.

Refer to the Pass2u docs for a complete list of optional parameters.

model_id = 'your_model_id_here'
barcode_id = 'your_barcode_id_here'
options = { 'option_key' => 'option_value' } 

response = client.create_pass(model_id, barcode_id, options)

# optional parameters override parameters specified in the model

Response example

{
  "barcodeMessage":"1234567890",
  "modelId":1919,
  "passId":"VT-2I77F5ADz",
  "createdTime":"2018-01-25T16:19:36+08:00",
  "expirationDate":"2018-12-31T23:00:15+08:00"
}

About

A Ruby interface for the Pass2U API, allowing the management of digital passes.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages