Commit Graph

157 Commits

Author SHA1 Message Date
Blake Watters
2ac45f5ccc Refactored object loaders to provide easier support for non-nested JSON responses. There are new flavors of getObject:, postObject:, etc.
that allow the developer to explicitly specify the object mapping to use for processing the response. closes #168
2011-06-30 10:33:39 -04:00
Blake Watters
2e7adbdc1e Restore the managed object cache functionality and add test coverage so it does not break again. fixes #167 2011-06-29 22:08:35 -04:00
Blake Watters
5a2f937a52 Reworked notifications for consistency with Cocoa idioms. Simplified code paths through the queue. Tweaked the logging for easier info at the Debug level without having to drop down to Trace. 2011-06-29 16:18:18 -04:00
Blake Watters
853704b2fd Rework notifications to allow request queue to observe only the requests it dispatches instead of all of them. Fixes incorrectly decrementing loading count. 2011-06-29 15:36:10 -04:00
Blake Watters
6faa525344 Added specs and support for either failing out the mapping operation or skipping over an attribute depending on key/value validation response. If NO is returned and a validation error is returned, the mapping operation will fail. If NO is returned without an error, the attribute will be skipped and a warning will be logged. You can also mutate the values. closes #166 2011-06-29 15:07:43 -04:00
Scott Penrose
41071ad61a Added Key-Value validation checking during object mapping operation. If you return NO it will continue mapping but skip that key path. If you set the error it will error out of object mapping operation. Issue #166 2011-06-29 14:11:00 -04:00
Blake Watters
4b4d3d1af6 Remove dead RKRailsRouter code. fixes #178 2011-06-29 14:08:21 -04:00
Blake Watters
2a8ece97c1 Improvements to reachability, the request queue, logging throughout the network layer, decoupling of components via notifications, reliability improvements for unit tests in the cache layer. Improved thread-local cleanup routines inside the managed object store. Changing base URL's is now more reliable. fixes #171, #158, #113, #104, #102 2011-06-29 13:28:14 -04:00
Blake Watters
537a9d2fd1 Removed NSAssert and added logging about cases in which there is no error object or a collection is coerced into a single result. closes #159 2011-06-28 19:41:30 -04:00
Blake Watters
3dfbaf1810 Updated to support setting default value instead of nil when an attribute is missing in the payload. For Core Data backed models, we consult the entity definition to obtain the default value. closes #117 2011-06-28 15:22:04 -04:00
Blake Watters
851df3bcba Changed signature of willMapData: to allow you to completely replace the mappableData. 2011-06-28 11:46:03 -04:00
Blake Watters
0949337749 Allow modification of the data in objectLoader:willMapData: by creating a mutable copy of the parsed data if the delegate method is implemented. 2011-06-27 16:37:55 -04:00
Blake Watters
64db97ce60 Helper methods for retrieving attribute and relationship mappings by attribute/relationship keyPath. Useful for customizing serialization mappings that were built using inverseMapping. 2011-06-22 10:43:42 -04:00
Blake Watters
8ad1a84281 Reworked object loader to check if a response is mappable even if it is an error. We had an assertion failure that could be triggered by trying to load a remote error payload in a non-mappable format (i.e. text/html). 2011-06-21 13:27:15 -04:00
Blake Watters
0954d4a063 Fixing more memory leaks 2011-06-20 15:03:35 -04:00
Blake Watters
3204682f72 Added object mapping management to the mapping provider for folks who don't have keyPaths. Deprecated setMapping:forKeyPath: in favor of setObjectMapping:forKeyPath: for consistency with the other method signatures. 2011-06-20 10:49:40 -04:00
Victor Kryukov
714be36907 Code cleanup: initWithDictionary is used in RKObjectLoader and should be declared 2011-06-20 10:49:39 -04:00
Victor Kryukov
00ee7e93c3 Code cleanup: **error may be null as per coding standards in 'Creating and Returning NSError Objects' (found with Analyzer) 2011-06-20 10:49:39 -04:00
Jeremy Ellison
de684989db Fix memory leaks in -reset on RKObjectLoader and RKManagedObjectLoader. 2011-06-20 09:12:56 -04:00
Blake Watters
3bf4b7bc0f Implemented nested mapping for structures similar to the BuildBot JSON structure. fixes #112 2011-06-17 15:36:28 -04:00
Daniel Hammond
e9e4c83630 Merge branch 'restkit-sprint' of github.com:twotoasters/RestKit into restkit-sprint 2011-06-16 21:17:31 -04:00
Daniel Hammond
d9fc311433 Remove objects persisted to Core Dataduring postObject: when there is an error (Fix Issue #125) 2011-06-16 21:17:14 -04:00
Jeremy Ellison
ae68829ec4 transform booleans to strings 2011-06-16 19:30:10 -04:00
Blake Watters
323d5e30b1 Add support for mapping from NSNumber to NSDate by coercing to a time interval since 1970. fixes #141 2011-06-16 17:33:21 -04:00
Blake Watters
1137aff165 Tweaks to comments 2011-06-16 17:15:07 -04:00
Blake Watters
a75ace87d0 Deprecated RKObjectManager methods that use queryParams. Added NSString category for achieving the same results without bloating the API 2011-06-16 17:04:34 -04:00
Blake Watters
d84088277e Expand commentary around registerMapping 2011-06-15 11:14:57 -04:00
Blake Watters
5f7b8559cd Only build a serialization if we are a POST or a PUT 2011-06-15 10:29:11 -04:00
Blake Watters
420d20384f Add support for mapping yes and no to NSNumber boolean values 2011-06-15 09:59:45 -04:00
Blake Watters
8e5fa664e8 Cleaned up miscellaneous artifacts from squashing object mapping 2.0 2011-06-11 20:34:10 -04:00
Blake Watters
27ea307816 Fix crash in RKCatalog. Suppress warning about symbol visibility during linking. 2011-06-11 20:27:33 -04:00
Ed McManus
ecf808af1a Added boolean "reversible" property to RKObjectRelationshipMapping. This can be used to break cyclical
relationships in the object mapping graph. Relationships can be optionally included in an inverse mapping
generation for serialization purposes.
2011-06-11 20:25:28 -04:00
Blake Watters
9299cabc11 Implemented flexible logging solution utilizing the excellent LibComponentLogging library. 2011-06-11 20:25:28 -04:00
Blake Watters
7bf3e0f273 Added support for mapping boolean strings to NSNumber with values t or f in addition to true and false. refs #130 2011-06-11 19:31:21 -04:00
Blake Watters
f2ceefa012 Merge Request Queue (See issue #75):
* Introduces RKRequestCache for cacheing responses (supports ETag conditional GET, use cache if available, use cache on error, etc.) closes #75
    * Updates to Three20 layer to eliminate need for intermediary TTTableItem classes closes #76
    * Fixes to ensure iOS 3.x compatability:
        * Switched compiler to Clang
        * Updated conditional checks for UIBackgroundTask symbols to ensure runtime safety on iOS 3.x
        * Removed unnecessary linkage against UIKit and CoreFoundation from library targets
    * Fix for issue where RKRequest objects could become stuck in infinite loop within RKRequestQueue loadNextInQueue if you start
      a request and then cancel immediately. On cancel only decrement loadCount if the request has start loading. refs #122
2011-06-11 19:28:44 -04:00
Blake Watters
f3c0995d5e Implementation of Object Mapping 2.0 design:
* Removed RestKit from inheritance hierarchy
  * Mappings are implemented as concrete classes
  * Mapper is much more flexible & powerful
  * Much more robust error handling
  * Serialization is reimplemented as an object mapping operation
  * Added ability to serialize to JSON natively
  * Reworked Core Data integration
  * Simplified the codebase substantially
2011-06-11 19:26:56 -04:00
Pat Shields
eecf87e71a Don't leak object passed in to loader. 2011-05-27 12:46:36 -04:00
Blake Watters
4889ff9b5f Removed use of Objective-C block in new serialization code from Andras 2011-05-04 09:59:47 -04:00
Andras Hatvani
d6d92fc6d4 * Implemented relation mapping in RKDynamicRouter
* Added specs covering the functionality
2011-05-04 12:27:50 +02:00
Blake Watters
4321da03b1 Expanded specs and began migrating all the content for testing out in the Fixtures directory. Fixtures is now the root for the Sinatra app and there are new helpers in RKSpecEnvironment.m. Added specs for several users use cases from the mailing list. Introduced a new warning when attempting to map did not set any properties. 2011-05-02 20:57:18 -04:00
Blake Watters
87d0cd13de Added support for registering object class mappings as keyPaths in addition to element names. closes #82 2011-04-28 13:09:50 -04:00
Blake Watters
308b6c5dd2 Updates to RKObjectLoader to fix issues where keyPath was not always respected and willSendForObjectLoader: not invoked as expected. Expanded spec coverage to fix these issues. fixes #80, fixes #81 2011-04-28 00:05:55 -04:00
Blake Watters
a1aa5fce94 Merged pull request #63 from andr8w/target-object-keypath.
Minor changes to use keyPath and willSendWithObjectLoader when a targetObject is set.
2011-04-27 20:02:29 -07:00
Blake Watters
ff2367d284 Moved query path appending to RKPathAppendQueryParams for convenience. Deprecated RKClient flavor. 2011-04-27 09:05:18 -04:00
Blake Watters
c35d0bab1d Implemented substantial catalog example application covering advanced usage of RestKit:
* Cleaned up remaining warnings about if (self = [super init])
* RKParamsExample - Highlights multi-part uploads
* RKRequestQueueExample - Working with the request queue
* RKBackgroundRequestExample - Examples of using the background policies for backgrounding requests
* RKReachabilityExample - Shows how to work with the reachability observer
* RKRelationshipMappingExample - Shows how to map related objects from JSON into an object graph
* RKCoreDataExample - Shows the basics of using RestKit's Core Data examples

Also rearranged dispatch of RKRequest delegate method for didStartLoad: to ensure requeue callbacks get invoked in a timely manner. refs #62
2011-04-22 11:28:56 -04:00
Andrew Newdel
e277e636f8 Add a modified handleTargetObject implementation from RKManagedObjectLoader to give RKObject a chance to respond to willSendWithObjectLoader. 2011-04-21 19:32:29 -04:00
Andrew Newdel
bbce5abfd4 Use the keyPath property to map a subset of the response for a single target object. 2011-04-21 19:24:41 -04:00
Blake Watters
acf7352b40 Added support for mapping an array of objects when given a target object class and element registration is being used as well. fixes #60 2011-04-20 16:17:00 -04:00
Blake Watters
f55073ecce Merge branch 'master' of https://github.com/Vossy/RestKit into 59-url-mapping-support 2011-04-20 08:29:00 -04:00
Justin Voss
952096b289 Added support for mapping NSURL properties. Fixes #52 2011-04-19 19:14:52 -05:00