active_force 0.0.3.alfa → 0.0.4.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: 436d4d36cd6ed95f5bc8bfd199555f02c74c2cf3
4
- data.tar.gz: 9cc92d84483139c59703b190303e229f49af8a63
3
+ metadata.gz: f71ee97f96752c20cc626de2b6cecb58a84e29de
4
+ data.tar.gz: b64e0707535e663f8e322cdeea503059aa2e3b74
5
5
  SHA512:
6
- metadata.gz: 3f7e75fd82854c5121fd2c73a1871a279dbfb885fc30c26f078b0a09cc8501cb1da70fa3440544fdcae864665a4474d59480f53fa9015508b20311e648fbb3a1
7
- data.tar.gz: 8e7c42d5eeb0f5bc9516636d597798d509ce8a0b4487db094489e3ee3e5d4a083e8865be1fba1136207b7f510e221006095c19da9712a82d544e6bd24e9e64e9
6
+ metadata.gz: 255cc8d975730f3e71bf4cffe757cb4535d94f7b2e21338cfe1337127b1769881445ec0c15a62bc655d23efdd129269226a204c217998fe2a9ec08a6d69cbe73
7
+ data.tar.gz: e9691d927fd8537590e28438ad71b2ac219c7e4e0e7d7bbab1dac3088c1b349bc4f34b518bf956cd70b55869ff6b0af341b2fa7b53b3cd4f0935ae9c03a87263
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ActiveForce
2
- VERSION = "0.0.3.alfa"
2
+ VERSION = "0.0.4.alfa"
3
3
  end
@@ -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
@@ -1,49 +1,9 @@
1
1
  class Whizbang < ActiveForce::SObject
2
2
 
3
- self.mappings = {
4
- id: 'Id',
5
- salutation: 'Salutation',
6
- first_name: 'FirstName',
7
- last_name: 'LastName',
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_force
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.alfa
4
+ version: 0.0.4.alfa
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Espinaco