rest_kat 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/model.m.erb +13 -2
  3. data/rest_kat.gemspec +2 -2
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.11
1
+ 0.0.12
@@ -170,7 +170,11 @@
170
170
  RKObjectRouter * router = [RKObjectManager sharedManager].router;
171
171
 
172
172
  NSString * collectionResource = [self resourcePath];
173
+ <%if klass.resource.singleton?%>
174
+ NSString * objectResource = collectionResource;
175
+ <%else%>
173
176
  NSString * objectResource = [NSString stringWithFormat:@"%@/:id", collectionResource];
177
+ <%end%>
174
178
 
175
179
  <%if klass.resource.create?%>
176
180
  [router routeClass:self toResourcePath:collectionResource forMethod:RKRequestMethodPOST];
@@ -189,20 +193,27 @@
189
193
 
190
194
  - (BOOL)isNew
191
195
  {
192
- BOOL hasId = class_getProperty([self class], [@"id" UTF8String]) != NULL;
193
- return ([self valueForKey:@"id"] == NULL || !hasId);
196
+ <%if klass.resource.singleton?%>
197
+ return NO;
198
+ <%else%>
199
+ return [self valueForKey:@"id"] == NULL;
200
+ <%end%>
194
201
  }
195
202
 
196
203
  -(void) saveWithDelegate:(id<RKObjectLoaderDelegate>)delegate
197
204
  {
198
205
  RKObjectMapping * mapper = [[RKObjectManager sharedManager].mappingProvider objectMappingForClass:[self class]];
199
206
 
207
+ <%if klass.resource.singleton?%>
208
+ [[RKObjectManager sharedManager] putObject:self mapResponseWith:mapper delegate:delegate];
209
+ <%else%>
200
210
  if ([self isNew])
201
211
  {
202
212
  [[RKObjectManager sharedManager] postObject:self mapResponseWith:mapper delegate:delegate];
203
213
  }else{
204
214
  [[RKObjectManager sharedManager] putObject:self mapResponseWith:mapper delegate:delegate];
205
215
  }
216
+ <%end%>
206
217
 
207
218
  }
208
219
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rest_kat}
8
- s.version = "0.0.11"
8
+ s.version = "0.0.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Brad Phelan}]
12
- s.date = %q{2011-11-29}
12
+ s.date = %q{2011-12-02}
13
13
  s.description = %q{The generated source code is a layer on top of the iOS REST framework http://restkit.org/}
14
14
  s.email = %q{brad.phelan@mysugr.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rest_kat
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.11
5
+ version: 0.0.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brad Phelan
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-11-29 00:00:00 Z
13
+ date: 2011-12-02 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: kwalify
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
111
  - - ">="
112
112
  - !ruby/object:Gem::Version
113
- hash: 4124181190719401455
113
+ hash: 275688353468508482
114
114
  segments:
115
115
  - 0
116
116
  version: "0"