databasedotcom 1.2.7 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -89,11 +89,22 @@ module Databasedotcom
89
89
  # c = Car.find_by_Color("Yellow")
90
90
  # c.Color = "Green"
91
91
  # c.save
92
- def save
92
+ #
93
+ # _options_ can contain the following keys:
94
+ #
95
+ # exclusions # an array of field names (case sensitive) to exclude from save
96
+ def save(options={})
93
97
  attr_hash = {}
94
98
  selection_attr = self.Id.nil? ? "createable" : "updateable"
95
99
  self.class.description["fields"].select { |f| f[selection_attr] }.collect { |f| f["name"] }.each { |attr| attr_hash[attr] = self.send(attr) }
96
100
 
101
+ # allow fields to be removed on a case by case basis as some data is not allowed to be saved
102
+ # (e.g. Name field on Account with record type of Person Account) despite the API listing
103
+ # some fields as editable
104
+ if options[:exclusions] and options[:exclusions].respond_to?(:include?) then
105
+ attr_hash.delete_if { |key, value| options[:exclusions].include?(key.to_s) }
106
+ end
107
+
97
108
  if self.Id.nil?
98
109
  self.Id = self.client.create(self.class, attr_hash).Id
99
110
  else
@@ -1,3 +1,3 @@
1
1
  module Databasedotcom
2
- VERSION = "1.2.7"
2
+ VERSION = "1.3.0"
3
3
  end
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: databasedotcom
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 27
4
5
  prerelease:
5
- version: 1.2.7
6
+ segments:
7
+ - 1
8
+ - 3
9
+ - 0
10
+ version: 1.3.0
6
11
  platform: ruby
7
12
  authors:
8
13
  - Glenn Gillen, Danny Burkes & Richard Zhao
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-12-06 00:00:00 Z
18
+ date: 2012-01-17 00:00:00 Z
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: multipart-post
@@ -20,6 +25,10 @@ dependencies:
20
25
  requirements:
21
26
  - - ~>
22
27
  - !ruby/object:Gem::Version
28
+ hash: 13
29
+ segments:
30
+ - 1
31
+ - 1
23
32
  version: "1.1"
24
33
  type: :runtime
25
34
  version_requirements: *id001
@@ -31,6 +40,9 @@ dependencies:
31
40
  requirements:
32
41
  - - ">="
33
42
  - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
34
46
  version: "0"
35
47
  type: :runtime
36
48
  version_requirements: *id002
@@ -42,6 +54,10 @@ dependencies:
42
54
  requirements:
43
55
  - - ~>
44
56
  - !ruby/object:Gem::Version
57
+ hash: 15
58
+ segments:
59
+ - 2
60
+ - 6
45
61
  version: "2.6"
46
62
  type: :development
47
63
  version_requirements: *id003
@@ -53,6 +69,9 @@ dependencies:
53
69
  requirements:
54
70
  - - ">="
55
71
  - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
56
75
  version: "0"
57
76
  type: :development
58
77
  version_requirements: *id004
@@ -64,6 +83,11 @@ dependencies:
64
83
  requirements:
65
84
  - - "="
66
85
  - !ruby/object:Gem::Version
86
+ hash: 51
87
+ segments:
88
+ - 0
89
+ - 8
90
+ - 6
67
91
  version: 0.8.6
68
92
  type: :development
69
93
  version_requirements: *id005
@@ -118,17 +142,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
142
  requirements:
119
143
  - - ">="
120
144
  - !ruby/object:Gem::Version
145
+ hash: 3
146
+ segments:
147
+ - 0
121
148
  version: "0"
122
149
  required_rubygems_version: !ruby/object:Gem::Requirement
123
150
  none: false
124
151
  requirements:
125
152
  - - ">="
126
153
  - !ruby/object:Gem::Version
154
+ hash: 3
155
+ segments:
156
+ - 0
127
157
  version: "0"
128
158
  requirements: []
129
159
 
130
160
  rubyforge_project: databasedotcom
131
- rubygems_version: 1.8.7
161
+ rubygems_version: 1.8.10
132
162
  signing_key:
133
163
  specification_version: 3
134
164
  summary: A ruby wrapper for the Force.com REST API