RKRequestDescriptor Class Reference
Inherits from | NSObject |
Declared in | RKRequestDescriptor.h |
Overview
An RKRequestDescriptor
object describes an object mapping configuration that is used to construct the parameters of an HTTP request for an object. Request descriptors are defined by specifying the RKMapping
object that is to be used when object mapping an object into an NSDictionary
of parameters, the class of the type of object for which the mapping is to be applied, and an optional root key path under which the paramters are to be nested. Response descriptors are only utilized when construct parameters for an NSURLRequest
with an HTTP method of POST
, PUT
, or PATCH
.
Tasks
Creating a Request Descriptor
-
+ requestDescriptorWithMapping:objectClass:rootKeyPath:
Creates and returns a new
RKRequestDescriptor
object.
Getting Information About a Request Descriptor
-
mapping
The mapping specifying how the object being parameterized is to be mapped into an
propertyNSDictionary
representation. The mapping must have an objectClass equal to[NSMutableDictionary class]
. -
objectClass
The class of objects that the request descriptor is appropriate for use in parameterizing.
property -
rootKeyPath
The root key path that the paramters for the object are to be nested under. May be nil.
property
Using Request Descriptors
-
– matchesObject:
Returns
YES
if the given object is instance of objectClass or any class that inherits from objectClass, elseNO
.
Properties
mapping
The mapping specifying how the object being parameterized is to be mapped into an NSDictionary
representation. The mapping must have an objectClass equal to [NSMutableDictionary class]
.
@property (nonatomic, strong, readonly) RKMapping *mapping
Declared In
RKRequestDescriptor.h
Class Methods
requestDescriptorWithMapping:objectClass:rootKeyPath:
Creates and returns a new RKRequestDescriptor
object.
+ (instancetype)requestDescriptorWithMapping:(RKMapping *)mapping objectClass:(Class)objectClass rootKeyPath:(NSString *)rootKeyPath
Parameters
- mapping
The mapping to be used when parameterizing an object using the request descriptor. Cannot be nil and must have an objectClass equal to
[NSMutableDictionary class]
.
- objectClass
The class of objects for which the request descriptor should be used. Cannot be nil.
- rootKeyPath
The root key path under which paramters constructed using the response descriptor will be nested. If nil, the parameters will not be nested and returned as a flat dictionary object.
Return Value
A new RKRequestDescriptor
object.
Discussion
Warning: An exception will be raised if the objectClass of the given mapping is not [NSMutableDictionary class]
.
See Also
Declared In
RKRequestDescriptor.h
Instance Methods
matchesObject:
Returns YES
if the given object is instance of objectClass or any class that inherits from objectClass, else NO
.
- (BOOL)matchesObject:(id)object
Parameters
- object
The object to be matched against the receiver.
Return Value
YES
if the given object matches objectClass, else NO
.
Declared In
RKRequestDescriptor.h