Commit Graph

201 Commits

Author SHA1 Message Date
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
Blake Watters
a0cb33d391 Updates comments on inferMappingsFromObjectTypes and add documentation to the Object Mapping document. Defaulted it to off
as it can complicate things for KVC mappable data.
2011-07-24 12:28:42 -04:00
Blake Watters
3a5354c4a0 Added specs around behavior of empty mappable payloads and RKObjectLoaderDelegate invocations. Fixed issue where empty hashes ({}) would result in no delegate methods being invoked. fixes #225 2011-07-24 01:25:50 -04:00
Blake Watters
570b13ca07 Updated Object Mapping documentation, added support for inferring object mappings based off of the type of the object used in postObject:, putObject:, etc. Made KVC validation optional. 2011-07-23 23:47:03 -04:00
Blake Watters
80366afa84 Added Object Mapping block helpers to RKObjectManager and RKObjectMapping. These enable you to perform ad-hoc object mapping very easily. Extended RKObjectRouter to match on superclasses if no specific route is found. This is helpful when using mocked objects with frameworks like Kiwi. fixes #238 2011-07-23 23:04:16 -04:00
Blake Watters
f1b0815e1a Fixes to some violations of the contracts around delegate methods and background threads 2011-07-21 22:01:47 -04:00
Blake Watters
73fb461a8b Reworked object mapping behaviors to better accommodate situations where the server side responds with a successful status code and a payload that does not contain any mappable attributes or relationships. We now consider this to be successful. If a mapping operation is performed that does not result in any mappings being applied, it will return NO without setting an error. If an instance of RKObjectMapper is invoked that does not find any mappable content in the payload, this will result in an unmappable content error. The object loader guards against this by not attempting to map any empty payloads. This should ensure that you only get the unmappable content error if you have asked RK to load and map a payload it cannot find an object mapping for. 2011-07-07 09:53:46 -04:00
Blake Watters
c171bed7d3 Don't generate an unmappable content error if a successful status code is returned along with an empty response body. This enables the use of the status code to indicate success without any content for mapping. In these cases, we wrap the targetObject of the loader into a RKObjectMappingResult at the @"" keyPath so that the delegates are invoked as expected. closes #189 2011-07-06 22:01:10 -04:00
Blake Watters
42067b9036 Avoid exception from nil errors during object loader error reporting. fixes #191 2011-07-06 17:04:18 -04:00
Blake Watters
82ce444489 Unwind nil behavior introduced in previous commit and add test coverage for asObject behaviors. 2011-07-05 17:22:27 -04:00
Blake Watters
dddc4c3d0a Fix for crash when coercing an empty object mapping result set into a singular result with asObject. closes #190 2011-07-05 16:56:34 -04:00
Blake Watters
546eb627cd Respect the root keyPath when constructing a temporary object mapping provider. Covers the case where an object mapping targeting nested content is being directly specified. 2011-07-02 11:04:56 -04:00
Blake Watters
3b89382da7 Fix broken test around creation of request serialization 2011-06-30 13:11:31 -04:00
Jeremy Ellison
eea75bdb3c Allow Timeout caching and ETag caching to play nice with each other. Update the internal cache date when we get a 304 back. 2011-06-30 12:54:03 -04:00
Duncan Lewis
403bf29f57 Added helper functions to RKObjectSerializer to map local objects into json 2011-06-30 12:28:28 -04:00
Blake Watters
7053a8ca97 Add support for sending objects of one type and getting back another. Target object has been disambiguated into sourceObject and targetObject
and act independently with regards to serialization and destination mapping. When you leverage the getObject:mapResponseWith: flavor of methods,
the type of your sourceObject is checked with the destination type of the object mapping. If they agree, it is assumed that you are trying to update
the object with the results of the mapping and targetObject is set appropriately. If they do not match, the targetObject is set to nil so that new
objects will be loaded. closes #161, #168
2011-06-30 10:33:39 -04:00
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