rest_kat 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.13
1
+ 0.0.14
data/lib/model.m.erb CHANGED
@@ -153,12 +153,21 @@
153
153
  <%end%>
154
154
 
155
155
  // -------------------------------------------
156
- // Register the mapper for the class
156
+ // Register the mapper for the class
157
+ <%if klass.resource %>
158
+ [[RKObjectManager sharedManager].mappingProvider
159
+ registerMapping:mapping
160
+ withRootKeyPath:@"<%=klass.resource.item_keypath%>"];
161
+
162
+ [[RKObjectManager sharedManager].mappingProvider
163
+ setMapping:mapping
164
+ forKeyPath:@"<%=klass.resource.collection_keypath%>"];
165
+ <%else%>
157
166
  [[RKObjectManager sharedManager].mappingProvider addObjectMapping:mapping];
158
-
159
167
  // -------------------------------------------
160
168
  // Register the serializer for the class
161
169
  [[RKObjectManager sharedManager].mappingProvider setSerializationMapping:[mapping inverseMapping] forClass:[<%=klass.objc_class%> class] ];
170
+ <%end%>
162
171
  }
163
172
 
164
173
  <%if klass.resource%>
@@ -238,13 +247,10 @@
238
247
  // Load collection
239
248
  + (void) loadCollectionWithDelegate:(id<RKObjectLoaderDelegate>)delegate
240
249
  {
241
- RKObjectManager * objectManager = [RKObjectManager sharedManager];
242
- RKObjectMapping * mapping = [objectManager.mappingProvider
243
- objectMappingForClass:self ];
244
-
245
- [objectManager loadObjectsAtResourcePath:[self resourcePath]
246
- objectMapping:mapping
247
- delegate:delegate];
250
+ [[RKObjectManager sharedManager]
251
+ loadObjectsAtResourcePath:[self resourcePath]
252
+ delegate:delegate];
253
+
248
254
  }
249
255
 
250
256
 
@@ -252,19 +258,13 @@
252
258
  + (void) loadCollectionThroughQuery:(NSObject *)mappableQueryObject
253
259
  withDelegate:(id<RKObjectLoaderDelegate>)delegate
254
260
  {
255
-
256
- RKObjectManager * objectManager = [RKObjectManager sharedManager];
257
- RKObjectMapping * mapping = [objectManager.mappingProvider
258
- objectMappingForClass:self ];
259
-
260
-
261
261
  // Append the dictionary to the resource as query parameters
262
262
  NSString * resourcePath = RKPathAppendQueryParams([self resourcePath], convertToDictionary(mappableQueryObject));
263
263
 
264
264
  // Load the objects at the query
265
- [objectManager loadObjectsAtResourcePath:resourcePath
266
- objectMapping:mapping
267
- delegate:delegate];
265
+ [[RKObjectManager sharedManager]
266
+ loadObjectsAtResourcePath:resourcePath
267
+ delegate:delegate];
268
268
  }
269
269
  <%end%>
270
270
 
data/lib/rest_kat.rb CHANGED
@@ -21,6 +21,14 @@ module RestKat
21
21
  hash[:permissions]
22
22
  end
23
23
 
24
+ def collection_keypath
25
+ hash[:name]
26
+ end
27
+
28
+ def item_keypath
29
+ hash[:name].singularize
30
+ end
31
+
24
32
  def c_permission_for type
25
33
  if permissions.include? type
26
34
  "true"
data/rest_kat.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rest_kat}
8
- s.version = "0.0.13"
8
+ s.version = "0.0.14"
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}]
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.13
5
+ version: 0.0.14
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brad Phelan
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
111
  - - ">="
112
112
  - !ruby/object:Gem::Version
113
- hash: 3583557775326466182
113
+ hash: -667916720988082051
114
114
  segments:
115
115
  - 0
116
116
  version: "0"