account-model

Methods

(static) check(survey) → {Promise.<module:survey-model~SurveyObject>}

Source:

Check if account for passed survey is active, and not exceeding quota. This passes back the original survey object and therefore differs from the get function!

Parameters:
Name Type Description
survey module:survey-model~SurveyObject

survey object

Returns:

updated SurveyObject

Type
Promise.<module:survey-model~SurveyObject>

(static) get(survey) → {Promise.<(Error|AccountObj)>}

Source:

Obtains account.

Parameters:
Name Type Description
survey module:survey-model~SurveyObject

survey object

Returns:

promise that resolves in Account object

Type
Promise.<(Error|AccountObj)>

(inner) _getAccount(serverUrl) → {AccountObj}

Source:

Obtains account from either configuration (hardcoded) or via custom function

Parameters:
Name Type Description
serverUrl string

The serverUrl to be used to look up the account.

Returns:
Type
AccountObj

(inner) _getHardcodedAccount() → {null|AccountObj}

Source:

Obtains the hardcoded account from the config

Returns:

null or Account object

Type
null | AccountObj

(inner) _getServer(survey) → {string|null}

Source:

Extracts the server from a survey object or server string.

Parameters:
Name Type Description
survey string | module:survey-model~SurveyObject

Server string or survey object.

Returns:

server

Type
string | null

(inner) _isAllowed(account, serverUrl) → {boolean}

Source:

Checks if the provided serverUrl is part of the allowed 'linked' OpenRosa Server.

Parameters:
Name Type Description
account AccountObj

an account object

serverUrl string

server URL

Returns:

Whether server URL is allowed

Type
boolean

(inner) _stripProtocol(url) → {string|null}

Source:

Strips http(s):// from the provided url

Parameters:
Name Type Description
url string

URL

Returns:

stripped url

Type
string | null

Type Definitions

AccountObj

Source:
Properties:
Name Type Attributes Description
linkedServer string
openRosaServer string <optional>
key string
quota number