Commit Graph

249 Commits

Author SHA1 Message Date
Blake Watters
412b0f9756 Work in progress on cleanup 2012-01-20 10:21:18 -05:00
Ray Fix
ab3ec5495f Leaks brought to my attention by the static analyzer. 2012-01-20 10:21:18 -05:00
Ray Fix
3d03959d06 Polish RKObjectPaginator.
Initialization
I need the object paginator's object loaders to 
know about the various header settings of 
the RKClient when it constructs them.  However,
the paginator should not depend on an RKObjectManager.
The proposed solution is to pass a block that lets
an outsider custom configure the object loaders
that get created.  The object manager shows how
it is done.

Error Handling
We don't want to have a separate set of error handling
if using a paginator versus using an RKObjectLoader.
When an error is encountered, the paginator should 
allow access to the underlying RKObjectRequest that
produced the error.

Cleanup
The contained object loader needs to nil out the delegate
before going away.

NSLogs changed to RKLog

Pagination computation
The page count can be computed when the pagination 
parameters are mapped.  Note you must use the ceil
operation to compute this value.  If there are 3.1 pages
that means there are 4 pages.
2012-01-20 10:21:18 -05:00
Blake Watters
fb41eb73ec Work in progress on responsibility cleanup 2012-01-20 10:21:18 -05:00
Blake Watters
254553dc7c Initial implementation of RKObjectPaginator 2012-01-20 10:21:18 -05:00
Brian Morton
0f3f3d5702 Add support for mapping an array to an NSOrderedSet. 2012-01-13 00:04:40 -08:00
Blake Watters
4d99d28a4d Merge pull request #477 from rayfix/fix-log-root-key-path
Fixed logging of root key path on object mapping. Remove TODO comment.
2011-12-16 21:23:21 -08:00
chethan
ea0cbed8dc Fixed logging of root key path on object mapping. Remove TODO comment that is done. 2011-12-16 18:20:24 -08:00
Julien Grimault
a1e2061106 Modified asserts in RKObjectLoader processMappingResult to allow synchronous requests. 2011-12-13 20:58:15 -05:00
Blake Watters
479864902b Fixed all build warnings on OS X Framework target 2011-12-08 23:23:20 -05:00
Blake Watters
6f68ffb342 Applied patch from Scott Penrose to handle issues with NSNull values mapped to Core Data properties. closes #436
Added RKLogWarning for aiding in further debugging. So far unable to trap this in a unit test, but have had
several complaints about the issue on the mailing list.
2011-12-02 09:27:23 -05:00
Blake Watters
8a39f93e62 Add support for handling 204 'No Content' responses. fixes #450 2011-12-02 09:27:22 -05:00
Blake Watters
563f5e909b Updated all example projects to build against the new project. Cleaned up header imports for flattened project structure 2011-12-02 09:26:36 -05:00
Blake Watters
5b718890ac Checking in work in progress on the library reorganization 2011-12-02 09:26:35 -05:00
Blake Watters
ceb7eb478a Merge pull request #425 from jsullivanlive/patch-1
Adding missing exception name
2011-12-01 16:45:08 -08:00
Aaron Crespo
6b8ab373ac Update Code/ObjectMapping/RKObjectMapping.m 2011-11-03 16:26:50 -03:00
James Sullivan
8282bdb644 Fixing missing exception name. Without it, no exception is printed to the console in debug mode and no stack trace persists, which makes it very hard to debug. 2011-10-27 21:57:19 -03:00
Blake Watters
cb694c3e77 Lowered logging level for NSNull collection from Warning to Debug. closes #422 2011-10-27 10:15:29 -03:00
Blake Watters
d75fd7d0b0 Refactored RKReachabilityObserver to work around issues with iOS 5 + host reachability and expand its capabilities. closes #408
* Added support for monitoring by IP address or hostname as well as local Wifi and Internet access generally
* Eliminated usage of synchronous calls to obtain reachability flags during status checks
* Reworked SystemConfiguration reachability callback to cache flags
* RKClient now monitors Internet access instead of hostname based reachability by default. baseURLReachabilityObserver eliminated in favor of reachabilityObserver. It is now a retain property that can be customized
* Queue suspension is now tied to the reachability observer rather than baseURL mutation
2011-10-19 08:51:37 -04:00
Blake Watters
23422c7f37 Expanded docs in RKObjectMappingProvider. Normalized some method signatures 2011-10-13 23:51:16 -04:00
Blake Watters
f527918b2a Implemented support for removing mappings from RKObjectMappingProvider by keyPath. Improved documentation on the mapping provider class. 2011-10-13 08:57:18 -04:00
Blake Watters
4b1db7a6f1 Improve assertion failure message when no serialization mapping is available and a put/postObject is attempted 2011-10-11 21:40:26 -04:00
Blake Watters
e1936103fd Check the type of destinationValue as well as sourceValue when determining the comparison selector to use. refs #343, refs #320
Hopefully this will fix the Core Data default attribute problem that I have been unable to recreate in unit tests.
2011-10-09 21:24:09 -04:00
Blake Watters
69e560d59c Fix for leaking object mapping queue references. fixes #390 2011-10-05 23:26:05 -04:00
Blake Watters
586034bae4 Add support for the use of nesting key attributes as the primaryKey in managed mappings.
This bug was causing duplication of objects in the store due to failed lookup of
existing objects. Added fix and test coverage for the use-case.
2011-10-05 10:50:52 -04:00
Blake Watters
a4d84aadf3 Use lastObject instead of objectAtIndex: to avoid exception during sanity check 2011-10-04 10:47:33 -04:00
Blake Watters
d94fcf665d Added sanity check that relationship mapping is not targeting a collection of collections. fixes #386
This can happen when using keyPaths to traverse an object graph and is hard to anticipate when
defining mappings. RestKit will now perform a sanity check before recursively performing
relationship object mapping operation and will log a warning if the relationship targets
a collection containing another collection. At the debug logging level, RestKit will log

