motion-resource 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "bubble-wrap"
3
+ gem "bubble-wrap", "1.3.0.osx"
4
4
  gem "motion-support"
5
5
  gem "webstub", :git => 'git://github.com/mattgreen/webstub.git'
6
6
 
data/README.md CHANGED
@@ -22,7 +22,8 @@ Consider this example for a fictional blog API.
22
22
  end
23
23
 
24
24
  class Post < MotionResource::Base
25
- attr_accessor :id, :user_id, :title, :text
25
+ attr_accessor :id
26
+ attribute :user_id, :title, :text
26
27
 
27
28
  belongs_to :user
28
29
 
@@ -30,6 +31,8 @@ Consider this example for a fictional blog API.
30
31
  self.member_url = "users/:user_id/posts/:id"
31
32
  end
32
33
 
34
+ Only attributes declared with `attribute` are transmitted on save. I.e. attributes declared with `attr_accessor` are considered read-only with respect to the JSON API.
35
+
33
36
  Now, we can access a user's posts like that:
34
37
 
35
38
  User.find(1) do |user|
@@ -1,14 +1,8 @@
1
1
  module MotionResource
2
2
  class Base
3
- attr_accessor :id
4
-
5
- def self.subclasses
6
- @subclasses ||= []
7
- end
3
+ include MotionSupport::DescendantsTracker
8
4
 
9
- def self.inherited(subclass)
10
- self.subclasses << subclass
11
- end
5
+ attr_accessor :id
12
6
 
13
7
  def initialize(params = {})
14
8
  @new_record = true
@@ -8,7 +8,7 @@ module MotionResource
8
8
 
9
9
  def forget_instances_of(klass)
10
10
  klass.identity_map.clear
11
- klass.subclasses.each do |subklass|
11
+ klass.descendants.each do |subklass|
12
12
  forget_instances_of(subklass)
13
13
  end
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module MotionResource
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -15,6 +15,6 @@ Gem::Specification.new do |s|
15
15
  s.require_paths = ["lib"]
16
16
 
17
17
  s.add_dependency 'bubble-wrap'
18
- s.add_dependency 'motion-support', ">= 0.2.0"
18
+ s.add_dependency 'motion-support', '>= 0.2.3'
19
19
  s.add_development_dependency 'rake'
20
20
  end
@@ -51,12 +51,4 @@ describe "base" do
51
51
  shape1.contents.should == 'something'
52
52
  end
53
53
  end
54
-
55
- describe "subclasses" do
56
- it "should keep track of subclasses" do
57
- MotionResource::Base.subclasses.should.include(Shape)
58
- Shape.subclasses.should.include(Rectangle)
59
- MotionResource::Base.subclasses.should.not.include(Rectangle)
60
- end
61
- end
62
54
  end
metadata CHANGED
@@ -1,60 +1,71 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: motion-resource
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
4
5
  prerelease:
5
- version: 0.1.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Thomas Kadauke
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2013-04-29 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2013-05-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: bubble-wrap
17
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
18
17
  none: false
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
27
31
  name: motion-support
28
- requirement: &id002 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
29
33
  none: false
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 0.2.0
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 0.2.3
34
38
  type: :runtime
35
39
  prerelease: false
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.2.3
46
+ - !ruby/object:Gem::Dependency
38
47
  name: rake
39
- requirement: &id003 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
40
49
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: "0"
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
45
54
  type: :development
46
55
  prerelease: false
47
- version_requirements: *id003
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
48
62
  description: Access RESTful resources from your iOS app. Inspired by ActiveResource.
49
- email:
63
+ email:
50
64
  - thomas.kadauke@googlemail.com
51
65
  executables: []
52
-
53
66
  extensions: []
54
-
55
67
  extra_rdoc_files: []
56
-
57
- files:
68
+ files:
58
69
  - .gitignore
59
70
  - Gemfile
60
71
  - README.md
@@ -96,38 +107,35 @@ files:
96
107
  - spec/motion-resource/urls_spec.rb
97
108
  homepage: https://github.com/tkadauke/motion-resource
98
109
  licenses: []
99
-
100
110
  post_install_message:
101
111
  rdoc_options: []
102
-
103
- require_paths:
112
+ require_paths:
104
113
  - lib
105
- required_ruby_version: !ruby/object:Gem::Requirement
114
+ required_ruby_version: !ruby/object:Gem::Requirement
106
115
  none: false
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- hash: 1896856864951168664
111
- segments:
116
+ requirements:
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ segments:
112
121
  - 0
113
- version: "0"
114
- required_rubygems_version: !ruby/object:Gem::Requirement
122
+ hash: -124098762633124978
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
124
  none: false
116
- requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- hash: 1896856864951168664
120
- segments:
125
+ requirements:
126
+ - - ! '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ segments:
121
130
  - 0
122
- version: "0"
131
+ hash: -124098762633124978
123
132
  requirements: []
124
-
125
133
  rubyforge_project:
126
- rubygems_version: 1.8.19
134
+ rubygems_version: 1.8.25
127
135
  signing_key:
128
136
  specification_version: 3
129
137
  summary: Access RESTful resources from your iOS app
130
- test_files:
138
+ test_files:
131
139
  - spec/env.rb
132
140
  - spec/motion-resource/associations/belongs_to_spec.rb
133
141
  - spec/motion-resource/associations/has_many_spec.rb