Ballparc

This gem is for implementing the ballparc API for managing vehicle in ballparc Parking Management System. We used the ballparc API in this gem to create, update and deactivate vehicles also we can view violation using this gem. For now this gem can only create, deactivate and can view violation event using this gem methods.

Installation

For adding this gem in application you can add gem name in gemfile and run the bundle command. In gemfile add this line:

gem ballparc

In console run this command after adding gem in gemfile:

bundle

Also you can install the gem and add to the application's Gemfile by executing:

$ bundle add ballparc

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install ballparc

Usage

For creating parking_session in ballparc use this method:

Ballparc.create_parking_session(body_data, debug = true)

For deactivating parking_session in ballparc use this method:

Ballparc.deactivate_parking_session(paid_vehicle_id, debug = true)

To view violation in ballparc use this method:

Ballparc.view_violation(body_data, debug = true)

In above methods we pass 2 arguments: a). Data is fields required by the ballparc API. Example 1: For create parking session.

data:
{   'location_id': "Ballparc Location ID",
    'source': "Your Company API",
    'start_time': "2019-02-02 14:39:20",
    'end_time': "2019-02-03 14:39:20",
    'space_number': Space number,
    'plate_number': "123XYZ",
    'plate_state': "TN",
    'external_key': "A101"
}

Example 2: For view violation.

data = {start_date: '2024-01-21', end_date: '2024-01-23', plate_number: 'ABC12'}

Example 3: For deactivate parking_session, we need to pass the ballparc paid vehicle's id.

b). Debug is an optional argument and it's a boolean flag for testing purpose only. If debug is true then it will use the Ballparc's mock server to return actual response data so we can see the response data structure.

Example: Ballparc.create_parking_session(body_data, debug = true)

If we will not pass the debug in argument then gem will use the Ballparc's production server.

Example: Ballparc.create_parking_session(body_data)

For making this gem work we need to add two environment variables in our application with these names:

BALLPARC_KEY=abcxyz
BALLPARC_SECRET=abcxyz

For more information please see the Ballparc documentation here

License

The gem is available as open source under the terms of the MIT License.