https://github.com/rubbaboy/ondemand
A generated wrapper for the proprietary Agilysys OnDemand system
https://github.com/rubbaboy/ondemand
Last synced: 24 days ago
JSON representation
A generated wrapper for the proprietary Agilysys OnDemand system
- Host: GitHub
- URL: https://github.com/rubbaboy/ondemand
- Owner: RubbaBoy
- License: mit
- Created: 2021-04-08T20:42:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-22T22:33:35.000Z (over 5 years ago)
- Last Synced: 2025-03-26T09:46:34.318Z (over 1 year ago)
- Language: Dart
- Size: 212 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
A generated wrapper library for the closed-source Agilysys OnDemand system used by RIT.
Generated by [ondemand_wrapper_gen](https://github.com/RubbaBoy/ondemand_wrapper_gen)
### Usage
In your pubspec.yml, include the following:
```yaml
dependencies:
ondemand:
git: https://github.com/RubbaBoy/ondemand
```
### Examples
The least amount of code needed to start making requests:
```dart
import 'package:ondemand/ondemand.dart';
// ...
// The object to invoke requests with
var onDemand = await Initialization.create();
// The site-wide config
var config = initialization.config;
```
The following is a relatively barebones example of making an account inquiry to view balances (Source: [example/inquiry_example.dart](/example/inquiry_example.dart))
```dart
import 'package:ondemand/account_inquiry.dart' as _account_inquiry;
import 'package:ondemand/get_kitchens.dart' as _get_kitchens;
import 'package:ondemand/ondemand.dart';
// The UID to make the inquiry to
const UID = 'my-uid';
Future main(List args) async {
var onDemand = await Initialization.create();
// The context ID, which should be the same no matter what
var contextId = onDemand.config.contextID;
// Fetch the kitchens available in the store
var siteRequest = await onDemand.getKitchens(_get_kitchens.Request());
// Just get the first kitchen, as a terminal ID is required
var firstKitchen = siteRequest.kitchens.first;
// Get the terminal ID
var terminalId = firstKitchen.displayOptions.onDemandTerminalId;
print('Using terminal: ${firstKitchen.name}');
print('Terminal ID: $terminalId\n');
// Check the account balance
var tenderResponse = await makeInquiry(onDemand, contextId, terminalId, UID);
for (var inq in tenderResponse) {
print('Tender: ${TenderId.getTender(inq.tenderId).name}:');
print(' Remaining: ${inq.amount.remaining} ${inq.amount.currency}');
print('\n Individual accounts:');
for (var account in inq.accounts) {
print(' ${account.name}: ${account.balance} ${account.currency}');
}
}
}
```
Output of this for my own account:
```
Using terminal: The Commons
Terminal ID: 1706
Tender: Dining Dollars:
Remaining: 1424.87 USD
Individual accounts:
Dining Dollars (Meal Plan): 142487 USD
Dining Dollars (Voluntary): 0 USD
```