-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
764 changed files
with
93,886 additions
and
2,372 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
[submodule "Vendor/RestKit"] | ||
path = Vendor/RestKit | ||
url = https://github.com/RestKit/RestKit.git | ||
This file was deleted.
Oops, something went wrong.
Submodule RestKit
deleted from
d3cad8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rvm use 1.9.2@RestKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
RestKit Credits | ||
=============== | ||
|
||
RestKit was originally developed in the summer of 2009 under the name OTRestFramework | ||
as a Ruby on Rails specific object mapper for XML data. In early 2010 the framework was | ||
rebranded as RestKit and evolved into a general purpose HTTP toolkit and object mapping | ||
system. | ||
|
||
RestKit is available as an Open Source package under the terms of the Apache License (see | ||
LICENSE for details). | ||
|
||
## Original Author | ||
* Blake Watters (blakewatters) @blakewatters | ||
|
||
## Core Team | ||
* Jeff Arena (jeffarena) | ||
* Gregory Combs (grgcombs) | ||
* Brian Morton (bmorton) | ||
|
||
## Web Designer | ||
* Adit Shukla (aditshukla) | ||
|
||
## Contributors | ||
#### Version 0.9.3 and earlier | ||
* Jeremy Ellison (jeremyellison) | ||
* Daniel Hammond (danielrhammond) | ||
* Marc Weil (aspir) | ||
* Pat Shields (pashields) | ||
* Tim Kerchmar (timkerchmar) | ||
* Rachit Shukla (rachitshukla) | ||
* Adam Hinz (ahinz) | ||
* Stefan Eletzhofer (seletz) | ||
* Peter Marks (tassock) | ||
* Chad Podoski (chadpod) | ||
* Andras Hatvani (andrashatvani) | ||
* Ed McManus (emcmanus) | ||
|
||
#### Version 0.10.0 | ||
* Christopher Swasey (endash) | ||
* Aneil Mallavarapu (amallavarapu) | ||
* Rui D Lopes (ruidlopes) | ||
* Robert Altman (inquinity) | ||
* Beat Besmer (besi) | ||
* Scott Penrose (spenrose) | ||
* Charlie Savage (cfis) | ||
* Jawwad Ahmad (jawwad) | ||
* John Stallings (jstallings) | ||
* Bob Spryn (sprynmr) | ||
* Ray Fix (rayfix) | ||
* Marlon Andrade (marlonandrade) | ||
* David Young-Chan Kay (DavidYKay) | ||
* Chethan Reddy (creddy) | ||
* Julien Grimault (juliengrimault) | ||
* Matthias Bartelmeß | ||
* Nolan Waite (nolanw) | ||
* Michael Fleet (fantasticmf) | ||
* Tony Lee (hktonylee) | ||
* Aaron Crespo (aaroncrespo) | ||
* James Sullivan (jsullivanlive) | ||
* Marco Pesenti Gritti (marcopg) | ||
* Brad Phelan (bradphelan) | ||
* Ivan Vučica (ivucica) | ||
* Felix Holmgren (Felixyz) | ||
* Open Thread (OpenFibers) | ||
* Sergej Tatarincev (SevInf) | ||
* Ben Einstein (beinstein) | ||
* Johan Bilien (jobi) | ||
* Björn Jonsson (bjornjonsson) | ||
* Ralf van der Zanden (ralfvdz) | ||
* Parker Boundy (parkerboundy) | ||
* Jeremy Mack (mutewinter) | ||
* Allen Wei (allenwei) | ||
* Robin Eggenkamp (Edubits) | ||
* Emil Wojtaszek (emilwojtaszek) | ||
* Victor Kryukov (victorkryukov) | ||
* Cody Rayment (crayment) | ||
* Arne Harren (aharren) | ||
* Cameron Royal (cammm) | ||
|
||
## Honorable Mentions | ||
RestKit would like to thank the following companies for aiding in the support of this product: | ||
|
||
* GateGuru - http://www.gateguru.com | ||
* Two Toasters - http://www.twotoasters.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// CoreData.h | ||
// RestKit | ||
// | ||
// Created by Blake Watters on 9/30/10. | ||
// Copyright (c) 2009-2012 RestKit. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#import <CoreData/CoreData.h> | ||
#import "ObjectMapping.h" | ||
#import "NSManagedObject+ActiveRecord.h" | ||
#import "RKManagedObjectStore.h" | ||
#import "RKManagedObjectSeeder.h" | ||
#import "RKManagedObjectLoader.h" | ||
#import "RKManagedObjectMapping.h" | ||
#import "RKManagedObjectMappingOperation.h" | ||
#import "RKManagedObjectCaching.h" | ||
#import "RKInMemoryManagedObjectCache.h" | ||
#import "RKFetchRequestManagedObjectCache.h" | ||
#import "RKSearchableManagedObject.h" | ||
#import "RKSearchWord.h" | ||
|
||
#import "RKObjectPropertyInspector+CoreData.h" | ||
#import "RKObjectMappingProvider+CoreData.h" | ||
#import "NSManagedObjectContext+RKAdditions.h" | ||
#import "NSManagedObject+RKAdditions.h" | ||
#import "NSEntityDescription+RKAdditions.h" |
93 changes: 93 additions & 0 deletions
93
Vendor/RestKit/Code/CoreData/NSEntityDescription+RKAdditions.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// | ||
// NSEntityDescription+RKAdditions.h | ||
// RestKit | ||
// | ||
// Created by Blake Watters on 3/22/12. | ||
// Copyright (c) 2009-2012 RestKit. All rights reserved. | ||
// | ||
|
||
#import <CoreData/CoreData.h> | ||
|
||
/** | ||
The key for retrieving the name of the attribute that acts as | ||
the primary key from the user info dictionary of the receiving NSEntityDescription. | ||
**Value**: @"primaryKeyAttribute" | ||
*/ | ||
extern NSString * const RKEntityDescriptionPrimaryKeyAttributeUserInfoKey; | ||
|
||
/** | ||
The substitution variable used in predicateForPrimaryKeyAttribute. | ||
**Value**: @"PRIMARY_KEY_VALUE" | ||
@see predicateForPrimaryKeyAttribute | ||
*/ | ||
extern NSString * const RKEntityDescriptionPrimaryKeyAttributeValuePredicateSubstitutionVariable; | ||
|
||
/** | ||
Provides extensions to NSEntityDescription for various common tasks. | ||
*/ | ||
@interface NSEntityDescription (RKAdditions) | ||
|
||
/** | ||
The name of the attribute that acts as the primary key for the receiver. | ||
The primary key attribute can be configured in two ways: | ||
1. From within the Xcode Core Data editing view by | ||
adding the desired attribute's name as the value for the | ||
key `primaryKeyAttribute` to the user info dictionary. | ||
1. Programmatically, by retrieving the NSEntityDescription instance and | ||
setting the property's value. | ||
Programmatically configured values take precedence over the user info | ||
dictionary. | ||
*/ | ||
@property (nonatomic, retain) NSString *primaryKeyAttributeName; | ||
|
||
/** | ||
The attribute description object for the attribute designated as the primary key for the receiver. | ||
*/ | ||
@property (nonatomic, readonly) NSAttributeDescription *primaryKeyAttribute; | ||
|
||
/** | ||
The class representing the value of the attribute designated as the primary key for the receiver. | ||
*/ | ||
@property (nonatomic, readonly) Class primaryKeyAttributeClass; | ||
|
||
/** | ||
Returns a cached predicate specifying that the primary key attribute is equal to the $PRIMARY_KEY_VALUE | ||
substitution variable. | ||
This predicate is cached to avoid parsing overhead during object mapping operations | ||
and must be evaluated using [NSPredicate predicateWithSubstitutionVariables:] | ||
@return A cached predicate specifying the value of the primary key attribute is equal to the $PRIMARY_KEY_VALUE | ||
substitution variable. | ||
*/ | ||
- (NSPredicate *)predicateForPrimaryKeyAttribute; | ||
|
||
/** | ||
Returns a predicate specifying that the value of the primary key attribute is equal to a given | ||
value. This predicate is constructed by evaluating the cached predicate returned by the | ||
predicateForPrimaryKeyAttribute with a dictionary of substitution variables specifying that | ||
$PRIMARY_KEY_VALUE is equal to the given value. | ||
**NOTE**: This method considers the type of the receiver's primary key attribute when constructing | ||
the predicate. It will coerce the given value into either an NSString or an NSNumber as | ||
appropriate. This behavior is a convenience to avoid annoying issues related to Core Data's | ||
handling of predicates for NSString and NSNumber types that were not appropriately casted. | ||
@return A predicate speciying that the value of the primary key attribute is equal to a given value. | ||
*/ | ||
- (NSPredicate *)predicateForPrimaryKeyAttributeWithValue:(id)value; | ||
|
||
/** | ||
Coerces the given value into the class representing the primary key. Currently support NSString | ||
and NSNumber coercsions. | ||
@bug **NOTE** This API is temporary and will be deprecated and replaced. | ||
@since 0.10.1 | ||
*/ | ||
- (id)coerceValueForPrimaryKey:(id)primaryKeyValue; | ||
|
||
@end |
107 changes: 107 additions & 0 deletions
107
Vendor/RestKit/Code/CoreData/NSEntityDescription+RKAdditions.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
// | ||
// NSEntityDescription+RKAdditions.m | ||
// RestKit | ||
// | ||
// Created by Blake Watters on 3/22/12. | ||
// Copyright (c) 2009-2012 RestKit. All rights reserved. | ||
// | ||
|
||
#import <objc/runtime.h> | ||
#import "NSEntityDescription+RKAdditions.h" | ||
|
||
NSString * const RKEntityDescriptionPrimaryKeyAttributeUserInfoKey = @"primaryKeyAttribute"; | ||
NSString * const RKEntityDescriptionPrimaryKeyAttributeValuePredicateSubstitutionVariable = @"PRIMARY_KEY_VALUE"; | ||
|
||
static char primaryKeyAttributeNameKey, primaryKeyPredicateKey; | ||
|
||
@implementation NSEntityDescription (RKAdditions) | ||
|
||
- (void)setPredicateForPrimaryKeyAttribute:(NSString *)primaryKeyAttribute | ||
{ | ||
NSPredicate *predicate = (primaryKeyAttribute) ? [NSPredicate predicateWithFormat:@"%K == $PRIMARY_KEY_VALUE", primaryKeyAttribute] : nil; | ||
objc_setAssociatedObject(self, | ||
&primaryKeyPredicateKey, | ||
predicate, | ||
OBJC_ASSOCIATION_RETAIN); | ||
} | ||
|
||
#pragma mark - Public | ||
|
||
- (NSAttributeDescription *)primaryKeyAttribute | ||
{ | ||
return [[self attributesByName] valueForKey:[self primaryKeyAttributeName]]; | ||
} | ||
|
||
- (Class)primaryKeyAttributeClass | ||
{ | ||
NSAttributeDescription *attributeDescription = [self primaryKeyAttribute]; | ||
if (attributeDescription) { | ||
return NSClassFromString(attributeDescription.attributeValueClassName); | ||
} | ||
|
||
return nil; | ||
} | ||
|
||
- (NSString *)primaryKeyAttributeName | ||
{ | ||
// Check for an associative object reference | ||
NSString *primaryKeyAttribute = (NSString *)objc_getAssociatedObject(self, &primaryKeyAttributeNameKey); | ||
|
||
// Fall back to the userInfo dictionary | ||
if (! primaryKeyAttribute) { | ||
primaryKeyAttribute = [self.userInfo valueForKey:RKEntityDescriptionPrimaryKeyAttributeUserInfoKey]; | ||
|
||
// If we have loaded from the user info, ensure we have a predicate | ||
if (! [self predicateForPrimaryKeyAttribute]) { | ||
[self setPredicateForPrimaryKeyAttribute:primaryKeyAttribute]; | ||
} | ||
} | ||
|
||
return primaryKeyAttribute; | ||
} | ||
|
||
- (void)setPrimaryKeyAttributeName:(NSString *)primaryKeyAttributeName | ||
{ | ||
objc_setAssociatedObject(self, | ||
&primaryKeyAttributeNameKey, | ||
primaryKeyAttributeName, | ||
OBJC_ASSOCIATION_RETAIN); | ||
[self setPredicateForPrimaryKeyAttribute:primaryKeyAttributeName]; | ||
} | ||
|
||
- (NSPredicate *)predicateForPrimaryKeyAttribute | ||
{ | ||
return (NSPredicate *)objc_getAssociatedObject(self, &primaryKeyPredicateKey); | ||
} | ||
|
||
- (id)coerceValueForPrimaryKey:(id)primaryKeyValue | ||
{ | ||
id searchValue = primaryKeyValue; | ||
Class theClass = [self primaryKeyAttributeClass]; | ||
if (theClass) { | ||
// TODO: This coercsion behavior should be pluggable and reused from the mapper | ||
if ([theClass isSubclassOfClass:[NSNumber class]] && ![searchValue isKindOfClass:[NSNumber class]]) { | ||
// Handle NSString -> NSNumber | ||
if ([searchValue isKindOfClass:[NSString class]]) { | ||
searchValue = [NSNumber numberWithDouble:[searchValue doubleValue]]; | ||
} | ||
} else if ([theClass isSubclassOfClass:[NSString class]] && ![searchValue isKindOfClass:[NSString class]]) { | ||
// Coerce to string | ||
if ([searchValue respondsToSelector:@selector(stringValue)]) { | ||
searchValue = [searchValue stringValue]; | ||
} | ||
} | ||
} | ||
|
||
return searchValue; | ||
} | ||
|
||
- (NSPredicate *)predicateForPrimaryKeyAttributeWithValue:(id)value | ||
{ | ||
id substitutionValue = [self coerceValueForPrimaryKey:value]; | ||
NSDictionary *variables = [NSDictionary dictionaryWithObject:substitutionValue | ||
forKey:RKEntityDescriptionPrimaryKeyAttributeValuePredicateSubstitutionVariable]; | ||
return [[self predicateForPrimaryKeyAttribute] predicateWithSubstitutionVariables:variables]; | ||
} | ||
|
||
@end |
Oops, something went wrong.