Home Reference Source Repository
import BaseModel from 'rodan-client/js/Models/BaseModel.js'
public class | source

BaseModel

Extends:

backbone~Backbone.Model → BaseModel

Base model.

Constructor Summary

Public Constructor
public

constructor(options: object)

Constructor.

Method Summary

Public Methods
public

destroy(options: object)

Override of destroy to allow for generic handling.

public

fetch(options: object)

Override of fetch to allow for generic handling.

public

Returns descriptive string for model.

public

Parses ID out of resource type URL.

public

save(attributes: object, options: object): *

Override of save to allow for generic handling.

public

url(): string

URL override to add trailing slash.

Public Constructors

public constructor(options: object) source

Constructor.

Params:

NameTypeAttributeDescription
options object

initialization parameters for Backbone.Model

Public Methods

public destroy(options: object) source

Override of destroy to allow for generic handling.

Params:

NameTypeAttributeDescription
options object

Backbone.Model.destroy options object

public fetch(options: object) source

Override of fetch to allow for generic handling.

Params:

NameTypeAttributeDescription
options object

Backbone.Model.fetch options object

public getDescription(): string source

Returns descriptive string for model. This should be overridden by sub-classes.

Return:

string

returns 'no description available' unless overridden by subclass

public parseIdFromUrl(url: string): string source

Parses ID out of resource type URL.

Params:

NameTypeAttributeDescription
url string

URL with UUID at end

Return:

string

UUID

TODO:

  • this should be in a utility file

public save(attributes: object, options: object): * source

Override of save to allow for generic handling.

Params:

NameTypeAttributeDescription
attributes object

attributes to change in model

options object

Backbone.Model.save options object

Return:

*

public url(): string source

URL override to add trailing slash. Also, the URL will depend if this model instance has been saved or not. If not saved, we have to use the plural route for the model to save it. That's the way Rodan works. :)

Return:

string

URL of Resource with trailing slash