databasedotcom 1.1.5 → 1.1.6

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,6 +5,11 @@ module Databasedotcom
5
5
  cattr_accessor :client
6
6
  extend ActiveModel::Naming if defined?(ActiveModel::Naming)
7
7
 
8
+ def ==(other)
9
+ return false unless other.is_a?(self.class)
10
+ self.Id == other.Id
11
+ end
12
+
8
13
  # Returns a new Sobject. The default values for all attributes are set based on its description.
9
14
  def initialize(attrs = {})
10
15
  super()
@@ -81,7 +86,7 @@ module Databasedotcom
81
86
  self.class.description["fields"].select { |f| f[selection_attr] }.collect { |f| f["name"] }.each { |attr| attr_hash[attr] = self.send(attr) }
82
87
 
83
88
  if self.Id.nil?
84
- self.client.create(self.class, attr_hash)
89
+ self.Id = self.client.create(self.class, attr_hash).Id
85
90
  else
86
91
  self.client.update(self.class, self.Id, attr_hash)
87
92
  end
@@ -225,6 +230,11 @@ module Databasedotcom
225
230
  def self.delete(record_id)
226
231
  self.client.delete(self.sobject_name, record_id)
227
232
  end
233
+
234
+ # Get the total number of records
235
+ def self.count
236
+ self.client.query("SELECT COUNT() FROM #{self.sobject_name}").total_size
237
+ end
228
238
 
229
239
  # Sobject objects support dynamic finders similar to ActiveRecord.
230
240
  #
@@ -317,4 +327,4 @@ module Databasedotcom
317
327
  end
318
328
  end
319
329
  end
320
- end
330
+ end
@@ -1,3 +1,3 @@
1
1
  module Databasedotcom
2
- VERSION = "1.1.5"
2
+ VERSION = "1.1.6"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: databasedotcom
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.5
5
+ version: 1.1.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Glenn Gillen, Danny Burkes & Richard Zhao
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-10-17 00:00:00 Z
13
+ date: 2011-10-19 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multipart-post