Constructor
new RestResource(attributes, from_server)
Parameters:
Name | Type | Description |
---|---|---|
attributes |
Object | The attributes representing a new object |
from_server |
Boolean | Used internally to know if an object exists on the server |
- Source:
Methods
(static) create(attributes) → {Promise}
Creates a new object w/ the provided attributes.
Parameters:
Name | Type | Description |
---|---|---|
attributes |
Object |
- Source:
Returns:
- Type
- Promise
(static) find(uid) → {Promise}
Finds either all the relevant resources when not given any arguments (e.g. finds all Zones in an account)
but when supplied an identifier will only return that single resource (e.g. /zones/testdomain.test will
only return info pertaining to the zone testdomain.test)
Parameters:
Name | Type | Description |
---|---|---|
uid |
String | String identifier of the object which is conjoined with the base_path of the resource |
- Source:
Returns:
- Type
- Promise
(static) get_base_path() → {String}
Defines the default path for the resource, e.g. zones == '/zones'. Default behavior is the to take
the class's name, lower case it, and pluralize it. Overrideable in child classes.
- Source:
Returns:
- Type
- String
create_resource_path() → {String}
Overrideable method to provide non-standard "PUT" behavior on creating new records.
E.g. Zones require info in the URI where Data Sources don't.
- Source:
Returns:
- Type
- String
destroy() → {Promise}
Destroys an object on the server w/ the delete HTTP verb.
- Source:
Returns:
- Type
- Promise
get_resource_path() → {String}
Defines the path to posting changes & getting details on a single resource. Method is
required to be overriden within child classes as most paths will require info pertaining
to the individual resource's attributes.
- Source:
Returns:
- Type
- String
save() → {Promise}
Saves an object on the server.
- Source:
Returns:
- Type
- Promise
update(attributes) → {Promise}
Updates an object w/ the provided attributes.
Parameters:
Name | Type | Description |
---|---|---|
attributes |
Object |
- Source:
Returns:
- Type
- Promise