active_force 0.0.5.alfa → 0.0.6.alfa
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/active_force/sobject.rb +13 -0
- data/lib/active_force/version.rb +1 -1
- data/spec/active_force/sobject/table_name_spec.rb +29 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbd6c1f543bc1665eb9bae1a0b884d27b1731fee
|
4
|
+
data.tar.gz: 9b0e307c8db0dde5789a560005e87fa8d05f9fac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f52aa5a3b15ff6021d0257995fb88c4ec8a9cc9b0a1e7d57cbd64780b76b1fac5c5dcc661b395d272cc6ea4414b2a8ca9ea806b0decc9af2c46153a43e21b2e7
|
7
|
+
data.tar.gz: 6cd0303531137db2fc3674c8a3e79ec192bde1f111be3a443c57337f1c4a35abdbcb8dd6b0dc60ef395d50afe2bc8604c5c540eaaec73e56b150003d53c15869
|
data/CHANGELOG.md
ADDED
data/lib/active_force/sobject.rb
CHANGED
@@ -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
|
data/lib/active_force/version.rb
CHANGED
@@ -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.
|
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-
|
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
|