Class: MojioModelSDK

Defined in: MojioModelSDK.coffee

Overview

The Model segment of the Mojio SDK. The model part of the SDK is the lowest level of the fluent chain and is used by all other SDK segments. It provides ways to specify the type of resource, identification of particular resources, and data for the resource.

Direct Known Subclasses

MojioAuthSDK

Instance Method Summary

Instance Method Details

# (void) setup(data)

# (void) setCriteria(data)

# (object) users(data)

Specify a list of users to apply operations to in the fluent chain.

A list of users can be specified either with an array of users (id's or objects), or a query string. Pass null or undefined for all users accessible by the current user.

Examples:

Observe a list of users.

sdk.observe("key").users(["user_id1", "user_id2", { some user object }]).callback((error, result) ->
    ...
)

Parameters:

  • users ( array or string ) A list of user ids or objects. A string will specify a query.

Returns:

  • ( object ) — this

# (object) vehicles(data)

Specify a list of vehicles to apply operations to in the fluent chain.

A list of vehicles can be specified either with an array of vehicles (id's or objects), or a query string. Pass null or undefined for all vehicles accessible by the current vehicle.

Examples:

Observe a list of vehicles.

sdk.observe("key").vehicles(["vehicle_id1", "vehicle_id2", { some vehicle object }]).callback((error, result) ->
    ...
)

Parameters:

  • vehicles ( array or string ) A list of vehicle ids or objects. A string will specify a query.

Returns:

  • ( object ) — this

# (object) mojios(data)

Specify a list of mojios to apply operations to in the fluent chain.

A list of mojios can be specified either with an array of mojios (id's or objects), or a query string. Pass null or undefined for all mojios accessible by the current mojio.

Examples:

Observe a list of mojios.

sdk.observe("key").mojios(["mojio_id1", "mojio_id2", { some mojio object }]).callback((error, result) ->
    ...
)

Parameters:

  • mojios ( array or string ) A list of mojio ids or objects. A string will specify a query.

Returns:

  • ( object ) — this

# (object) trips(data)

Specify a list of trips to apply operations to in the fluent chain.

A list of trips can be specified either with an array of trips (id's or objects), or a query string. Pass null or undefined for all trips accessible by the current trip.

Examples:

Observe a list of trips.

sdk.observe("key").trips(["trip_id1", "trip_id2", { some trip object }]).callback((error, result) ->
    ...
)

Parameters:

  • trips ( array or string ) A list of trip ids or objects. A string will specify a query.

Returns:

  • ( object ) — this

# (object) apps(data)

Specify a list of apps to apply operations to in the fluent chain.

Returns:

  • ( object ) — this

# (object) groups(data)

group

Returns:

  • ( object ) — this

# (object) permissions(data)

permissions

Returns:

  • ( object ) — this

# (object) images(data)

Specify an image to apply operations to in the fluent chain. One image can be associated with either Vehicles or Users.

Returns:

  • ( object ) — this

# (object) tags(data)

Specify a tag to apply operations to in the fluent chain. Tags are secondary resources associated with Vehicles, Mojios, Users, Groups, or Trips

Returns:

  • ( object ) — this

# (object) details(data)

Return the changeable details of a resource

Returns:

  • ( object ) — this

# (object) histories(measurement = null)

Return the changeable details of a resource

Returns:

  • ( object ) — this

# (object) states()

Return the changeable details of a resource

Returns:

  • ( object ) — this

# (object) locations()

Return the changeable details of a resource

Returns:

  • ( object ) — this

# (object) mock()

Create models for testing purposes.

Mocks up objects for testing, objects are not persisted and are created with random values.

Examples:

Create a Vehicle for unit testing

sdk.mock().vehicle().callback((error, result) ->
    ...
)

Parameters:

  • type ( string ) The model type: Vehicle, User, Mojio, or Trip.

Returns:

  • ( object ) — this

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: