A Ruby interface for the Pass2u API, allowing the management of digital passes.
Add this line to your application's Gemfile:
gem 'pass2u-ruby'
Then run:
bundle
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
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"
}