The fix for such scenarios is to use KVC collection operators (such as @unionOfObjects,
@unionOfArrays, etc.) to flatten the collection out into a collection of dictionaries.
2011-10-01 11:52:51 -04:00
Blake Watters
da38149e44 Eliminated the use of @compatibility_alias to work around compiler issues reported on the mailing list 2011-09-29 10:10:35 -04:00
Blake Watters
e86d9375bd Added test coverage and fixes for cases where the parser returns nil, but no error occurred. fixes #365 2011-09-28 09:43:35 -04:00
Blake Watters
6011faeda5 Fix naked NSLog that should be a RKLogDebug. fixes #376 2011-09-27 08:39:29 -04:00
Blake Watters
30b08ba85b Added default parser registration for text/xml MIME Type. fixes #370 2011-09-23 09:49:54 -04:00
Blake Watters
144533cdd5 Renamed RKObjectDynamicMapping to RKDynamicObjectMapping to better mesh with Cocoa idioms. fixes #354
The old class name has been aliased for backwards compatibility.
2011-09-20 13:18:09 -04:00
Blake Watters
0c96aedc85 Fix use of reserved 'class' keyword that breaks import into Objective-C++. fixes #355
Added basic spec file that imports the public headers into an Objective-C++ source file.
2011-09-20 13:04:29 -04:00
Blake Watters
70c73f2981 Fixed issue with order dependence in Core Data connections. fixes #173
Since OM 2.0 connection of relationships happened during the object mapping operation
instead of aggregately at the end of the process. In this commit, we have introduced a lightweight
queue for deferring portions of the mapping operation until a larger aggregate mapping has completed.

The changes are as follows:
* Introduced RKMappingOperationQueue for queueing portions of mapping. This is a synchronous queue modeled off
of NSOperationQueue that does NOT use threading (for Core Data friendliness).
* RKObjectMappingOperation now has a RKMappingOperationQueue queue property that defaults to nil
* RKObjectMappingOperation instances built via RKObjectMapper will has a mapping operation queue
assigned to the property.
* If a queue is present, RKManagedObjectMappingOperation will use it to defer the connection of relationships.
* At the end of an RKObjectMapper process, the mapping operation queue used by all mapping operations created
during the process will be executed. This allows all relationships to be connected after all object creation
has completed.

