# Class GenericResource

GenericResource is the class every model should use for initialization. It provides the functions to check the mandatory, optional arguments provided

### Direct known subclasses

`Catapult\Account`, `Catapult\Application`, `Catapult\MessageMulti`, `Catapult\NumberInfo`, `Catapult\PhoneNumbers`, `Catapult\Recording`, `Catapult\ResolverResource`, `Catapult\Transaction`, `Catapult\Transcription`, `Catapult\UserError`, `Catapult\AudioMixin`, `Catapult\Bridge`, `Catapult\CallEvents`, `Catapult\Domains`, `Catapult\Endpoints`, `Catapult\Gather`, `Catapult\Media`, `Catapult\Message`

### Indirect known subclasses

`Catapult\BridgeCollection`, `Catapult\Call`, `Catapult\Conference`, `Catapult\ConferenceMember`, `Catapult\Resolver`

Namespace: Catapult
Located at resource/Base.php

## Methods summary

`public this->camelizedContext` | # `__call( function $function, $args )` accomodate for camelcase vs underscore accomodate for camelcase vs underscore update adds prototyped functions for quicker mockups #### Parameters $function underscored function $args #### Returns this->camelizedContext ex: $call->listCalls -> $call->list_calls
`public` | # `_init( $data, $depends, $loads, $schema, $extras = null )` _init performs basic functions to set up all the subclasses. Will call the normal execution order. _init performs basic functions to set up all the subclasses. Will call the normal execution order. first attach the client check if the schema is properly formed initialize path with dependancies return the appropriate object use in resolver added: 1/29/2015
`public` | # `get_sub_function( fn: $fn )` checks if a given term lands in subfunctions checks if a given term lands in subfunctions #### Parameters $fn function name
`public` | # `get( id: $id = NULL )` Public API get, this will call the get function on the loaded endpoint, optionally add another id if specified Public API get, this will call the get function on the loaded endpoint, optionally add another id if specified #### Parameters $id to load
`public string` | # `__toString( )` default string representation of object. default string representation of object. TODO: move to StringifyResource #### Returns string that represents the object
`public` | # `_list( args $args = null )` Generic list. Moved from independant declaration, should work on all models Generic list. Moved from independant declaration, should work on all models #### Parameters $args with page, and size [optional]
`public` | # `create( )` General purpose create General purpose create
`public` | # `update( )`
`public` | # `check( k: $k, v: $v )` check will retrieve latest info of the entity then compare a field to a given value ex: $call->check('state', 'active') => TRUE check will retrieve latest info of the entity then compare a field to a given value ex: $call->check('state', 'active') => TRUE #### Parameters $k to check $v to compare against
`public` | # `delete( id $id = null )` delete a media file delete a media file TODO: this should not keep the object's information. This will not be useful anymore! #### Parameters $id model
`public` | # `load( )` load the object with static properties usually done client side -- or by collections already holding information on an object load the object with static properties usually done client side -- or by collections already holding information on an object
`public` | # `reload( )` reload the object with updated information this will call the member's get function and check for changes. reload the object with updated information this will call the member's get function and check for changes.
`public` | # `getAudioUrl( )` gets the audio url for a resource Usually this is extended by a model gets the audio url for a resource Usually this is extended by a model
`public` | # `getPath( $class )` helper get the path for a given class fallback: plural lowercased
`public` | # `getObjClass( $path )` get the class for a given path fallback: singular titlecased get the class for a given path fallback: singular titlecased
`public` | # `getSchemaString( $ctx = null )` get the schema fields in a comma seperated form get the schema fields in a comma seperated form
`public` | # `toArray( )` make all properties an array make all properties an array

## Properties summary

`public` | $lastUpdate | # ``
`public static array` | $paths | # `array( "Application" => "applications", "Call" => "calls", "Conference" => "conferences", "ConferenceMember" => "members", "UserError" => "errors", "Message" => "messages", "PhoneNumbers" => "phoneNumbers", "Recording" => "recordings", "Account" => "account", "Transcription" => "transcriptions", "Bridge" => "bridges", "NumberInfo" => "numberInfo", "Transaction" => "transactions", "Domains" => "domains", "Endpoints" => "endpoints", "Media" => "media", "CallEvents" => "events", "Gather" => "gather" )`