active_force 0.0.3.alfa → 0.0.4.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/lib/active_force/sobject.rb +8 -2
- data/lib/active_force/version.rb +1 -1
- data/spec/active_force/sobject_spec.rb +18 -0
- data/spec/support/whizbang.rb +5 -45
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f71ee97f96752c20cc626de2b6cecb58a84e29de
|
|
4
|
+
data.tar.gz: b64e0707535e663f8e322cdeea503059aa2e3b74
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 255cc8d975730f3e71bf4cffe757cb4535d94f7b2e21338cfe1337127b1769881445ec0c15a62bc655d23efdd129269226a204c217998fe2a9ec08a6d69cbe73
|
|
7
|
+
data.tar.gz: e9691d927fd8537590e28438ad71b2ac219c7e4e0e7d7bbab1dac3088c1b349bc4f34b518bf956cd70b55869ff6b0af341b2fa7b53b3cd4f0935ae9c03a87263
|
data/lib/active_force/sobject.rb
CHANGED
|
@@ -9,8 +9,6 @@ module ActiveForce
|
|
|
9
9
|
|
|
10
10
|
class_attribute :mappings, :fields, :table_name
|
|
11
11
|
|
|
12
|
-
attribute :id
|
|
13
|
-
|
|
14
12
|
def self.build sobject
|
|
15
13
|
return nil if sobject.nil?
|
|
16
14
|
model = new
|
|
@@ -52,5 +50,13 @@ module ActiveForce
|
|
|
52
50
|
id?
|
|
53
51
|
end
|
|
54
52
|
|
|
53
|
+
def self.field field_name, from: field_name.camelize
|
|
54
|
+
mappings[field_name] = from
|
|
55
|
+
attribute field_name
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.mappings
|
|
59
|
+
@mappings ||= {}
|
|
60
|
+
end
|
|
55
61
|
end
|
|
56
62
|
end
|
data/lib/active_force/version.rb
CHANGED
|
@@ -15,4 +15,22 @@ describe ActiveForce::SObject do
|
|
|
15
15
|
expect(Whizbang.build sobject_hash).to be_an_instance_of Whizbang
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
|
+
|
|
19
|
+
describe "field" do
|
|
20
|
+
it "add a mappings" do
|
|
21
|
+
expect(Whizbang.mappings).to include(
|
|
22
|
+
checkbox: 'Checkbox_Label',
|
|
23
|
+
text: 'Text_Label',
|
|
24
|
+
date: 'Date_Label',
|
|
25
|
+
datetime: 'DateTime_Label',
|
|
26
|
+
picklist_multiselect: 'Picklist_Multiselect_Label'
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "set an attribute" do
|
|
31
|
+
%w[checkbox text date datetime picklist_multiselect].each do |name|
|
|
32
|
+
expect(Whizbang.attribute_names).to include(name)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
18
36
|
end
|
data/spec/support/whizbang.rb
CHANGED
|
@@ -1,49 +1,9 @@
|
|
|
1
1
|
class Whizbang < ActiveForce::SObject
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
gender: 'Gender__c',
|
|
9
|
-
date_of_birth: 'PersonBirthdate',
|
|
10
|
-
status: 'Patient_Status__c',
|
|
11
|
-
username: 'User_Name__c',
|
|
12
|
-
contact_phone: 'Phone',
|
|
13
|
-
email: 'Patient_Email__c',
|
|
14
|
-
referral_source: 'Referral_Source__c',
|
|
15
|
-
address: 'HomeStreet__c',
|
|
16
|
-
city: 'HomeCity__c',
|
|
17
|
-
state: 'HomeState__c',
|
|
18
|
-
zip_code: 'HomePostalCode__c',
|
|
19
|
-
occupation: 'Ocupation__c',
|
|
20
|
-
assigned_by: 'Assigned_By__c',
|
|
21
|
-
primary_care_physician: 'Primary_Care_Physician__c',
|
|
22
|
-
referring_physician: 'Referring_Physician__c',
|
|
23
|
-
emergency_contact: 'Emergency_Contact__c',
|
|
24
|
-
questionnaire_completed?: 'HHQ_Questionnaire_Complete__c',
|
|
25
|
-
employer: 'Employer__c'
|
|
26
|
-
}
|
|
3
|
+
field :checkbox, from: 'Checkbox_Label'
|
|
4
|
+
field :text, from: 'Text_Label'
|
|
5
|
+
field :date, from: 'Date_Label'
|
|
6
|
+
field :datetime, from: 'DateTime_Label'
|
|
7
|
+
field :picklist_multiselect, from: 'Picklist_Multiselect_Label'
|
|
27
8
|
|
|
28
|
-
attribute :salutation
|
|
29
|
-
attribute :first_name
|
|
30
|
-
attribute :last_name
|
|
31
|
-
attribute :gender
|
|
32
|
-
attribute :date_of_birth
|
|
33
|
-
attribute :status
|
|
34
|
-
attribute :username
|
|
35
|
-
attribute :contact_phone
|
|
36
|
-
attribute :email
|
|
37
|
-
attribute :referral_source
|
|
38
|
-
attribute :address
|
|
39
|
-
attribute :city
|
|
40
|
-
attribute :state
|
|
41
|
-
attribute :zip_code
|
|
42
|
-
attribute :occupation
|
|
43
|
-
attribute :assigned_by
|
|
44
|
-
attribute :primary_care_physician
|
|
45
|
-
attribute :referring_physician
|
|
46
|
-
attribute :emergency_contact
|
|
47
|
-
attribute :questionnaire_completed?
|
|
48
|
-
attribute :employer
|
|
49
9
|
end
|