afc_salesforce 0.1.11 → 0.1.12
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 +5 -5
- data/lib/afc_salesforce.rb +2 -1
- data/lib/afc_salesforce/forms/lead_plus.rb +53 -0
- data/lib/afc_salesforce/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 87f3130e2cba9c923de523072bd6b63d7010f4de
|
4
|
+
data.tar.gz: 7d55da0755a33815152d27a9cb780f1e4c56d5f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45f00b0bc65c3bed08d1ecd8ab51bbfe91db23b65e6a07ffa8fca674f7238df392b9bb687b1e5d95b579a8a2fab40cd49f6397bfbd5c4804c51985f08ce9a5d6
|
7
|
+
data.tar.gz: 256b0d7c4b58354477035f809d8573946471db3ab69f404172e8a1ae859040623f6051fc3abd1ec49590b4f1800c25eabd294cdd576b6ce003a5be8e5833c962
|
data/lib/afc_salesforce.rb
CHANGED
@@ -34,6 +34,7 @@ require_relative 'afc_salesforce/lead'
|
|
34
34
|
require_relative 'afc_salesforce/forms/long_purchase'
|
35
35
|
require_relative 'afc_salesforce/forms/long_refinance'
|
36
36
|
require_relative 'afc_salesforce/forms/short_lead'
|
37
|
+
require_relative 'afc_salesforce/forms/lead_plus'
|
37
38
|
|
38
39
|
require_relative 'afc_salesforce/version'
|
39
40
|
|
@@ -53,4 +54,4 @@ module AFCSalesforce
|
|
53
54
|
def self.configure
|
54
55
|
yield(configuration)
|
55
56
|
end
|
56
|
-
end
|
57
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module AFCSalesforce
|
2
|
+
module Forms
|
3
|
+
class LeadPlus
|
4
|
+
attr_accessor :borrowers, :account
|
5
|
+
|
6
|
+
def initialize(options={})
|
7
|
+
@borrowers = options.fetch(:borrowers, [])
|
8
|
+
@account = options.fetch(:account, nil)
|
9
|
+
end
|
10
|
+
|
11
|
+
def valid?
|
12
|
+
validator = LeadPlusValidator.new(self)
|
13
|
+
validator.valid?
|
14
|
+
end
|
15
|
+
|
16
|
+
def validate!
|
17
|
+
validator = LeadPlusValidator.new(self)
|
18
|
+
if validator.valid?
|
19
|
+
return true
|
20
|
+
else
|
21
|
+
return validator.errors
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def salesforce_hash
|
26
|
+
form_hash = {long_form: {}}
|
27
|
+
form_hash[:long_form][:borrowers] = @borrowers.empty? ? [] : @borrowers.map(&:to_h)
|
28
|
+
form_hash[:long_form][:account] = @account.to_h
|
29
|
+
form_hash
|
30
|
+
end
|
31
|
+
|
32
|
+
def send_to_salesforce
|
33
|
+
Restforce.new(
|
34
|
+
username: AFCSalesforce.configuration.salesforce_username,
|
35
|
+
password: AFCSalesforce.configuration.salesforce_password,
|
36
|
+
security_token: AFCSalesforce.configuration.salesforce_security_token,
|
37
|
+
client_id: AFCSalesforce.configuration.salesforce_client_id,
|
38
|
+
client_secret: AFCSalesforce.configuration.salesforce_client_secret,
|
39
|
+
api_version: AFCSalesforce.configuration.salesforce_api_version,
|
40
|
+
host: AFCSalesforce.configuration.salesforce_host,
|
41
|
+
authentication_callback: AFCSalesforce.configuration.salesforce_authentication_callback
|
42
|
+
).post(URI('/services/apexrest/v1/lead_plus_form'), salesforce_hash)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class LeadPlusValidator < AFCSalesforce::Tools::Validation::Validator
|
47
|
+
include AFCSalesforce::Tools::Validation
|
48
|
+
|
49
|
+
rule :borrowers, [{instance_of: Array}, length: {minimum: 1}]
|
50
|
+
rule :account, [{instance_of: AFCSalesforce::Account}, :not_nil]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: afc_salesforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Donavan White
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- lib/afc_salesforce/borrower.rb
|
156
156
|
- lib/afc_salesforce/configuration.rb
|
157
157
|
- lib/afc_salesforce/forms/agent_referral.rb
|
158
|
+
- lib/afc_salesforce/forms/lead_plus.rb
|
158
159
|
- lib/afc_salesforce/forms/long_purchase.rb
|
159
160
|
- lib/afc_salesforce/forms/long_refinance.rb
|
160
161
|
- lib/afc_salesforce/forms/short_lead.rb
|
@@ -201,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
202
|
version: '0'
|
202
203
|
requirements: []
|
203
204
|
rubyforge_project:
|
204
|
-
rubygems_version: 2.
|
205
|
+
rubygems_version: 2.6.11
|
205
206
|
signing_key:
|
206
207
|
specification_version: 4
|
207
208
|
summary: Salesforce Library for the AFC Salesforce Instance
|