httpSingleton

httpSingleton

httpSingleton object
Source:

Methods

(static) _getBodyOrUndefined(response) → {Object}

Returns the body of the response if not missing, otherwise undefined
Source:
Parameters:
Name Type Description
response Object
Returns:
Type:
Object

(static) _getErrorFromResponse(response) → {undefined}

Returns the appropriate NewtonError based on the status code of a response
Source:
Parameters:
Name Type Description
response Object
Returns:
Type:
undefined

(static) _hasErrorCode(response, errorCode) → {Boolean}

Returns whether a response was returned with a given status code
Source:
Parameters:
Name Type Description
response Object
errorCode Number
Returns:
Type:
Boolean

(private, static) getAuthHeader(method, url, bodyString, queryString, timestamp) → {String}

Returns an Authorization Header for iPawn identifier
Source:
Parameters:
Name Type Description
method String
url String
bodyString String
queryString String
timestamp Number
Returns:
Type:
String

(private, static) getIpawnHash(url, method, bodyString, queryString, timestamp) → {String}

Returns a hash message authentication code for the HmacSHA1 algorithm.
Source:
Parameters:
Name Type Description
url String
method String
bodyString String
queryString String
timestamp Number
Returns:
Type:
String

(private, static) getQueryString(obj) → {String}

Returns an URI encoded querystring from an object
Source:
Parameters:
Name Type Description
obj Object
Returns:
Type:
String

(static) is2xx(response) → {Boolean}

Returns whether a request returned an OK status
Source:
Parameters:
Name Type Description
response Object
Returns:
Type:
Boolean

(private, static) makeJSONP(url, queryString) → {undefined}

Sends a JSONP request with given querystring
Source:
Parameters:
Name Type Description
url String
queryString String
Returns:
Type:
undefined

(private, static) makePostWithXHR(url, body, headers, callback) → {undefined}

Sends an XHR POST request with given parameters
Source:
Parameters:
Name Type Description
url String
body Object
headers Array
callback function
Returns:
Type:
undefined

(static) makeSignedRequest(url, content, callback) → {undefined}

Sends a signed request with given content
Source:
Parameters:
Name Type Description
url String
content Object
callback function
Returns:
Type:
undefined

(static) makeUnsignedRequest(url, content, callback) → {undefined}

Sends an unsigned signed request with given content
Source:
Parameters:
Name Type Description
url String
content Object
callback function
Returns:
Type:
undefined

(static) setLogViewInfo(logViewInfo)

Sets the logView info object to be used when Auth API is called
Source:
Parameters:
Name Type Description
logViewInfo Object

(static) setupInstance(identifier, secret, urls) → {undefined}

Sets secret, identifier and client/auth end domains
Source:
Parameters:
Name Type Description
identifier String
secret String
urls Object
Returns:
Type:
undefined