new NodeInstructionUrlHelper()
Extends:
Extends
Members
-
environment :module:net~Environment
-
The environment associated with this helper.
Type:
- Inherited From:
-
<readonly> parameters :module:util~Configuration
-
Get a parameters object that can be used to hold URL variables.
Type:
- Inherited From:
Methods
-
<abstract> baseUrl()
-
Get the base URL to the REST API.
This implementation is a stub, meant for subclasses to override. This implementation simply returns module:net~UrlHelper#hostUrl.
- Inherited From:
Returns:
the base URL to the REST API
- Type
- string
-
env(key [, val])
-
Get or set an environment parameter.
This is a shortcut for calling module:net~Configuration#value on the
environment
object.Parameters:
Name Type Argument Description key
string the environment parameter name to get
val
object <optional>
the optional value to set
- Inherited From:
Returns:
when called as a getter, the environment parameter value; when called as a setter, the environment parameters object
- Type
- object
-
hostUrl()
-
Get a URL for just the SolarNet host, without any path.
This method constructs an absolute URL based on the following properties configured on this instance's module:net~Environment:
- If environment.useTls() returns
true
then use HTTPS as the protocol, otherwise HTTP. - Use
host
for the host name or IP address, unlessproxyHost
is available. - Use
port
for the port, unlessproxyPort
is available. If neither are available, use443
for HTTPS or80
for HTTP.
- Inherited From:
Returns:
the URL to the SolarNet host
- Type
- string
- If environment.useTls() returns
-
hostWebSocketUrl()
-
Get a URL for just the SolarNet host using the WebSocket protocol, without any path.
This method constructs an absolute URL based on the following properties configured on this instance's module:net~Environment:
- If environment.useTls() returns
true
then use WSS as the protocol, otherwise WS. - Use
host
for the host name or IP address, unlessproxyHost
is available. - Use
port
for the port, unlessproxyPort
is available. If neither are available, use443
for WSS or80
for WS.
- Inherited From:
Returns:
the URL to the SolarNet host WebSocket
- Type
- string
- If environment.useTls() returns
-
instructionParameter(name, value)
-
Create an instruction parameter suitable to passing to NodeInstructionUrlHelperMixin#queueInstructionUrl.
Parameters:
Name Type Description name
string the parameter name
value
* the parameter value
Returns:
with
name
andvalue
properties- Type
- object
-
parameter(key [, val])
-
Get or set a parameter.
This is a shortcut for calling module:net~Configuration#value on the
parameters
object.Parameters:
Name Type Argument Description key
string the parameter name to get
val
Object <optional>
the optional value to set
- Inherited From:
Returns:
when called as a getter, the parameter value; when called as a setter, the parameters object
- Type
- Object
-
resolveTemplatePath(template)
-
Replace occurances of URL template variables with values from the
parameters
property and append to the host URL.This method provides a way to resolve an absolute URL based on the configured environment and parameters on this object.
Parameters:
Name Type Description template
string a URL path template
- Inherited From:
- See:
Returns:
an absolute URL
- Type
- string
-
resolveTemplateUrl(template)
-
Replace occurances of URL template variables with values from the
parameters
property.URL template variables are specified as
{<em>name</em>}
. The variable will be replaced by the value associated with propertyname
in theparameters
object. The value will be URI encoded.Parameters:
Name Type Description template
string a URL template
- Inherited From:
Returns:
the URL with template variables resolved
- Type
- string