The queue is general purpose, though currently only used for the connection of relationships.
2011-09-20 12:02:50 -04:00
Blake Watters
91a6e9423e Added convenience methods and docs for mapping NSSet and NSArray attribute collections. fixes #285 2011-09-19 21:03:02 -04:00
Blake Watters
4b287a5b24 Added ability to overload the params on object loaders composed by the object manager. fixes #352 2011-09-19 19:54:58 -04:00
Greg Combs
e33d9e519a Unfortunately introduced an error while fixing #342 in commit a1b2201 in the RKObjectMappingProvider where retrieving mappings by class was broken, partially, yet passed unit tests. This fixes the bug and covers the gap in the tests. 2011-09-18 21:06:19 -05:00
Greg Combs
c49310162e RKPathMatcher can now accommodate non-KVM dots that follow parameter keys in the pattern. Where /:filename.json would fail before, we use special escapes like /:filename\.json ... this fixes #349. Thanks @jverkoey for the fix and @coryalder for the catch. 2011-09-16 15:35:27 -05:00
Greg Combs
62d7042ebc Merge pull request #334 from parkerboundy/add-apache-license
Add the Apache License to headers (Issue #145) Closes #145.  Thanks @parkerboundy.
2011-09-14 21:56:15 -07:00
Greg Combs
a1b2201f2a Fixes a crash in RKObjectMappingProvider where objectMappingsForClass is called after some dynamic mappings have been registered in the provider. Fixes #342. Thanks to @bjornjonsson 2011-09-14 20:32:37 -05:00
Greg Combs
3006516794 Merge pull request #347 from bjornjonsson/master
Fix of RKObjectMappingOperation does not respect forceCollectionMapping (Issue #341) This fixes #341.  A solid pull request with good tests.  I ran through it prior to his new test coverage last night and it looked good with no discernible side-effects.  With the new test coverage, the added code gets exercised appropriately.
2011-09-14 17:20:10 -07:00
Björn Jonsson
90ef91e890 Fix of RKObjectMappingOperation does not respect forceCollectionMapping (Issue 341)
Includes test cases and fixtures
2011-09-14 22:50:03 +02:00
Greg Combs
fc5f2b38be Minor cleanup of some whitespace after recent feature pull requests 2011-09-13 01:30:43 -05:00
Greg Combs
6dd1e8da40 Now gracefully handles escaping interpolated resource paths in RKRouter, RKMakePathWithObject, and RKPathMatcher. By adding an encoding handler to SOCKit, we now (by default, but optionally) add percent escapes to each object's property value while it's being interpolated into a resource path pattern, like /stuff/things/:others?apikey=:apikey ... that way it won't brutally mangle the slashes and question marks and ampersands that exist in the resource path pattern, while at the same time properly escaping those same characters when they occur inside the object's property value. Closes #221 2011-09-13 00:50:55 -05:00
Blake Watters
12bacf9be4 Removed references to sharedQueue from Advanced Tutorial sources 2011-09-08 09:38:26 -04:00
Parker
99250475ad added Apache License headers to all files in ObjectMapping directory 2011-09-07 11:31:01 -04:00
Greg Combs
e38562ffce Introduces RKPathMatcher. This is basically a dressed up front end to jverkoey/SOCKit. Using this will make it very easy to do complex things with patterns, resource paths, and object property interpolation thereof. Whereas RKMakePathWithObject() once took parenthesized parameters like "/stuff/(things)" it now uses colons like "/stuff/:things". It has specs and updated header docs where appropriate. Closes #305. 2011-09-06 15:51:18 -05:00
Blake Watters
4299cab994 Added convenience accessors on RKObjectManager for the requestCache and requestQueue. Cleaned up some styling and normalized method names. 2011-09-06 11:36:50 -04:00
Blake Watters
2ccc44954a Configured default locale to en_US_POSIX for default date formatters. closes #273 2011-09-05 17:54:07 -04:00
Blake Watters
54007c78d4 Reworked Brendan Ribera's contributions around time zone handling to eliminate the use of transient
NSDateFormatters, added a preferredDateFormatter for use when serializing dates to strings,
replaced the use of the description method for date encoding to strings with invocation of the
preferredDateFormatter, added new attribute transformation strategy from NSDate -> NSString properties
(also using the preferred date formatter), and provided customization support for date handling globally
and on a per-mapping basis. closes #200, closes #313, closes #309, closes #308
2011-09-05 17:25:43 -04:00