Commit Graph

91 Commits

Author SHA1 Message Date
Blake Watters
479864902b Fixed all build warnings on OS X Framework target 2011-12-08 23:23:20 -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
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
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
Parker
99250475ad added Apache License headers to all files in ObjectMapping directory 2011-09-07 11:31:01 -04: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
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
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
ca91226129 Fix for incorrect delegate invocation on cache load. fixes #267 2011-08-01 21:54:04 -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
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
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
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
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
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
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
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
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
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
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
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
Blake Watters
9299cabc11 Implemented flexible logging solution utilizing the excellent LibComponentLogging library. 2011-06-11 20:25:28 -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
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
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
9af6a59c79 Initial implementation of documentation generation using the Appledoc parser. refs #48
* Cleaned up various mismatches in method signatures that were preventing documentation generation
* Removed naked ampersands from comments as they cause XML parser failures during docset generation via appledoc
2011-04-14 22:55:58 -04:00
Blake Watters
9593612aab Closes gh-47. Initial implementation of OS X build integrating changes submitted by Felix Holmgren (https://github.com/Felixyz/RestKit).
* Factored out display of alerts into RKAlert interface that hides the differences between UIKit and OS X Cocoa.
* Added macosx to supported platforms to enable build on OS X.
* Configured project to use conditional architectures to enable building on OS X and iOS from the same targets.
* Implemented a bare-bones OS X example app.
* Create `rake build` task for building RestKit against iOS and OS X SDK for quick testing.
2011-04-12 21:02:25 -04:00
Blake Watters
9dcd7f3022 Removed superclass call to didFinishLoad: in RKObjectLoader. Was resulting in duplicated dispatch of life-cycle requests. Fixes #44 2011-04-12 19:11:31 -04:00
Blake Watters
a648d26460 [#11477593] Implemented background request policies and Specs. This provides functionality for continuing a request in the background using an iOS background task.
Introduces four modes for handling background requests:
* RKRequestBackgroundPolicyNone - The default behavior replicating pre-background behavior. No special action is taken with regards to backgrounding.
* RKRequestBackgroundPolicyCancel - On transition to the background, requests with this policy set will be cancelled automatically and the delegate informed.
* RKRequestBackgroundPolicyContinue - Requests with this policy will be continued in the background after the app has been transitioned.
* RKRequestBackgroundPolicyRequeue - Requests with this policy will be cancelled and then immediately placed onto the queue for processing the next time the app is returned to the foreground.
2011-04-05 13:06:06 -04:00
Blake Watters
c90ec2770d Finished cleanup of HTTP AUTH and XML Support. Ready to tag 0.9.1 2011-03-28 23:29:06 -04:00
Blake Watters
69c051a57a Aligned target name with JSON parsers 2011-03-27 23:05:24 -04:00
Blake Watters
a298bc4dcf Fix build problems 2011-03-27 22:53:08 -04:00
Blake Watters
227f35a20d Merge branch '0.9' into xml-parser
Conflicts:
	Examples/RKTwitter/Classes/RKTwitterViewController.m
	README.md
	RestKit.xcodeproj/project.pbxproj
2011-03-27 22:29:19 -04:00
Blake Watters
2109fae1ba Finished cleaning up Core Data support. Happy with the new organization 2011-03-19 22:06:51 -04:00
Blake Watters
88a1b013fc Merge remote branch 'origin/0.9' into core-data-cleanup
Conflicts:
	Code/CoreData/CoreData.h
	Code/CoreData/RKManagedObjectStore.h
	Code/CoreData/RKManagedObjectStore.m
	Code/CoreData/RKObjectSeeder.h
	Code/CoreData/RKObjectSeeder.m
	Code/ObjectMapping/RKObjectLoader.m
	Code/ObjectMapping/RKObjectManager.m
	Code/ObjectMapping/RKObjectMapper.m
	RestKit.xcodeproj/project.pbxproj
2011-03-19 21:26:13 -04:00