restkit-generate 0.2 → 0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ module RestKitGenerate
5
5
  model_name = RestKitGenerate.config[:model_name]
6
6
  prefix = RestKitGenerate.config[:prefix]
7
7
  core_data = RestKitGenerate.config[:core_data]
8
- RestKitGenerate.properties.each{|key, value| props << "@property (nonatomic, #{value[:type] == "NSString" ? "copy" : "strong"}) #{value[:type]} *#{key};" }
8
+ RestKitGenerate.properties.each{|key, value| props << "@property (#{value[:type] == "NSString" ? "copy" : "strong"}, nonatomic) #{value[:type]} *#{key};" }
9
9
 
10
10
  erb = ERB.new(File.read(File.join($lib, 'restkit-generate', !core_data ? 'nsobject.h.erb' : 'nsmanagedobject.h.erb')))
11
11
  result = erb.result(binding)
@@ -11,7 +11,7 @@ module RestKitGenerate
11
11
  core_data = RestKitGenerate.config[:core_data]
12
12
 
13
13
  RestKitGenerate.properties.each{|key, value| dynamic << key }
14
- RestKitGenerate.properties.each{|key, value| mapping << "#{tab}@\"#{value[:original_name]}\", @\"#{key}\"" }
14
+ RestKitGenerate.properties.each{|key, value| mapping << "#{tab}#{tab}@\"#{value[:original_name]}\": @\"#{key}\"" }
15
15
  RestKitGenerate.properties.each{|key, value| decoders << "#{tab}[coder encodeObject:self.#{key} forKey:@\"#{key}\"];" }
16
16
  RestKitGenerate.properties.each{|key, value| encoders << "#{tab}#{tab}self.#{key} = [coder decodeObjectForKey:@\"#{key}\"];" }
17
17
 
@@ -11,6 +11,6 @@
11
11
 
12
12
  <%= props.join("\n") %>
13
13
 
14
- + (RKManagedObjectMapping *)objectMapping;
14
+ + (RKEntityMapping *)objectMapping;
15
15
 
16
16
  @end
@@ -8,19 +8,19 @@
8
8
 
9
9
  @dynamic <%= dynamic.join(", ") %>;
10
10
 
11
- + (RKManagedObjectMapping *)objectMapping
11
+ + (RKEntityMapping *)objectMapping
12
12
  {
13
- RKManagedObjectMapping* mapping = [RKManagedObjectMapping mappingForClass:[self class] inManagedObjectStore:[RKObjectManager sharedManager].objectStore];
13
+ RKEntityMapping *mapping = [RKEntityMapping mappingForEntityForName:@"<%= model_name %>" inManagedObjectStore:[RKObjectManager sharedManager].managedObjectStore];
14
14
  <%
15
15
  unless RestKitGenerate.config[:primary_key].nil?
16
16
  %>
17
- mapping.primaryKeyAttribute = @"<%= RestKitGenerate.config[:primary_key] %>";
17
+ mapping.identificationAttributes = @[ @"<%= RestKitGenerate.config[:primary_key] %>" ];
18
18
  <%
19
19
  end
20
20
  %>
21
- [mapping mapKeyPathsToAttributes:
21
+ [mapping addAttributeMappingsFromDictionary:@{
22
22
  <%= mapping.join(",\n") %>,
23
- nil];
23
+ }];
24
24
  return mapping;
25
25
  }
26
26
 
@@ -9,9 +9,9 @@
9
9
  + (RKObjectMapping *)objectMapping
10
10
  {
11
11
  RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[self class]];
12
- [mapping mapKeyPathsToAttributes:
12
+ [mapping addAttributeMappingsFromDictionary:@{
13
13
  <%= mapping.join(",\n") %>,
14
- nil];
14
+ }];
15
15
  return mapping;
16
16
  }
17
17
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restkit-generate
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: '0.3'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-17 00:00:00.000000000 Z
12
+ date: 2013-02-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A model generator for iOS RestKit (Rails-like)
15
15
  email: romefimov@gmail.com