RKObjectManager Class Reference
Inherits from | NSObject |
Declared in | RKObjectManager.h RKObjectManager.m |
Tasks
-
+ sharedManager
Return the shared instance of the object manager
-
+ setSharedManager:
Set the shared instance of the object manager
-
+ objectManagerWithBaseURL:
Create and initialize a new object manager. If this is the first instance created it will be set as the shared instance
-
+ objectManagerWithBaseURL:objectMapper:router:
Create and initialize a new object manager. If this is the first instance created it will be set as the shared instance
-
– initWithBaseURL:
Initialize a new model manager instance
-
– initWithBaseURL:objectMapper:router:
Initialize a new model manager instance
-
format
The wire format to use for communications. Either RKMappingFormatXML or RKMappingFormatJSON.
property -
client
The REST client for this manager
property -
– isOnline
True when we are in online mode
-
– registerClass:forElementNamed:
Register a resource mapping from a domain model class to a JSON/XML element name
-
mapper
Mapper object responsible for mapping remote HTTP resources to Cocoa objects
property -
router
Routing object responsible for generating paths for objects and serializing representations of the object for transport.
property -
objectStore
A Core Data backed object store for persisting objects that have been fetched from the Web
property -
– loadObjectsAtResourcePath:delegate:
Create and send an asynchronous GET request to load the objects at the resource path and call back the delegate with the loaded objects. Remote objects will be mapped to local objects by consulting the element registrations set on the mapper.
-
– loadObjectsAtResourcePath:queryParams:delegate:
Create and send an asynchronous GET request to load the objects at the specified resource path with a dictionary of query parameters to append to the URL and call back the delegate with the loaded objects. Remote objects will be mapped to local objects by consulting the element registrations set on the mapper.
-
– loadObjectsAtResourcePath:objectClass:delegate:
Create and send an asynchronous GET request to load the objects at the resource path and call back the delegate with the loaded objects. Remote objects will be mapped into instances of the specified object mappable class.
-
– loadObjectsAtResourcePath:queryParams:objectClass:delegate:
Create and send an asynchronous GET request to load the objects at the specified resource path with a dictionary of query parameters to append to the URL and call back the delegate with the loaded objects. Remote objects will be mapped into instances of the specified object mappable class.
-
– getObject:delegate:
Update a mappable model by loading its attributes from the web
-
– postObject:delegate:
Create a remote mappable model by POSTing the attributes to the remote resource and loading the resulting objects from the payload
-
– putObject:delegate:
Update a remote mappable model by PUTing the attributes to the remote resource and loading the resulting objects from the payload
-
– deleteObject:delegate:
Delete the remote instance of a mappable model by performing an HTTP DELETE on the remote resource
-
– objectLoaderWithResourcePath:delegate:
Return an object loader ready to be sent. The method defaults to GET and the URL is relative to the baseURL configured on the client. The loader is configured for an implicit objectClass load. This is the best place to begin work if you need to create a slightly different collection loader than what is provided by the loadObjects family of methods.
-
– objectLoaderForObject:method:delegate:
Returns an object loader configured for transmitting an object instance across the wire. A request will be constructed for you with the resource path & object serialization configured for you by the Router. This is the best place to begin work if you need a slightly different interaction with the server than what is provided for you by get/post/put/delete object family of methods. Note that this should be used for one-off changes. If you need to substantially modify all your object loads, you are better off subclassing or implementing your own RKRouter for dryness.
Properties
client
The REST client for this manager
@property (nonatomic, retain) RKClient *client
Declared In
RKObjectManager.h
format
The wire format to use for communications. Either RKMappingFormatXML or RKMappingFormatJSON.
@property (nonatomic, assign) RKMappingFormat format
Discussion
Defaults to RKMappingFormatJSON
Declared In
RKObjectManager.h
mapper
Mapper object responsible for mapping remote HTTP resources to Cocoa objects
@property (nonatomic, readonly) RKObjectMapper *mapper
Declared In
RKObjectManager.h
objectStore
A Core Data backed object store for persisting objects that have been fetched from the Web
@property (nonatomic, retain) RKManagedObjectStore *objectStore
Declared In
RKObjectManager.h
router
Routing object responsible for generating paths for objects and serializing representations of the object for transport.
@property (nonatomic, retain) NSObject<RKRouter> *router
Discussion
Defaults to an instance of RKDynamicRouter
Declared In
RKObjectManager.h
Class Methods
objectManagerWithBaseURL:
Create and initialize a new object manager. If this is the first instance created it will be set as the shared instance
+ (RKObjectManager *)objectManagerWithBaseURL:(NSString *)baseURL
Declared In
RKObjectManager.h
objectManagerWithBaseURL:objectMapper:router:
Create and initialize a new object manager. If this is the first instance created it will be set as the shared instance
+ (RKObjectManager *)objectManagerWithBaseURL:(NSString *)baseURL objectMapper:(RKObjectMapper *)mapper router:(NSObject<RKRouter> *)router
Declared In
RKObjectManager.h
Instance Methods
deleteObject:delegate:
Delete the remote instance of a mappable model by performing an HTTP DELETE on the remote resource
- (RKObjectLoader *)deleteObject:(NSObject<RKObjectMappable> *)object delegate:(NSObject<RKObjectLoaderDelegate> *)delegate
Declared In
RKObjectManager.h
getObject:delegate:
Update a mappable model by loading its attributes from the web
- (RKObjectLoader *)getObject:(NSObject<RKObjectMappable> *)object delegate:(NSObject<RKObjectLoaderDelegate> *)delegate
Declared In
RKObjectManager.h
initWithBaseURL:
Initialize a new model manager instance
- (id)initWithBaseURL:(NSString *)baseURL
Declared In
RKObjectManager.h
initWithBaseURL:objectMapper:router:
Initialize a new model manager instance
- (id)initWithBaseURL:(NSString *)baseURL objectMapper:(RKObjectMapper *)mapper router:(NSObject<RKRouter> *)router
Declared In
RKObjectManager.h
loadObjectsAtResourcePath:delegate:
Create and send an asynchronous GET request to load the objects at the resource path and call back the delegate with the loaded objects. Remote objects will be mapped to local objects by consulting the element registrations set on the mapper.
- (RKObjectLoader *)loadObjectsAtResourcePath:(NSString *)resourcePath delegate:(NSObject<RKObjectLoaderDelegate> *)delegate
Declared In
RKObjectManager.h
loadObjectsAtResourcePath:objectClass:delegate:
Create and send an asynchronous GET request to load the objects at the resource path and call back the delegate with the loaded objects. Remote objects will be mapped into instances of the specified object mappable class.
- (RKObjectLoader *)loadObjectsAtResourcePath:(NSString *)resourcePath objectClass:(Class<RKObjectMappable>)objectClass delegate:(NSObject<RKObjectLoaderDelegate> *)delegate
Declared In
RKObjectManager.h
loadObjectsAtResourcePath:queryParams:delegate:
Create and send an asynchronous GET request to load the objects at the specified resource path with a dictionary of query parameters to append to the URL and call back the delegate with the loaded objects. Remote objects will be mapped to local objects by consulting the element registrations set on the mapper.
- (RKObjectLoader *)loadObjectsAtResourcePath:(NSString *)resourcePath queryParams:(NSDictionary *)queryParams delegate:(NSObject<RKObjectLoaderDelegate> *)delegate
Declared In
RKObjectManager.h
loadObjectsAtResourcePath:queryParams:objectClass:delegate:
Create and send an asynchronous GET request to load the objects at the specified resource path with a dictionary of query parameters to append to the URL and call back the delegate with the loaded objects. Remote objects will be mapped into instances of the specified object mappable class.
- (RKObjectLoader *)loadObjectsAtResourcePath:(NSString *)resourcePath queryParams:(NSDictionary *)queryParams objectClass:(Class<RKObjectMappable>)objectClass delegate:(NSObject<RKObjectLoaderDelegate> *)delegate
Declared In
RKObjectManager.h
objectLoaderForObject:method:delegate:
Returns an object loader configured for transmitting an object instance across the wire. A request will be constructed for you with the resource path & object serialization configured for you by the Router. This is the best place to begin work if you need a slightly different interaction with the server than what is provided for you by get/post/put/delete object family of methods. Note that this should be used for one-off changes. If you need to substantially modify all your object loads, you are better off subclassing or implementing your own RKRouter for dryness.
- (RKObjectLoader *)objectLoaderForObject:(NSObject<RKObjectMappable> *)object method:(RKRequestMethod)method delegate:(NSObject<RKObjectLoaderDelegate> *)delegate
Declared In
RKObjectManager.h
objectLoaderWithResourcePath:delegate:
Return an object loader ready to be sent. The method defaults to GET and the URL is relative to the baseURL configured on the client. The loader is configured for an implicit objectClass load. This is the best place to begin work if you need to create a slightly different collection loader than what is provided by the loadObjects family of methods.
- (RKObjectLoader *)objectLoaderWithResourcePath:(NSString *)resourcePath delegate:(NSObject<RKObjectLoaderDelegate> *)delegate
Declared In
RKObjectManager.h
postObject:delegate:
Create a remote mappable model by POSTing the attributes to the remote resource and loading the resulting objects from the payload
- (RKObjectLoader *)postObject:(NSObject<RKObjectMappable> *)object delegate:(NSObject<RKObjectLoaderDelegate> *)delegate
Declared In
RKObjectManager.h
putObject:delegate:
Update a remote mappable model by PUTing the attributes to the remote resource and loading the resulting objects from the payload
- (RKObjectLoader *)putObject:(NSObject<RKObjectMappable> *)object delegate:(NSObject<RKObjectLoaderDelegate> *)delegate
Declared In
RKObjectManager.h
registerClass:forElementNamed:
Register a resource mapping from a domain model class to a JSON/XML element name
- (void)registerClass:(Class<RKObjectMappable>)objectClass forElementNamed:(NSString *)elementNameOrKeyPath
Discussion
Configures the mapper by indicating that elements with the specified name or keyPath value map to the specified class. The mapper will appropriately map to a single object or a collection, depending on the type of object in the payload.
Declared In
RKObjectManager.h