landslider 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/landslider.gemspec +1 -1
- data/lib/landslider.rb +40 -31
- data/test/landslider_test.rb +1 -5
- data/test/ws_search_test.rb +1 -5
- metadata +1 -1
data/VERSION.yml
CHANGED
data/landslider.gemspec
CHANGED
data/lib/landslider.rb
CHANGED
@@ -33,7 +33,6 @@ class Landslider < Handsoap::Service
|
|
33
33
|
|
34
34
|
def login(session_id)
|
35
35
|
self.session_id = session_id
|
36
|
-
|
37
36
|
response = invoke('login', :soap_action => :none) do |message|
|
38
37
|
message.add('wsUser') { |u|
|
39
38
|
u.add 'username', ::LS_API_USERNAME
|
@@ -45,27 +44,14 @@ class Landslider < Handsoap::Service
|
|
45
44
|
parse_login_result(node)
|
46
45
|
end
|
47
46
|
|
48
|
-
def get_api_version(session_id)
|
49
|
-
self.session_id = session_id
|
50
|
-
|
51
|
-
response = invoke('getApiVersion', :soap_action => :none)
|
52
|
-
|
53
|
-
node = response.document.xpath('//ns:getApiVersionResponse', ns)
|
54
|
-
parse_api_version_result(node)
|
55
|
-
end
|
56
|
-
|
57
47
|
def get_accounts(session_id, first_result_position=1, total_results_requested=25, search_criteria=nil)
|
58
48
|
self.session_id = session_id
|
59
49
|
response = invoke('getAccounts', :soap_action => :none) do |message|
|
60
|
-
message.add('accountsRequest') { |
|
61
|
-
|
62
|
-
|
50
|
+
message.add('accountsRequest') { |req|
|
51
|
+
req.add 'firstResultPosition', first_result_position
|
52
|
+
req.add 'totalResultsRequested', total_results_requested
|
63
53
|
unless search_criteria.nil?
|
64
|
-
|
65
|
-
sc.add 'fieldId', search_criteria.field_id
|
66
|
-
sc.add 'operator', search_criteria.operator
|
67
|
-
sc.add 'queryValue', search_criteria.query_value
|
68
|
-
}
|
54
|
+
search_criteria.soapify_for(req)
|
69
55
|
end
|
70
56
|
}
|
71
57
|
end
|
@@ -127,13 +113,25 @@ class Landslider < Handsoap::Service
|
|
127
113
|
parse_get_account_opportunities_result(node)
|
128
114
|
end
|
129
115
|
|
130
|
-
def
|
116
|
+
def get_api_version(session_id)
|
117
|
+
self.session_id = session_id
|
118
|
+
|
119
|
+
response = invoke('getApiVersion', :soap_action => :none)
|
120
|
+
|
121
|
+
node = response.document.xpath('//ns:getApiVersionResponse', ns)
|
122
|
+
parse_api_version_result(node)
|
123
|
+
end
|
124
|
+
|
125
|
+
def get_contacts(session_id, first_result_position=1, total_results_requested=25, search_criteria=nil)
|
131
126
|
self.session_id = session_id
|
132
127
|
|
133
128
|
response = invoke('getContacts', :soap_action => :none) do |message|
|
134
|
-
message.add('contactsRequest') { |
|
135
|
-
|
136
|
-
|
129
|
+
message.add('contactsRequest') { |req|
|
130
|
+
req.add 'firstResultPosition', first_result_position
|
131
|
+
req.add 'totalResultsRequested', total_results_requested
|
132
|
+
unless search_criteria.nil?
|
133
|
+
search_criteria.soapify_for(req)
|
134
|
+
end
|
137
135
|
}
|
138
136
|
end
|
139
137
|
node = response.document.xpath('//ns:getContactsResponse', ns)
|
@@ -173,13 +171,16 @@ class Landslider < Handsoap::Service
|
|
173
171
|
parse_get_instance_information_result(node)
|
174
172
|
end
|
175
173
|
|
176
|
-
def get_leads(session_id, account_id, first_result_position=1, total_results_requested=25)
|
174
|
+
def get_leads(session_id, account_id, first_result_position=1, total_results_requested=25, search_criteria=nil)
|
177
175
|
self.session_id = session_id
|
178
176
|
|
179
177
|
response = invoke('getLeads', :soap_action => :none) do |message|
|
180
|
-
message.add('leadRequest') { |
|
181
|
-
|
182
|
-
|
178
|
+
message.add('leadRequest') { |req|
|
179
|
+
req.add 'firstResultPosition', first_result_position
|
180
|
+
req.add 'totalResultsRequested', total_results_requested
|
181
|
+
unless search_criteria.nil?
|
182
|
+
search_criteria.soapify_for(req)
|
183
|
+
end
|
183
184
|
}
|
184
185
|
end
|
185
186
|
|
@@ -215,11 +216,7 @@ class Landslider < Handsoap::Service
|
|
215
216
|
req.add 'firstResultPosition', first_result_position
|
216
217
|
req.add 'totalResultsRequested', total_results_requested
|
217
218
|
unless search_criteria.nil?
|
218
|
-
|
219
|
-
sc.add 'fieldId', search_criteria.field_id
|
220
|
-
sc.add 'operator', search_criteria.operator
|
221
|
-
sc.add 'queryValue', search_criteria.query_value
|
222
|
-
}
|
219
|
+
search_criteria.soapify_for(req)
|
223
220
|
end
|
224
221
|
}
|
225
222
|
end
|
@@ -621,6 +618,18 @@ class Landslider < Handsoap::Service
|
|
621
618
|
@operator = operator
|
622
619
|
@query_value = query_value
|
623
620
|
end
|
621
|
+
|
622
|
+
# @param [Handsoap::XmlMason::Node] msg
|
623
|
+
# @return [Handsoap::XmlMason::Node]
|
624
|
+
def soapify_for(msg)
|
625
|
+
|
626
|
+
msg.add('searchCriteria') { |crit|
|
627
|
+
crit.add 'fieldId', @field_id
|
628
|
+
crit.add 'operator', @operator
|
629
|
+
crit.add 'queryValue', @query_value unless @query_value.nil?
|
630
|
+
}
|
631
|
+
end
|
632
|
+
|
624
633
|
end
|
625
634
|
|
626
635
|
end
|
data/test/landslider_test.rb
CHANGED
@@ -6,11 +6,7 @@ class LandsliderTest < Test::Unit::TestCase
|
|
6
6
|
JAYTEST_ACCOUNT_ID = 55647822
|
7
7
|
|
8
8
|
def setup
|
9
|
-
|
10
|
-
# only get a session once
|
11
|
-
result = Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)
|
12
|
-
$sid = result[:session_id]
|
13
|
-
end
|
9
|
+
$sid ||= Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)[:session_id]
|
14
10
|
end
|
15
11
|
|
16
12
|
def test_landslider_login
|
data/test/ws_search_test.rb
CHANGED
@@ -4,11 +4,7 @@ require 'test_helper'
|
|
4
4
|
class WsSearchTest < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def setup
|
7
|
-
|
8
|
-
# only get a session once
|
9
|
-
result = Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)
|
10
|
-
$sid2 = result[:session_id]
|
11
|
-
end
|
7
|
+
$sid2 ||= Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)[:session_id]
|
12
8
|
end
|
13
9
|
|
14
10
|
def test_ws_search_object
|