SDK Utilities
        
        
            
- Source:
Methods
(inner) addQueries(uri, params, toExcludeopt) → {URI}
    Append querystring using key-value pairs from an object.
If a key exists both in the uri object and params, the one
in the uri object will be replaced. Any camelcased key is
automatically converted to lowercase with underscore separators.
Some keys can be excluded automatically. They include: secret.
    Parameters:
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
| uri | URI | an instance of URIjs | ||
| params | Object | object with parameters | ||
| toExclude | Boolean | <optional> | true | whether to exclude keys automatically | 
- Source:
Returns:
    the uri with the queries appended
- Type
- URI
(inner) allowOptionalParams(params, callbackopt) → {Object}
    Allow params to be optional for user to pass to the invoking function
    Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| params | * | user's params | |
| callback | function | <optional> | user's callback | 
- Source:
Returns:
- Type
- Object
(inner) createTimestamp() → {Number}
    Generate a UNIX timestamp
- Source:
Returns:
    UNIX timestamp
- Type
- Number
(inner) getAuthOptions(sources, destopt) → {Object}
    Return an object with authentication options from an object
    Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| sources | Object | Array.<Object> | objects to look for the properties | |
| dest | Object | <optional> | destination object | 
- Source:
Returns:
    options
- Type
- Object
(inner) getOptions(sources, keys, destopt) → {Object}
    Return an object with key-value pairs, using keys, from an object
    Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| sources | Object | Array.<Object> | object(s) to look for the properties | |
| keys | Array | an array of keys of the properties to look up | |
| dest | Object | <optional> | destination object | 
- Source:
Returns:
    options
- Type
- Object
(inner) getPollerOptions(sources, destopt) → {Object}
    Retruns an object with poller options from sources
    Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| sources | Object | Array.<Object> | ||
| dest | Object | <optional> | 
- Source:
Returns:
    options
- Type
- Object
(inner) getProxy() → {String}
    Return the currently set proxy
- Source:
Returns:
    the set proxy url
- Type
- String
(inner) getURIOptions(sources, destopt) → {Object}
    Return an object with options required to instantiate URI.
    Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| sources | Object | Array.<Object> | objects to look for the properties | |
| dest | Object | <optional> | destination object | 
- Source:
Returns:
    options
- Type
- Object
(private, inner) parseResponse(response) → {Object}
    Add properties to response
    Parameters:
| Name | Type | Description | 
|---|---|---|
| response | Object | as from the `request` module | 
Returns:
    the originally passed but modified reponse
- Type
- Object
(inner) passResponse(callback) → {function}
    Parse response then pass to callback
    Parameters:
| Name | Type | Description | 
|---|---|---|
| callback | function | user's callback | 
- Source:
Returns:
    function to handle responses from `request` modules
- Type
- function
(inner) pickParams(params) → {Object}
    Pick out parameters
    Parameters:
| Name | Type | Description | 
|---|---|---|
| params | Object | 
- Source:
Returns:
    cleaner params
- Type
- Object
(inner) removeAuthOptions(…objects)
    Remove all options applicable for signing requests
    Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| objects | Object | <repeatable> | objects to modify | 
- Source:
(inner) removeOptions(args, keys)
    Delete keys from objects
    Parameters:
| Name | Type | Description | 
|---|---|---|
| args | Array.<Object> | |
| keys | String | Array.<String> | 
- Source:
(inner) removeURIOptions(…objects)
    Remove all options applicable for creating a new URI instance
    Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| objects | Object | <repeatable> | objects to modify | 
- Source:
(inner) request() → {Object}
    Return a custom request object
- Source:
Returns:
    request object
- Type
- Object
(inner) setProxy(proxy)
    Setting up proxy for the whole SDK
    Parameters:
| Name | Type | Description | 
|---|---|---|
| proxy | String | a valid url | 
- Source:
(inner) setup(settings) → {Object}
    Set the SDK settings
    Parameters:
| Name | Type | Description | 
|---|---|---|
| settings | Object | new SDK settings | 
- Source:
Returns:
    the newly-set SDK settings
- Type
- Object
(inner) shuffleArray(array) → {Array}
    Shuffles items in an array
Operation takes O(n) time. The array passed is operated on as its
reference, rather than value, is passed to the function.
    Parameters:
| Name | Type | Description | 
|---|---|---|
| array | Array | an array of items | 
- Source:
Returns:
    array with the the items shuffled
- Type
- Array
(inner) sortKeys(object) → {Array}
    Return a sorted array of an object's keys
    Parameters:
| Name | Type | Description | 
|---|---|---|
| object | Object | an object | 
- Source:
Returns:
    array of sorted keys
- Type
- Array
(inner) url(labelopt, optionsopt) → {URI}
    Return an URI object (from URI.js) for easier URL building.
See http://medialize.github.io/URI.js/docs.html for docs on URI.js
    Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| label | String | <optional> | label - identifying the URL. | 
| options | Object | <optional> | options - options to be used | 
- Source:
Returns:
    an instance of URI.js
- Type
- URI