rentdynamics
Version:
Package to help facilitate communicating with the Rent Dynamics API
128 lines (109 loc) • 5.04 kB
Markdown
[![Circle CI Badge][circleci-badge]][circleci-link]
[![codecov][codecov-image]][codecov-link]
[![Dependency Status][dependency-image]][dependency-link]
[![Dev Dependency Status][dev-dependency-image]][dev-dependency-link]
[![Peer Dependency Status][peer-dependency-image]][peer-dependency-link]
[![NPM Version][npm-version-image]][npm-version-link]
[![MIT License][npm-license-image]][npm-license-link]
Include jsSHA and our CDN
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsSHA/2.3.1/sha.js"></script>
<script src="https://cdnjs.rentdynamics.com/rentdynamics.latest.js"></script>
```
```js
var options = {
apiKey: '<insert-key-here>',
apiSecretKey: '<insert-secret-key-here>'
};
var rdClient = new RentDynamics.Client(options);
rdClient.login('<username>', '<password>').then(function(result) {
...
});
// Then you can make api calls
rdClient.get('/data').then(function(result) {
...
});
```
Install with [npm](https://www.npmjs.com/): `npm install rentdynamics`
```ts
import { Client } from 'rentdynamics';
let options = {
apiKey: '<insert-key-here>',
apiSecretKey: '<insert-secret-key-here>'
};
let rdClient = new Client(options);
rdClient.login('<username>', '<password>').then((result: object) => {
...
});
// Then you can make api calls
rdClient.get('/data').then((result: array | object) => {
...
});
```
* `apiKey: string (default is undefined)`
* `apiSecretKey: string (default is undefined)`
* `authToken: string (default is undefined)`
* `development: boolean (default is false)`
* `service: string (default is undefined)`
* `developmentUrl: string (default is undefined) (This will only be used if development is set to true)`
* `baseUrl: string (default is undefined) (This will only be used if development is set to false)`
* `get(endpoint: string): Promise<any>`
* `put(endpoint: string, payload: object): Promise<any>`
* `post(endpoint: string, payload: object): Promise<any>`
* `delete(endpoint: string): Promise<any>`
* `login(username: string, password: string): Promise<any>`
* `logout(): Promise<any>`
* appointmentTimes for a given community group
There are 4 different ways to format the response.
1. only the time, no date (this is the default when the 'dateFormat' argument is omitted)
```javascript
rdClient.get(`/appointmentTimes/${communityGroupId}?appointmentDate=10/31/2019&dateFormat=timeonly`).then(function(result) {
// result is a list of local appointmentTimes
// Example: ["10:00 AM","10:15 AM",...,"05:15 PM","05:30 PM"]
});
```
2. utc
``` javascript
rdClient.get(`/appointmentTimes/${communityGroupId}?appointmentDate=10/31/2019&dateFormat=utc`).then(function(result) {
// result is a list of appointmentTimes in utc
// Example: ["2020-01-05T17:00:00Z","2020-01-05T17:15:00Z",...,"2020-01-06T00:15:00Z","2020-01-06T05:30:00Z"]
});
```
3. the local time of the property without an offset
``` javascript
rdClient.get(`/appointmentTimes/${communityGroupId}?appointmentDate=10/31/2019&dateFormat=localWithoutOffset`).then(function(result) {
// result is a list of appointment dates & times in local time without any offset information
// Example: ["2020-01-05T10:00:00","2020-01-05T10:15:00",...,"2020-01-05T17:15:00","2020-01-05T17:30:00"]
});
```
4. the local time of the property with an offset
``` javascript
rdClient.get(`/appointmentTimes/${communityGroupId}?appointmentDate=10/31/2019&dateFormat=localWithOffset`).then(function(result) {
// result is a list of appointment dates & times in local time with the timezone offset of the property
// Example: ["2020-01-05T10:00:00-0700","2020-01-05T10:15:00-0700",...,"2020-01-05T17:15:00-0700","2020-01-05T17:30:00-0700"]
});
```
* `npm test` > Runs all the tests and checks the code coverage.
[]: https://circleci.com/gh/RentDynamics/rentdynamics-js/tree/master.svg?style=shield&circle-token=8ca42b3ae23f8df7f754457b3daae599f716f85c
[]: https://circleci.com/gh/RentDynamics/rentdynamics-js
[]: https://codecov.io/gh/RentDynamics/rentdynamics-js/branch/master/graph/badge.svg
[]: https://codecov.io/gh/RentDynamics/rentdynamics-js
[]: https://david-dm.org/RentDynamics/rentdynamics-js/status.svg
[]: https://david-dm.org/RentDynamics/rentdynamics-js
[]: https://david-dm.org/RentDynamics/rentdynamics-js/dev-status.svg
[]: https://david-dm.org/RentDynamics/rentdynamics-js?type=dev
[]: https://david-dm.org/RentDynamics/rentdynamics-js/peer-status.svg
[]: https://david-dm.org/RentDynamics/rentdynamics-js?type=peer
[]: https://img.shields.io/npm/v/rentdynamics.svg
[]: https://www.npmjs.com/package/rentdynamics
[]: https://img.shields.io/npm/l/rentdynamics.svg
[]: LICENSE