ActiveResourceKit
v1.2 (498.0)
|
#import <ARService+Private.h>
Instance Methods | |
(id< ARFormat >) | - defaultFormat |
(NSString *) | - defaultElementName |
(NSString *) | - defaultCollectionName |
(NSString *) | - defaultPrimaryKey |
(NSString *) | - defaultPrefixSource |
(void) | - findEveryWithOptions:completionHandler: |
(NSArray *) | - instantiateCollection:prefixOptions: |
(ARResource *) | - instantiateRecordWithAttributes:prefixOptions: |
Instantiates a resource element (a record) using the given attributes and prefix options. | |
(NSSet *) | - prefixParameters |
(void) | - splitOptions:prefixOptions:queryOptions: |
(void) | - get:completionHandler: |
Sends an asynchronous GET request. Used to find a resource. | |
(void) | - delete:completionHandler: |
Used to delete resources. Sends an asynchronous DELETE request. | |
(void) | - put:body:completionHandler: |
Sends an asynchronous PUT request. | |
(void) | - post:body:completionHandler: |
Sends an asynchronous POST request. | |
(void) | - head:completionHandler: |
Used to obtain meta-information about resources, whether they exist or their size. Sends an asynchronous HEAD request. | |
(void) | - requestHTTPMethod:path:body:completionHandler: |
Submits an asynchronous request, returning immediately. | |
(ARConnectionCompletionHandler) | - decodeHandlerWithCompletionHandler: |
Answers a decoding handler which, in turn, after decoding, invokes another given completion block. | |
Definition at line 57 of file ARService+Private.h.
- (ARConnectionCompletionHandler) decodeHandlerWithCompletionHandler: | (ARServiceRequestCompletionHandler) | completionHandler |
Answers a decoding handler which, in turn, after decoding, invokes another given completion block.
Active Resource Kit methods utilise this common response block for decoding according to the required format. In fact, the decoding does a little more than just decode the format. It also handles URL response to HTTP response type casting. The latter carries more information including header fields and HTTP status code.
Extends class ARService.
Definition at line 194 of file ARService+Private.m.
- (NSString *) defaultCollectionName |
Extends class ARService.
Definition at line 52 of file ARService+Private.m.
- (NSString *) defaultElementName |
Extends class ARService.
Definition at line 47 of file ARService+Private.m.
- (id< ARFormat >) defaultFormat |
Extends class ARService.
Definition at line 42 of file ARService+Private.m.
- (NSString *) defaultPrefixSource |
Extends class ARService.
Definition at line 62 of file ARService+Private.m.
- (NSString *) defaultPrimaryKey |
Extends class ARService.
Definition at line 57 of file ARService+Private.m.
- (void) delete: | (NSString *) | path | |
completionHandler: | (ARServiceRequestCompletionHandler) | completionHandler | |
Used to delete resources. Sends an asynchronous DELETE request.
Extends class ARService.
Definition at line 163 of file ARService+Private.m.
- (void) findEveryWithOptions: | (NSDictionary *) | options | |
completionHandler: | (ARHTTPResponse *response, NSArray *resources, NSError *error) | completionHandler | |
Extends class ARService.
Definition at line 67 of file ARService+Private.m.
- (void) get: | (NSString *) | path | |
completionHandler: | (ARServiceRequestCompletionHandler) | completionHandler | |
Sends an asynchronous GET request. Used to find a resource.
When the response successfully arrives, the format decodes the data. If the response body decodes successfully, finally sends the decoded object (or objects) to your given completion handler. Objects may be hashes (dictionaries) or arrays, or even primitives.
Extends class ARService.
Definition at line 158 of file ARService+Private.m.
- (void) head: | (NSString *) | path | |
completionHandler: | (ARServiceRequestCompletionHandler) | completionHandler | |
Used to obtain meta-information about resources, whether they exist or their size. Sends an asynchronous HEAD request.
Extends class ARService.
Definition at line 178 of file ARService+Private.m.
- (NSArray *) instantiateCollection: | (NSArray *) | collection | |
prefixOptions: | (NSDictionary *) | prefixOptions | |
Instantiates a collection of active resources given a collection of attributes; collection here meaning an array. The collection argument specifies an array of dictionaries. Each dictionary specifies attributes for a new active resource. Answers an array of newly instantiated active resources.
Extends class ARService.
Definition at line 95 of file ARService+Private.m.
- (ARResource *) instantiateRecordWithAttributes: | (NSDictionary *) | attributes | |
prefixOptions: | (NSDictionary *) | prefixOptions | |
Instantiates a resource element (a record) using the given attributes and prefix options.
The implementation looks for a class matching the element name. It converts the element name to class name by camel-casing the name. The answer becomes an instance of that class if the class exists and derives from ARResource. Otherwise the answer is a plain instance of ARResource.
Extends class ARService.
Definition at line 105 of file ARService+Private.m.
- (void) post: | (NSString *) | path | |
body: | (NSData *) | data | |
completionHandler: | (ARServiceRequestCompletionHandler) | completionHandler | |
Sends an asynchronous POST request.
POST is not idempotent.
Extends class ARService.
Definition at line 173 of file ARService+Private.m.
- (NSSet *) prefixParameters |
Answers a set of prefix parameters based on the current prefix source. These constitute the current set of prefix parameters: an array of strings without the leading colon. Colon immediately followed by a word marks each parameter in the prefix source.
Extends class ARService.
Definition at line 117 of file ARService+Private.m.
- (void) put: | (NSString *) | path | |
body: | (NSData *) | data | |
completionHandler: | (ARServiceRequestCompletionHandler) | completionHandler | |
Sends an asynchronous PUT request.
PUT is idempotent, meaning that multiple PUT requests result in an identical resource state. There should be no side effects. PUT really amounts to an “upsert” database operation where it updates the resource if it already exists but alternatively creates the resource if it does not already exist.
Extends class ARService.
Definition at line 168 of file ARService+Private.m.
- (void) requestHTTPMethod: | (NSString *) | HTTPMethod | |
path: | (NSString *) | path | |
body: | (NSData *) | data | |
completionHandler: | (ARServiceRequestCompletionHandler) | completionHandler | |
Submits an asynchronous request, returning immediately.
Constructs a request object and asynchronously transmits it to the remote RESTful service. The completion handler executes in the resource service's operation queue, or the current queue (the operation queue running at the time of the request) if the resource service has no queue.
The completion handler receives three arguments: the HTTP response, the decoded object and any error. The decoded object derives from the response body, decoded according to the service format. Decoding itself can encounter errors. If successful, the completion handler receives a non-nil object and a nil
error. If the response is not an HTTP-based response, the completion handler receives a nil
response argument and an ARResponseIsNotHTTPError.
Extends class ARService.
Definition at line 183 of file ARService+Private.m.
- (void) splitOptions: | (NSDictionary *) | options | |
prefixOptions: | (NSDictionary **) | outPrefixOptions | |
queryOptions: | (NSDictionary **) | outQueryOptions | |
Splits an options dictionary into two dictionaries, one containing the prefix options, the other containing the leftovers, i.e. any query options.
Extends class ARService.
Definition at line 128 of file ARService+Private.m.