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

Getting Information About a Request Descriptor

  •   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
  •   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

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

objectClass

The class of objects that the request descriptor is appropriate for use in parameterizing.

@property (nonatomic, strong, readonly) Class objectClass

Declared In

RKRequestDescriptor.h

rootKeyPath

The root key path that the paramters for the object are to be nested under. May be nil.

@property (nonatomic, copy, readonly) NSString *rootKeyPath

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].

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