marketo 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/marketo/client.rb +3 -1
- data/spec/marketo/client_spec.rb +32 -2
- metadata +3 -3
data/lib/marketo/client.rb
CHANGED
@@ -49,6 +49,8 @@ module Rapleaf
|
|
49
49
|
# * last - surname/last name of lead
|
50
50
|
# * company - company the lead is associated with
|
51
51
|
# * mobile - mobile/cell phone number
|
52
|
+
#
|
53
|
+
# returns the LeadRecord instance on success otherwise nil
|
52
54
|
def sync_lead(email, first, last, company, mobile)
|
53
55
|
begin
|
54
56
|
response = send_request("ns1:paramsSyncLead", {
|
@@ -63,7 +65,7 @@ module Rapleaf
|
|
63
65
|
{:attr_name => 'Company', :attr_type => 'string', :attr_value => company},
|
64
66
|
{:attr_name => 'MobilePhone', :attr_type => 'string', :attr_value => mobile}
|
65
67
|
]}}})
|
66
|
-
return response
|
68
|
+
return LeadRecord.from_hash(response[:success_sync_lead][:result][:lead_record])
|
67
69
|
rescue Exception => e
|
68
70
|
return nil
|
69
71
|
end
|
data/spec/marketo/client_spec.rb
CHANGED
@@ -119,7 +119,32 @@ module Rapleaf
|
|
119
119
|
savon_client = mock('savon_client')
|
120
120
|
authentication_header = mock('authentication_header')
|
121
121
|
client = Rapleaf::Marketo::Client.new(savon_client, authentication_header)
|
122
|
-
response_hash = {
|
122
|
+
response_hash = {
|
123
|
+
:success_sync_lead => {
|
124
|
+
:result => {
|
125
|
+
:lead_id => IDNUM,
|
126
|
+
:sync_status => {
|
127
|
+
:error => nil,
|
128
|
+
:status => 'UPDATED',
|
129
|
+
:lead_id => IDNUM
|
130
|
+
},
|
131
|
+
:lead_record => {
|
132
|
+
:email => EMAIL,
|
133
|
+
:lead_attribute_list => {
|
134
|
+
:attribute => [
|
135
|
+
{:attr_name => 'name1', :attr_type => 'string', :attr_value => 'val1'},
|
136
|
+
{:attr_name => 'name2', :attr_type => 'string', :attr_value => 'val2'},
|
137
|
+
{:attr_name => 'name3', :attr_type => 'string', :attr_value => 'val3'},
|
138
|
+
{:attr_name => 'name4', :attr_type => 'string', :attr_value => 'val4'}
|
139
|
+
]
|
140
|
+
},
|
141
|
+
:foreign_sys_type => nil,
|
142
|
+
:foreign_sys_person_id => nil,
|
143
|
+
:id => IDNUM.to_s
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
123
148
|
expect_request(savon_client,
|
124
149
|
authentication_header,
|
125
150
|
{
|
@@ -147,7 +172,12 @@ module Rapleaf
|
|
147
172
|
]}}},
|
148
173
|
'ns1:paramsSyncLead',
|
149
174
|
response_hash)
|
150
|
-
|
175
|
+
expected_lead_record = LeadRecord.new(EMAIL, IDNUM)
|
176
|
+
expected_lead_record.set_attribute('name1', 'val1')
|
177
|
+
expected_lead_record.set_attribute('name2', 'val2')
|
178
|
+
expected_lead_record.set_attribute('name3', 'val3')
|
179
|
+
expected_lead_record.set_attribute('name4', 'val4')
|
180
|
+
client.sync_lead(EMAIL, FIRST, LAST, COMPANY, MOBILE).should == expected_lead_record
|
151
181
|
end
|
152
182
|
|
153
183
|
context "list operations" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marketo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 3
|
10
|
+
version: 1.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James O'Brien
|