rest_model 0.1.21 → 0.1.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ $:.push 'examples'; require 'helper'
2
+
3
+ class Customer < RestModel
4
+ id type: Integer
5
+ property :login
6
+ end
7
+
8
+ @root = Customer.from_source!(id: 200, login: 'jackiechan2010').first
9
+ @root.update_attributes(login: nil)
10
+
11
+ inspect_rest_model(@root)
@@ -1,3 +1,3 @@
1
1
  class RestModel
2
- VERSION = "0.1.21"
2
+ VERSION = "0.1.22"
3
3
  end
data/lib/rest_model.rb CHANGED
@@ -60,9 +60,8 @@ class RestModel
60
60
  assign_non_keys_attrs(attrs)
61
61
 
62
62
  self.class.keys.each do |key|
63
- value = attrs[key.name]
64
-
65
- if value and key.present?(self)
63
+ if key.present?(self) and attrs.has_key?(key.name)
64
+ value = attrs[key.name]
66
65
  __send__("#{key.name}=", key.from_hash(value, __send__(key.name)))
67
66
  end
68
67
  end
@@ -37,4 +37,11 @@ describe "update_attributes" do
37
37
  @root.services.first.name.should == "new_service_name"
38
38
  end
39
39
  end
40
- end
40
+
41
+ describe_example "update_attributes/with_nil_value" do
42
+ it "updates only the customers login" do
43
+ @root.login.should_not be
44
+ @root.id.should == 200
45
+ end
46
+ end
47
+ 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.21
4
+ version: 0.1.22
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-12-08 00:00:00.000000000Z
14
+ date: 2011-12-18 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
18
- requirement: &70175170400820 !ruby/object:Gem::Requirement
18
+ requirement: &70283492911180 !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: *70175170400820
26
+ version_requirements: *70283492911180
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: i18n
29
- requirement: &70175170400320 !ruby/object:Gem::Requirement
29
+ requirement: &70283492910680 !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: *70175170400320
37
+ version_requirements: *70283492910680
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: rspec
40
- requirement: &70175170399860 !ruby/object:Gem::Requirement
40
+ requirement: &70283492910220 !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: *70175170399860
48
+ version_requirements: *70283492910220
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: guard
51
- requirement: &70175170399400 !ruby/object:Gem::Requirement
51
+ requirement: &70283492909760 !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: *70175170399400
59
+ version_requirements: *70283492909760
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: guard-rspec
62
- requirement: &70175170398940 !ruby/object:Gem::Requirement
62
+ requirement: &70283492909300 !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: *70175170398940
70
+ version_requirements: *70283492909300
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: growl
73
- requirement: &70175170398480 !ruby/object:Gem::Requirement
73
+ requirement: &70283492908840 !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: *70175170398480
81
+ version_requirements: *70283492908840
82
82
  description: ''
83
83
  email:
84
84
  - victorcrodrigues@gmail.com
@@ -148,6 +148,7 @@ files:
148
148
  - examples/update_attributes/has_many.rb
149
149
  - examples/update_attributes/has_one.rb
150
150
  - examples/update_attributes/simple.rb
151
+ - examples/update_attributes/with_nil_value.rb
151
152
  - examples/validations/simple.rb
152
153
  - lib/rest_model.rb
153
154
  - lib/rest_model/configuration.rb