Skip to content

Commit

Permalink
documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tayloratka committed Feb 24, 2018
1 parent bca59bd commit b5a0404
Show file tree
Hide file tree
Showing 5 changed files with 254 additions and 18 deletions.
213 changes: 208 additions & 5 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ <h3 class='mb0 no-anchor'>fortunasdk</h3>
</li>


<li><a
href='#customfield'
class="">
CustomField

</a>

</li>


<li><a
href='#fortunaapi'
class=" toggle-sibling">
Expand Down Expand Up @@ -296,7 +306,7 @@ <h3 class='fl m0' id='user'>
</div>


<p>Class representing a user</p>
<p>Class representing a User</p>


<div class='pre p1 fill-light mt0'>User</div>
Expand All @@ -318,6 +328,119 @@ <h3 class='fl m0' id='user'>



<div class='py1 quiet mt1 prose-big'>Properties</div>
<div>

<div class='space-bottom0'>
<span class='code bold'>externalId</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>email</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>lastName</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>firstName</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>password</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>active</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>sendInitialEmail</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>forcePasswordChange</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>locale</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>registrationCode</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>businessName</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>address1</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>address2</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>city</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>state</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>postalCode</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>country</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>


</div>

<div class='space-bottom0'>
<span class='code bold'>customFields</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a>&#x3C;<a href="#customfield">CustomField</a>>)</code>


</div>

</div>




Expand Down Expand Up @@ -395,21 +518,21 @@ <h3 class='fl m0' id='token'>
</div>

<div class='space-bottom0'>
<span class='code bold'>issued</span> <code class='quiet'>(datetime)</code>
<span class='code bold'>issued</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date">date</a>)</code>
: Issue date


</div>

<div class='space-bottom0'>
<span class='code bold'>expires</span> <code class='quiet'>(datetime)</code>
<span class='code bold'>expires</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date">date</a>)</code>
: Expiry date


</div>

<div class='space-bottom0'>
<span class='code bold'>expiresIn</span> <code class='quiet'>(int)</code>
<span class='code bold'>expiresIn</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>)</code>
: Seconds till expiration. Epcoch Unix Timestamp


Expand All @@ -431,7 +554,7 @@ <h3 class='fl m0' id='token'>
</div>

<div class='space-bottom0'>
<span class='code bold'>isValid</span> <code class='quiet'>(bool)</code>
<span class='code bold'>isValid</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>)</code>
: Checks to see if the token is "fresh" or expired


Expand Down Expand Up @@ -511,6 +634,86 @@ <h3 class='fl m0' id='token'>



</section>




<section class='p2 mb2 clearfix bg-white minishadow'>


<div class='clearfix'>

<h3 class='fl m0' id='customfield'>
CustomField
</h3>


</div>


<p>Class representing a Custom Field</p>


<div class='pre p1 fill-light mt0'>new CustomField(cfd: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>)</div>











<div class='py1 quiet mt1 prose-big'>Parameters</div>
<div class='prose'>

<div class='space-bottom0'>
<div>
<span class='code bold'>cfd</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a>)</code>
Object containing the Custom Field Definition

</div>

</div>

</div>



<div class='py1 quiet mt1 prose-big'>Properties</div>
<div>

<div class='space-bottom0'>
<span class='code bold'>name</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>
: String containing the name of the custom field


</div>

<div class='space-bottom0'>
<span class='code bold'>value</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code>
: String containing the value of the custom field. If the custom field is multiselect, you can use commas to seperate out the values.


</div>

</div>













</section>


Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

const User = require('./lib/models/user.model');
const Token = require('./lib/models/token.model');
const CustomField = require('./lib/models/custom-field.model');

// Modules

Expand All @@ -26,4 +27,5 @@ module.exports = Fortuna;
// expose models

module.exports.user = User;
module.exports.token = Token;
module.exports.token = Token;
module.exports.customField = CustomField;
17 changes: 17 additions & 0 deletions lib/models/custom-field.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"use strict";

/** Class representing a Custom Field
* @param {object} cfd - Object containing the Custom Field Definition
* @property {string} name - String containing the name of the custom field
* @property {string} value - String containing the value of the custom field. If the custom field is multiselect, you can use commas to seperate out the values.
*/

class CustomField {
constructor(cfd) {
this.name = cfd.name;
this.value = cfd.value;
}



}
12 changes: 6 additions & 6 deletions lib/models/token.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ const moment = require('moment');
* @typedef {Token}
* @param {object} token - Response from auth server to serialize into a Token.
* @property {string} accessToken - Access Token, used to make requests.
* @property {datetime} issued - Issue date
* @property {datetime} expires - Expiry date
* @prop {int} expiresIn - Seconds till expiration. Epcoch Unix Timestamp
* @prop {string} tokenType - Type of token. (Bearer)
* @prop {string} authorization - Authorization header content. Example `Bearer xxxxxxxxx`
* @prop {bool} isValid - Checks to see if the token is "fresh" or expired
* @property {date} issued - Issue date
* @property {date} expires - Expiry date
* @property {number} expiresIn - Seconds till expiration. Epcoch Unix Timestamp
* @property {string} tokenType - Type of token. (Bearer)
* @property {string} authorization - Authorization header content. Example `Bearer xxxxxxxxx`
* @property {boolean} isValid - Checks to see if the token is "fresh" or expired
*/

class Token {
Expand Down
26 changes: 20 additions & 6 deletions lib/models/user.model.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
"use strict";

/** Class representing a user
/** Class representing a User
* @typedef {User} User
* @property {string} externalId
* @property {string} email
* @property {string} lastName
* @property {string} firstName
* @property {string} password
* @property {boolean} active
* @property {boolean} sendInitialEmail
* @property {boolean} forcePasswordChange
* @property {string} locale
* @property {string} registrationCode
* @property {string} businessName
* @property {string} address1
* @property {string} address2
* @property {string} city
* @property {string} state
* @property {string} postalCode
* @property {string} country
* @property {Array<CustomField>} customFields
*/

class User {
Expand All @@ -26,11 +44,7 @@ class User {
this.city = user.city;
this.state = user.state;
this.postalCode = user.postalCode;





this.customFields = user.customFields;
}

get() {
Expand Down

0 comments on commit b5a0404

Please sign in to comment.