Commit Graph

222 Commits

Author SHA1 Message Date
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
Blake Watters
6cc7f1e4d6 Added test coverage for queue loading count being decremented when the response is unmappable. fixes #230, fixes #286 2011-09-03 17:29:58 -04:00
Blake Watters
d9d0f7a650 Eliminated the global sharedQueue in favor of allowing each RKClient to own its a private queue. This eliminates problems where multiple clients are tracking reachability notifications and mutating the suspension state on a single queue. If you want to use a single queue across multiple RKClient instances, you can assign a single queue to both and worry about suspension and reachability yourself. fixes #278 2011-09-03 15:52:45 -04:00
Blake Watters
c4a946c5bf Expanded documentation of objectLoaderDidLoadUnexpectedResponse: for clarity of additional use-cases beyond HTTP status code. 2011-08-28 16:00:36 -04:00
Jeff Arena
aceb75200a Fix for issues setting many-to-many relationships on NSManagedObjects, as well as some additional test coverage for the issue. fixes #271 2011-08-27 21:00:19 -04:00
Blake Watters
07830b5d87 Merge branch 'numbers-can-map-to-strings' of https://github.com/crayment/RestKit into crayment-numbers-can-map-to-strings
Conflicts:
	Code/ObjectMapping/RKObjectMappingOperation.m
	Specs/ObjectMapping/RKObjectMappingOperationSpec.m
2011-08-27 19:32:35 -04:00
Nolan Waite
8520d3e28b Transform numbers to decimal numbers. 2011-08-25 23:15:07 -04:00
Blake Watters
1f66ce7e46 Added support for mapping a single object into a destination collections. fixes #310 2011-08-25 22:21:54 -04:00
Blake Watters
84032d9aa6 De-emphasized the use of the sharedQueue and improved management of queue suspension state when changing out the baseURL on RKClient. This should prevent the queue from becoming suspended beyond the life of an RKClient that suspended it. Queues are now also properties on a per-client and per-request basis, so it is easier to segregated parts of your app into different queues. The relationship between RKRequest and RKRequestQueue should be decoupled at some point. 2011-08-18 11:48:37 -04:00
Blake Watters
6f59c767f9 Removing accidentally committed NSLog 2011-08-15 08:57:57 -04:00
Blake Watters
2e430644d9 Added support for using NSEntityDescription to lookup property types for NSManagedObject attribute and relationships. This enables mapping type transformations on mappings defined against Core Data entities instead of concrete subclasses. fixes #233 2011-08-14 23:21:51 -04:00
Blake Watters
47c78b181c Adding trace mapping for RKObjectMappingOperation 2011-08-14 21:25:13 -04:00
Cody Rayment
46fc65efb3 Allow numbers to map to strings 2011-08-10 00:08:31 -06:00
Ray Fix
0a90ce964d fix small doc typo 2011-08-08 15:15:49 -07:00
Blake Watters
ca91226129 Fix for incorrect delegate invocation on cache load. fixes #267 2011-08-01 21:54:04 -04:00
Blake Watters
4e03ba7bef Renamed Polymorphic mapping to dynamic mapping after consulting with the community. Dropped abstract superclass in favor of a RKObjectMappingDefinition protocol. Caught missing cases with dynamic object mapping + targetObject. Updated docs and method signatures to reflect the updates. 2011-07-31 19:37:42 -04:00
Blake Watters
eab35ef3f7 Updated polymorphic mapping to use valueForKeyPath. Slight updates to the documentation. refs #105 2011-07-30 16:18:14 -04:00
Blake Watters
670234b775 Added support for polymorphic object mapping (Github #105, #244). This enables you to dynamically map objects to different destination classes or using different mapping strategies via configuration or callbacks. See Docs/Object Mapping.md for details.
Other changes include:
* Eliminated the RKObjectFactory protocol and implementations. Object mapping instances themselves are
now responsible for instantiating target objects for mapping.
* Introduced RKObjectAbstractMapping superclass for RKObjectMapping and RKObjectPolymorphicMapping.
* Updated example applications to use block object loaders (RKTwitter and RKTwitterCoreData)
* Refactored method signatures of RKObjectMapper, RKObjectMapping, and RKObjectMappingProvider to reflect the
existence of abstract mapping types. This was necessary to make polymorphic mappings integrate cleanly.
* Fixed overlap in RestKit error domains between network and object mapping. fixes #208
2011-07-30 16:00:36 -04:00
Evan Cordell
072e1ee58b Made the appropriate changes to the RestKit project to load NextiveJSON, added record to RKParserRegistry 2011-07-28 18:00:41 -04:00
Blake Watters
f547439254 Merge pull request #247 from rehos/patch-1
Use the actual class instead of hardcoded RKObjectManager class
2011-07-28 14:27:20 -07:00
Blake Watters
46ab501cab Introduced loadObjectsAtResourcePath:delegate:block: helper 2011-07-28 16:41:41 -04:00
Blake Watters
e6e528fcf1 Improved the flexibility of the block loaders significantly by allowing them to override the object mapping and routing selection. Made sendObject:method:delegate:block private and introduced public sendObject:delegate:block method instead. Wrote some basic specs for overriding the router. 2011-07-28 13:56:16 -04:00
Blake Watters
afc6167554 Merge pull request #248 from dhilus/master
Requests were not sent at all after 5 requests with 40x HTTP Code response.
2011-07-27 05:44:33 -07:00
Blake Watters
bd29ee038b Added non-underscored class name for NSCFBoolean matches in transformation from Boolean to String 2011-07-27 08:00:15 -04:00
Blake Watters
6e87cd5ffd Add missing release for rootKeyPath ivar 2011-07-27 07:59:08 -04:00
Rémy SAISSY
2bdf855fbe finalizeLoad:error: call added in handleResponseError thus avoiding non finalized requests when receiving 40x HTTP response to requests. 2011-07-26 17:45:39 +02:00
rehos
b9d29b8759 Use the actual class instead of hardcoded RKObjectManager class in objectManagerWithBaseURL: 2011-07-26 16:01:43 +03:00
Blake Watters
ee5457105e Fix memory leak of mapping provider 2011-07-25 17:58:03 -04:00