leadsquared 0.4.0 → 0.5.0
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/VERSION +1 -1
- data/leadsquared.gemspec +1 -2
- data/lib/leadsquared/lead.rb +14 -6
- data/spec/leadsquared/lead_spec.rb +28 -0
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e1f927850a877b103d662a6f8e7008112c1c12b06f56a0e8458128fadaf3a6f9
|
4
|
+
data.tar.gz: 70f6bda2e7355a28696261e67bf52d3ff382e93226f348b98db547f3054ae3df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df14b396f0f2510763509809b6c850da80c7743229f5142522974d6045ed7032ba73ff2b2e8309846a88bdbdae6a12cb5b1ab6c8b8c4dd13982a1c3f76ed89cd
|
7
|
+
data.tar.gz: 0e41dc23cdd63d06fee7f0a930fe8ed898894835621d857c29e2864197b9627f0250ca76675c08642f7eff18fb745212df8166a85c1b5fb8a72c015522be0ae6
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/leadsquared.gemspec
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "leadsquared"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.5.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
@@ -90,4 +90,3 @@ Gem::Specification.new do |s|
|
|
90
90
|
s.add_dependency(%q<codeclimate-test-reporter>, [">= 0"])
|
91
91
|
end
|
92
92
|
end
|
93
|
-
|
data/lib/leadsquared/lead.rb
CHANGED
@@ -17,14 +17,14 @@ module Leadsquared
|
|
17
17
|
|
18
18
|
def get_lead_by_id(lead_id)
|
19
19
|
url = url_with_service("Leads.GetById")
|
20
|
-
response = connection.get(url, {id: lead_id})
|
20
|
+
response = connection.get(url, { id: lead_id })
|
21
21
|
parsed_response = handle_response response
|
22
22
|
parsed_response.first
|
23
23
|
end
|
24
24
|
|
25
25
|
def get_lead_by_email(email)
|
26
26
|
url = url_with_service("Leads.GetByEmailaddress")
|
27
|
-
response = connection.get(url, {emailaddress: email})
|
27
|
+
response = connection.get(url, { emailaddress: email })
|
28
28
|
parsed_response = handle_response response
|
29
29
|
parsed_response.first
|
30
30
|
end
|
@@ -69,24 +69,32 @@ module Leadsquared
|
|
69
69
|
"Value": "EmailAddress"
|
70
70
|
}
|
71
71
|
]
|
72
|
-
body += build_attributes
|
72
|
+
body += build_attributes values_hash
|
73
73
|
response = connection.post(url, {}, body.to_json)
|
74
74
|
parsed_response = handle_response response
|
75
75
|
parsed_response["Message"]["Id"]
|
76
76
|
end
|
77
77
|
|
78
78
|
def visitor_to_lead(prospect_id, values_hash = {})
|
79
|
-
url = url_with_service(
|
80
|
-
body = build_attributes
|
79
|
+
url = url_with_service('Lead.Convert')
|
80
|
+
body = build_attributes values_hash
|
81
81
|
response = connection.post(url, {leadId: prospect_id}, body.to_json)
|
82
82
|
parsed_response = handle_response response
|
83
83
|
parsed_response["Status"]
|
84
84
|
end
|
85
85
|
|
86
|
+
def capture_lead(values_hash = {})
|
87
|
+
url = url_with_service('Lead.Capture')
|
88
|
+
body = build_attributes values_hash
|
89
|
+
response = connection.post(url, body.to_json)
|
90
|
+
parsed_response = handle_response response
|
91
|
+
parsed_response['Status']
|
92
|
+
end
|
93
|
+
|
86
94
|
private
|
87
95
|
|
88
96
|
def build_attributes(values_hash)
|
89
|
-
values_hash.map {|key, val| {
|
97
|
+
values_hash.map { |key, val| { 'Attribute' => key, 'Value' => val } }
|
90
98
|
end
|
91
99
|
end
|
92
100
|
|
@@ -152,6 +152,34 @@ describe Leadsquared::Lead do
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
+
describe '#capture_lead' do
|
156
|
+
let(:url) { "#{service}Lead.Capture" }
|
157
|
+
let(:values_hash) do
|
158
|
+
{ 'OwnerId' => '1234567', 'ProspectID' => lead_id }
|
159
|
+
end
|
160
|
+
let(:success_response) do
|
161
|
+
{ "Status" => "Success", "Message" => { "AffectedRows" => 1 } }
|
162
|
+
end
|
163
|
+
let(:body) do
|
164
|
+
[
|
165
|
+
{ "Attribute": "OwnerId", "Value": "1234567" },
|
166
|
+
{ "Attribute": "ProspectID", "Value": lead_id }
|
167
|
+
]
|
168
|
+
end
|
169
|
+
let(:valid_response) do
|
170
|
+
double('response',
|
171
|
+
status: 200,
|
172
|
+
body: success_response.to_json)
|
173
|
+
end
|
174
|
+
|
175
|
+
it 'capture valid user' do
|
176
|
+
expect(mock_connection).to receive(:post).with(url, body.to_json).and_return valid_response
|
177
|
+
response = subject.capture_lead(values_hash)
|
178
|
+
expect(response).to eq(success_response['Status'])
|
179
|
+
end
|
180
|
+
|
181
|
+
end
|
182
|
+
|
155
183
|
describe "#update" do
|
156
184
|
let(:url) { "#{service}Lead.Update" }
|
157
185
|
let(:new_values) do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leadsquared
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Paluy
|
@@ -214,8 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '0'
|
216
216
|
requirements: []
|
217
|
-
|
218
|
-
rubygems_version: 2.4.5.1
|
217
|
+
rubygems_version: 3.0.2
|
219
218
|
signing_key:
|
220
219
|
specification_version: 4
|
221
220
|
summary: Ruby framework for integration with Leadsquared API
|