Skip to content

Commit

Permalink
Refactored RestKit. Changed classing naming conventions to better ind…
Browse files Browse the repository at this point in the history
…icate object roles. Moved OCMock and UISpec dependencies in as submodules. Introduced router concept for generating paths and object serializations.
  • Loading branch information
blakewatters committed Jul 20, 2010
1 parent b849fc8 commit 878a2a5
Show file tree
Hide file tree
Showing 65 changed files with 1,336 additions and 962 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# the build
build
Build

# temp nibs and swap files
*~.nib
Expand Down
7 changes: 7 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[submodule "Specs/Support/UISpec"]
path = Specs/Support/UISpec
url = git://github.com/twotoasters/UISpec.git

[submodule "Specs/Support/OCMock"]
path = Specs/Support/OCMock
url = git@github.com:twotoasters/OCMock.git
2 changes: 1 addition & 1 deletion Code/RKClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

#import "RKClient.h"
#import "RKModelLoader.h"
#import "RKResourceLoader.h"
#import <SystemConfiguration/SCNetworkReachability.h>

///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
11 changes: 7 additions & 4 deletions Code/RKManagedModel.m → Code/RKManagedObject.m
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
//
// RKManagedModel.m
// RKManagedObject.m
// RestKit
//
// Created by Blake Watters on 8/14/09.
// Copyright 2009 Two Toasters. All rights reserved.
//

#import "RKManagedModel.h"
#import "RKManagedObject.h"
#import "NSString+InflectionSupport.h"
#import <objc/runtime.h>

@implementation RKManagedModel
@implementation RKManagedObject

#pragma mark -
#pragma mark NSManagedObject helper methods

+ (NSManagedObjectContext*)managedObjectContext {
return [[[RKModelManager manager] objectStore] managedObjectContext];
return [[[RKResourceManager manager] objectStore] managedObjectContext];
}

+ (NSManagedObject*)objectWithId:(NSManagedObjectID*)objectId {
Expand Down Expand Up @@ -113,6 +113,7 @@ - (NSString*)resourcePath {
}

// TODO: This is Rails specific. Clean up!
// TODO: Moves to the router
- (NSString*)resourcePathForMethod:(RKRequestMethod)method {
// TODO: Support an optional RKResourceAdapter class?
switch (method) {
Expand All @@ -129,6 +130,8 @@ - (NSString*)resourcePathForMethod:(RKRequestMethod)method {
default:
break;
}

return nil;
}

// TODO: Would be nice to specify this via an annotation in the mappings definition...
Expand Down
2 changes: 1 addition & 1 deletion Code/RKMappingFormatJSONParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright 2010 Two Toasters. All rights reserved.
//

#import "RKModelMapper.h"
#import "RKResourceMapper.h"
#import "JSON.h"

@interface RKMappingFormatJSONParser : NSObject <RKMappingFormatParser> {
Expand Down
171 changes: 0 additions & 171 deletions Code/RKModelManager.m

This file was deleted.

22 changes: 22 additions & 0 deletions Code/RKObject.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// RKObject.m
// RestKit
//
// Created by Blake Watters on 7/20/10.
// Copyright 2010 Two Toasters. All rights reserved.
//

#import "RKObject.h"

@implementation RKObject

+ (NSDictionary*)elementToPropertyMappings {
[self doesNotRecognizeSelector:_cmd];
return nil;
}

+ (NSDictionary*)elementToRelationshipMappings {
return [NSDictionary dictionary];
}

@end
8 changes: 4 additions & 4 deletions Code/RKModelSeeder.m → Code/RKObjectSeeder.m
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
//
// RKModelSeeder.m
// RKObjectSeeder.m
// RestKit
//
// Created by Blake Watters on 3/4/10.
// Copyright 2010 Two Toasters. All rights reserved.
//

#import "RKModelSeeder.h"
#import "RKObjectSeeder.h"

@implementation RKModelSeeder
@implementation RKObjectSeeder

- (id)initWithModelManager:(RKModelManager*)manager {
- (id)initWithResourceManager:(RKResourceManager*)manager {
if (self = [self init]) {
_manager = [manager retain];
}
Expand Down
Loading

0 comments on commit 878a2a5

Please sign in to comment.