active_force 0.0.5.alfa → 0.0.6.alfa

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e52c7acefecccaede98efb34fa7974baaa9d81e
4
- data.tar.gz: afb36c781c3c07e84c388c747eb17130e2211c02
3
+ metadata.gz: cbd6c1f543bc1665eb9bae1a0b884d27b1731fee
4
+ data.tar.gz: 9b0e307c8db0dde5789a560005e87fa8d05f9fac
5
5
  SHA512:
6
- metadata.gz: c1effdd89a431566fa8c2975e3f5250e02f1fc215181ef0cf3945ff82c06a7b76d621d32d45eaf3b11b37a6d7d3eb08ed02e347aa6657c5e036dff9d82131679
7
- data.tar.gz: 5c33f883da377c25392df905a79b3a798fb0459eb2eb9bcb1c992e6467b0384ebba3fb9d9a6f286b809f2045d4ba2b0f9f6135d6273e8adc2e7358b3caf27992
6
+ metadata.gz: f52aa5a3b15ff6021d0257995fb88c4ec8a9cc9b0a1e7d57cbd64780b76b1fac5c5dcc661b395d272cc6ea4414b2a8ca9ea806b0decc9af2c46153a43e21b2e7
7
+ data.tar.gz: 6cd0303531137db2fc3674c8a3e79ec192bde1f111be3a443c57337f1c4a35abdbcb8dd6b0dc60ef395d50afe2bc8604c5c540eaaec73e56b150003d53c15869
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ ## 0.0.6.alfa ##
2
+
3
+ * ActiveForce::SObject#table_name is auto populated using the class
4
+ name. It adds "__c" to all non standard types.
@@ -7,8 +7,21 @@ module ActiveForce
7
7
  include ActiveAttr::Model
8
8
  include ActiveAttr::Dirty
9
9
 
10
+ # Types recognised don't get the added "__c"
11
+ STANDARD_TYPES = %w[ Account Contact Opportunity ]
12
+
10
13
  class_attribute :mappings, :fields, :table_name
11
14
 
15
+ # The table name to used to make queries.
16
+ # It is derived from the class name adding the "__c" when needed.
17
+ def self.table_name
18
+ @table_name ||= if STANDARD_TYPES.include? self.name
19
+ self.name
20
+ else
21
+ "#{self.name}__c"
22
+ end
23
+ end
24
+
12
25
  def self.build sobject
13
26
  return nil if sobject.nil?
14
27
  model = new
@@ -1,3 +1,3 @@
1
1
  module ActiveForce
2
- VERSION = "0.0.5.alfa"
2
+ VERSION = "0.0.6.alfa"
3
3
  end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe ActiveForce::SObject do
4
+ describe '#table_name' do
5
+
6
+ it 'Use the class name adding "__c"' do
7
+ class Custom < ActiveForce::SObject
8
+ end
9
+
10
+ expect(Custom.table_name).to eq('Custom__c')
11
+ end
12
+
13
+ it 'with standard SObject types it does not add the "__c"' do
14
+ class Account < ActiveForce::SObject
15
+ end
16
+
17
+ expect(Account.table_name).to eq('Account')
18
+ end
19
+
20
+ it 'can be enforced in the class definition' do
21
+ class EnforcedTableName < ActiveForce::SObject
22
+ self.table_name = 'Forced__c'
23
+ end
24
+
25
+ expect(EnforcedTableName.table_name).to eq('Forced__c')
26
+ end
27
+
28
+ end
29
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_force
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5.alfa
4
+ version: 0.0.6.alfa
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Espinaco
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-26 00:00:00.000000000 Z
11
+ date: 2013-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_attr
@@ -104,6 +104,7 @@ files:
104
104
  - .gitignore
105
105
  - .rspec
106
106
  - .travis.yml
107
+ - CHANGELOG.md
107
108
  - Gemfile
108
109
  - LICENSE.txt
109
110
  - README.md
@@ -116,6 +117,7 @@ files:
116
117
  - lib/generators/active_force/active_force_model/USAGE
117
118
  - lib/generators/active_force/active_force_model/active_force_model_generator.rb
118
119
  - lib/generators/active_force/active_force_model/templates/model.rb.erb
120
+ - spec/active_force/sobject/table_name_spec.rb
119
121
  - spec/active_force/sobject_spec.rb
120
122
  - spec/active_force_spec.rb
121
123
  - spec/fixtures/sobject/single_sobject_hash.yml
@@ -147,6 +149,7 @@ signing_key:
147
149
  specification_version: 4
148
150
  summary: Help you implement models persisting on Sales Force within Rails using RESTForce
149
151
  test_files:
152
+ - spec/active_force/sobject/table_name_spec.rb
150
153
  - spec/active_force/sobject_spec.rb
151
154
  - spec/active_force_spec.rb
152
155
  - spec/fixtures/sobject/single_sobject_hash.yml