rest_model 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rest_model/version.rb +1 -1
- data/lib/rest_model.rb +12 -3
- data/spec/unit/key/relation/response_spec.rb +4 -4
- metadata +13 -13
data/lib/rest_model/version.rb
CHANGED
data/lib/rest_model.rb
CHANGED
@@ -40,9 +40,6 @@ class RestModel
|
|
40
40
|
include Response
|
41
41
|
include Serialization
|
42
42
|
|
43
|
-
cattr_accessor :id_key
|
44
|
-
cattr_writer :resource_name
|
45
|
-
|
46
43
|
def initialize(attrs = {})
|
47
44
|
return if attrs.nil? or attrs.empty?
|
48
45
|
|
@@ -77,6 +74,18 @@ class RestModel
|
|
77
74
|
__send__(id_key.name)
|
78
75
|
end
|
79
76
|
|
77
|
+
def self.id_key
|
78
|
+
@id_key
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.id_key=(id_key)
|
82
|
+
@id_key = id_key
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.resource_name=(resource_name)
|
86
|
+
@resource_name = resource_name
|
87
|
+
end
|
88
|
+
|
80
89
|
def self.keys
|
81
90
|
@keys ||= []
|
82
91
|
end
|
@@ -52,12 +52,12 @@ describe RestModel::Response do
|
|
52
52
|
context "when has many" do
|
53
53
|
before do
|
54
54
|
class ExampleChild < RestModel
|
55
|
-
|
55
|
+
id
|
56
56
|
belongs_to :example
|
57
57
|
end
|
58
58
|
|
59
59
|
class Example < RestModel
|
60
|
-
|
60
|
+
id
|
61
61
|
has_many :example_children
|
62
62
|
end
|
63
63
|
end
|
@@ -73,12 +73,12 @@ describe RestModel::Response do
|
|
73
73
|
context "when belongs to one" do
|
74
74
|
before do
|
75
75
|
class ExampleChild < RestModel
|
76
|
-
|
76
|
+
id
|
77
77
|
belongs_to :example
|
78
78
|
end
|
79
79
|
|
80
80
|
class Example < RestModel
|
81
|
-
|
81
|
+
id
|
82
82
|
has_many :example_children
|
83
83
|
end
|
84
84
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -15,7 +15,7 @@ date: 2011-11-24 00:00:00.000000000Z
|
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
18
|
-
requirement: &
|
18
|
+
requirement: &70126490239840 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: '3.0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70126490239840
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: i18n
|
29
|
-
requirement: &
|
29
|
+
requirement: &70126490239340 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: '0.5'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70126490239340
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: rspec
|
40
|
-
requirement: &
|
40
|
+
requirement: &70126490238880 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: '2.6'
|
46
46
|
type: :development
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70126490238880
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: guard
|
51
|
-
requirement: &
|
51
|
+
requirement: &70126490238420 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ~>
|
@@ -56,10 +56,10 @@ dependencies:
|
|
56
56
|
version: '0.5'
|
57
57
|
type: :development
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *70126490238420
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: guard-rspec
|
62
|
-
requirement: &
|
62
|
+
requirement: &70126490237960 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
64
64
|
requirements:
|
65
65
|
- - ~>
|
@@ -67,10 +67,10 @@ dependencies:
|
|
67
67
|
version: '0.4'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
|
-
version_requirements: *
|
70
|
+
version_requirements: *70126490237960
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: growl
|
73
|
-
requirement: &
|
73
|
+
requirement: &70126490237500 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - ~>
|
@@ -78,7 +78,7 @@ dependencies:
|
|
78
78
|
version: '1.0'
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
|
-
version_requirements: *
|
81
|
+
version_requirements: *70126490237500
|
82
82
|
description: ''
|
83
83
|
email:
|
84
84
|
- victorcrodrigues@gmail.com
|