landslider 0.5.9 → 0.5.11
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.
- data/README.md +2 -1
- data/VERSION.yml +1 -1
- data/landslider.gemspec +13 -2
- data/lib/landslider.rb +97 -79
- data/test/get_account_types_test.rb +20 -0
- metadata +12 -4
data/README.md
CHANGED
@@ -26,7 +26,7 @@ Installation
|
|
26
26
|
Documentation
|
27
27
|
-------------
|
28
28
|
|
29
|
-
|
29
|
+
Read the [ruby doc](http://www.rubydoc.info/github/j4y/landslider/master/frames).
|
30
30
|
|
31
31
|
Configuration
|
32
32
|
-------------
|
@@ -85,6 +85,7 @@ API methods
|
|
85
85
|
* getAccountContacts
|
86
86
|
* getAccountNotes
|
87
87
|
* getAccountOpportunities
|
88
|
+
* getAccountTypes
|
88
89
|
* getContacts
|
89
90
|
* getContactCustomFields
|
90
91
|
* getContactNotes
|
data/VERSION.yml
CHANGED
data/landslider.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{landslider}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.11"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jay Prall"]
|
12
|
-
s.date = %q{2011-05-
|
12
|
+
s.date = %q{2011-05-13}
|
13
13
|
s.default_executable = %q{generate_api_key.rb}
|
14
14
|
s.description = %q{Landslider is a ruby interface to the Landslide SOAP-based API}
|
15
15
|
s.email = %q{jay@j4y.net}
|
@@ -65,6 +65,7 @@ Gem::Specification.new do |s|
|
|
65
65
|
"lib/landslider/entities/ws_selling_process.rb",
|
66
66
|
"lib/landslider/entities/ws_user.rb",
|
67
67
|
"lib/landslider/entities/ws_user_search.rb",
|
68
|
+
"test/get_account_types_test.rb",
|
68
69
|
"test/landslider_test.rb",
|
69
70
|
"test/test_helper.rb",
|
70
71
|
"test/ws_account_note_search_test.rb",
|
@@ -78,6 +79,16 @@ Gem::Specification.new do |s|
|
|
78
79
|
s.require_paths = ["lib"]
|
79
80
|
s.rubygems_version = %q{1.6.2}
|
80
81
|
s.summary = %q{Landslide Ruby}
|
82
|
+
s.test_files = [
|
83
|
+
"test/get_account_types_test.rb",
|
84
|
+
"test/landslider_test.rb",
|
85
|
+
"test/test_helper.rb",
|
86
|
+
"test/ws_account_note_search_test.rb",
|
87
|
+
"test/ws_contact_note_search_test.rb",
|
88
|
+
"test/ws_lead_note_search_test.rb",
|
89
|
+
"test/ws_opportunity_note_search_test.rb",
|
90
|
+
"test/ws_search_test.rb"
|
91
|
+
]
|
81
92
|
|
82
93
|
if s.respond_to? :specification_version then
|
83
94
|
s.specification_version = 3
|
data/lib/landslider.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# require 'landslider'
|
6
6
|
# response = Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)
|
7
7
|
# response = Landslider.get_accounts(response[:session_id])
|
8
|
-
# response[:accounts].each do |account|
|
8
|
+
# response[:accounts].each do |account|
|
9
9
|
# puts "id: #{account[:account_id]} name: #{account[:account_name]}"
|
10
10
|
# end
|
11
11
|
#
|
@@ -13,7 +13,7 @@
|
|
13
13
|
require 'handsoap'
|
14
14
|
|
15
15
|
class Landslider < Handsoap::Service
|
16
|
-
|
16
|
+
|
17
17
|
require 'landslider/entities'
|
18
18
|
|
19
19
|
LS_API_NAMESPACE='http://www.landslide.com/webservices/SoapService'
|
@@ -21,12 +21,12 @@ class Landslider < Handsoap::Service
|
|
21
21
|
:uri => "https://#{LS_INSTANCE_NAME}.api.landslide.com/webservices/SoapService",
|
22
22
|
:version => 1
|
23
23
|
}
|
24
|
-
|
24
|
+
|
25
25
|
DEFAULT_FIRST_RESULT_POSITION = 1
|
26
26
|
DEFAULT_TOTAL_RESULTS_REQUESTED = 25
|
27
|
-
|
27
|
+
|
28
28
|
endpoint LS_API_ENDPOINT
|
29
|
-
|
29
|
+
|
30
30
|
attr_accessor :session_id
|
31
31
|
|
32
32
|
# @param [Handsoap::XmlMason::Document] doc
|
@@ -37,7 +37,7 @@ class Landslider < Handsoap::Service
|
|
37
37
|
sh.add('urn:sessionId', self.session_id)
|
38
38
|
}
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
# @param [Handsoap::Http::Request] http_request
|
42
42
|
def on_after_create_http_request(http_request)
|
43
43
|
http_request.headers.merge!({'user-agent' => ['landslider-ruby-gem-version-0.4.6']})
|
@@ -53,15 +53,15 @@ class Landslider < Handsoap::Service
|
|
53
53
|
self.session_id = session_id
|
54
54
|
response = invoke('login', :soap_action => :none) do |message|
|
55
55
|
message.add('wsUser') { |u|
|
56
|
-
u.add 'username', ::LS_API_USERNAME
|
56
|
+
u.add 'username', ::LS_API_USERNAME
|
57
57
|
u.add 'password', ::LS_API_KEY
|
58
58
|
}
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
node = response.document.xpath('//ns:loginResponse/loginResponse', ns)
|
62
62
|
parse_login_result(node)
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
# @param [WsAccountSearch] search
|
66
66
|
# @param [String] session_id
|
67
67
|
# @return [Hash]
|
@@ -72,20 +72,20 @@ class Landslider < Handsoap::Service
|
|
72
72
|
search.soapify_for(req)
|
73
73
|
}
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
node = response.document.xpath('//ns:getAccountsResponse', ns)
|
77
77
|
parse_get_accounts_result(node)
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
# @param [String] session_id
|
81
81
|
# @return [Hash]
|
82
82
|
def get_account_by_id(session_id, account_id)
|
83
83
|
self.session_id = session_id
|
84
|
-
|
84
|
+
|
85
85
|
response = invoke('getAccountById', :soap_action => :none) do |message|
|
86
86
|
message.add 'accountId', account_id
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
node = response.document.xpath('//ns:getAccountByIdResponse', ns)
|
90
90
|
parse_get_account_by_id_result(node)
|
91
91
|
end
|
@@ -100,11 +100,11 @@ class Landslider < Handsoap::Service
|
|
100
100
|
message.add 'accountId', account_id
|
101
101
|
message.add 'isPrimary', is_primary
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
node = response.document.xpath('//ns:getAccountContactsResponse', ns)
|
105
105
|
parse_get_account_contacts_result(node)
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
108
|
# @param [String] session_id
|
109
109
|
# @return [Hash]
|
110
110
|
def get_account_custom_fields(session_id)
|
@@ -112,7 +112,7 @@ class Landslider < Handsoap::Service
|
|
112
112
|
node = response.document.xpath('//ns:getAccountCustomFieldsResponse', ns)
|
113
113
|
parse_get_entity_custom_fields_result(node)
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
116
|
# @param [String] session_id
|
117
117
|
# @param [WsSearch] search
|
118
118
|
# @return [Hash]
|
@@ -133,30 +133,40 @@ class Landslider < Handsoap::Service
|
|
133
133
|
response = invoke('getAccountOpportunities', :soap_action => :none) do |message|
|
134
134
|
message.add 'accountId', account_id
|
135
135
|
end
|
136
|
-
|
136
|
+
|
137
137
|
node = response.document.xpath('//ns:getAccountOpportunitiesResponse', ns)
|
138
138
|
parse_get_account_opportunities_result(node)
|
139
139
|
end
|
140
|
-
|
140
|
+
|
141
141
|
# @param [String] session_id
|
142
142
|
# @return [Hash]
|
143
|
-
def
|
143
|
+
def get_account_types(session_id)
|
144
144
|
self.session_id = session_id
|
145
|
+
response = invoke('getAccountTypes')
|
145
146
|
|
147
|
+
node = response.document.xpath('//ns:getAccountTypesResponse', ns)
|
148
|
+
parse_get_account_types_result(node)
|
149
|
+
end
|
150
|
+
|
151
|
+
# @param [String] session_id
|
152
|
+
# @return [Hash]
|
153
|
+
def get_api_version(session_id)
|
154
|
+
self.session_id = session_id
|
155
|
+
|
146
156
|
response = invoke('getApiVersion', :soap_action => :none)
|
147
|
-
|
157
|
+
|
148
158
|
node = response.document.xpath('//ns:getApiVersionResponse', ns)
|
149
159
|
parse_api_version_result(node)
|
150
160
|
end
|
151
|
-
|
152
|
-
|
161
|
+
|
162
|
+
|
153
163
|
# @param [String] session_id
|
154
164
|
# @param [WsContactSearch] search
|
155
165
|
# @return [Hash]
|
156
166
|
def get_contacts(session_id, search=WsSearch.new)
|
157
167
|
self.session_id = session_id
|
158
|
-
|
159
|
-
# public WsContactResultSet getContacts(WsContactSearch request)
|
168
|
+
|
169
|
+
# public WsContactResultSet getContacts(WsContactSearch request)
|
160
170
|
response = invoke('getContacts', :soap_action => :none) do |message|
|
161
171
|
message.add('contactsRequest') { |req|
|
162
172
|
search.soapify_for(req)
|
@@ -165,12 +175,12 @@ class Landslider < Handsoap::Service
|
|
165
175
|
node = response.document.xpath('//ns:getContactsResponse', ns)
|
166
176
|
parse_get_contacts_result(node)
|
167
177
|
end
|
168
|
-
|
178
|
+
|
169
179
|
# @param [String] session_id
|
170
180
|
# @return [Hash]
|
171
181
|
def get_contact_custom_fields(session_id)
|
172
182
|
self.session_id = session_id
|
173
|
-
|
183
|
+
|
174
184
|
response = invoke('getContactCustomFields')
|
175
185
|
node = response.document.xpath('//ns:getContactCustomFieldsResponse', ns)
|
176
186
|
parse_get_entity_custom_fields_result(node)
|
@@ -181,7 +191,7 @@ class Landslider < Handsoap::Service
|
|
181
191
|
# @return [Hash]
|
182
192
|
def get_contact_notes(session_id, search)
|
183
193
|
self.session_id = session_id
|
184
|
-
|
194
|
+
|
185
195
|
response = invoke('getContactNotes', :soap_action => :none) do |message|
|
186
196
|
search.soapify_for(message)
|
187
197
|
end
|
@@ -195,7 +205,7 @@ class Landslider < Handsoap::Service
|
|
195
205
|
# @return [Hash]
|
196
206
|
def get_instance_information(session_id, user_id)
|
197
207
|
self.session_id = session_id
|
198
|
-
|
208
|
+
|
199
209
|
response = invoke('getInstanceInformation', :soap_action => :none) do |message|
|
200
210
|
message.add 'userId', user_id
|
201
211
|
end
|
@@ -206,9 +216,9 @@ class Landslider < Handsoap::Service
|
|
206
216
|
# @param [String] session_id
|
207
217
|
# @param [WsLeadSearch] search
|
208
218
|
# @return [Hash]
|
209
|
-
def get_leads(session_id, search=
|
219
|
+
def get_leads(session_id, search=WsLeadSearch.new)
|
210
220
|
self.session_id = session_id
|
211
|
-
|
221
|
+
|
212
222
|
response = invoke('getLeads', :soap_action => :none) do |message|
|
213
223
|
message.add('leadRequest') { |req|
|
214
224
|
search.soapify_for(req)
|
@@ -218,7 +228,7 @@ class Landslider < Handsoap::Service
|
|
218
228
|
node = response.document.xpath('//ns:getLeadsResponse', ns)
|
219
229
|
parse_get_leads_result(node)
|
220
230
|
end
|
221
|
-
|
231
|
+
|
222
232
|
# @param [String] session_id
|
223
233
|
# @return [Hash]
|
224
234
|
def get_lead_custom_fields(session_id)
|
@@ -226,26 +236,26 @@ class Landslider < Handsoap::Service
|
|
226
236
|
node = response.document.xpath('//ns:getLeadCustomFieldsResponse', ns)
|
227
237
|
parse_get_entity_custom_fields_result(node)
|
228
238
|
end
|
229
|
-
|
239
|
+
|
230
240
|
# @param [String] session_id
|
231
241
|
# @param [WsSearch] search
|
232
242
|
# @return [Hash]
|
233
243
|
def get_lead_notes(session_id, search)
|
234
244
|
self.session_id = session_id
|
235
|
-
|
245
|
+
|
236
246
|
response = invoke('getLeadNotes', :soap_action => :none) do |message|
|
237
247
|
search.soapify_for(message)
|
238
248
|
end
|
239
249
|
node = response.document.xpath('//ns:getLeadNotesResponse', ns)
|
240
250
|
parse_get_lead_notes_result(node)
|
241
251
|
end
|
242
|
-
|
252
|
+
|
243
253
|
# @param [WsOpportunitySearch] search
|
244
254
|
# @param [String] session_id
|
245
255
|
# @return [Hash]
|
246
256
|
def get_opportunities(session_id, search=WsSearch.new)
|
247
257
|
self.session_id = session_id
|
248
|
-
|
258
|
+
|
249
259
|
response = invoke('getOpportunities', :soap_action => :none) do |message|
|
250
260
|
message.add('opportunityRequest') { |req|
|
251
261
|
search.soapify_for(req)
|
@@ -270,14 +280,14 @@ class Landslider < Handsoap::Service
|
|
270
280
|
# @return [Hash]
|
271
281
|
def get_opportunity_notes(session_id, search)
|
272
282
|
self.session_id = session_id
|
273
|
-
|
283
|
+
|
274
284
|
response = invoke('getOpportunityNotes', :soap_action => :none) do |message|
|
275
285
|
search.soapify_for(message)
|
276
286
|
end
|
277
287
|
node = response.document.xpath('//ns:getOpportunityNotesResponse', ns)
|
278
288
|
parse_get_opportunity_notes_result(node)
|
279
289
|
end
|
280
|
-
|
290
|
+
|
281
291
|
# @param [String] session_id
|
282
292
|
# @return [Hash]
|
283
293
|
def get_user_information(session_id, user_id)
|
@@ -294,14 +304,14 @@ class Landslider < Handsoap::Service
|
|
294
304
|
# @return [Hash]
|
295
305
|
def get_user_information_by_id(session_id, user_id)
|
296
306
|
self.session_id = session_id
|
297
|
-
|
307
|
+
|
298
308
|
response = invoke('getUserInformationById', :soap_action => :none) do |message|
|
299
309
|
message.add 'userId', user_id
|
300
310
|
end
|
301
311
|
node = response.document.xpath('//ns:getUserInformationByIdResponse', ns)
|
302
312
|
parse_get_user_information_by_id_result(node)
|
303
313
|
end
|
304
|
-
|
314
|
+
|
305
315
|
private
|
306
316
|
|
307
317
|
def ns
|
@@ -310,7 +320,7 @@ class Landslider < Handsoap::Service
|
|
310
320
|
|
311
321
|
def parse_login_result(node)
|
312
322
|
{
|
313
|
-
:error => xml_to_bool(node, './error/text()'),
|
323
|
+
:error => xml_to_bool(node, './error/text()'),
|
314
324
|
:error_code => xml_to_int(node, './errorCode/text()'),
|
315
325
|
:result_msg => xml_to_str(node, './resultMsg/text()'),
|
316
326
|
:status_code => xml_to_int(node, './statusCode/text()'),
|
@@ -318,7 +328,7 @@ class Landslider < Handsoap::Service
|
|
318
328
|
:session_id => xml_to_str(node, './sessionId/text()')
|
319
329
|
}
|
320
330
|
end
|
321
|
-
|
331
|
+
|
322
332
|
def parse_api_version_result(node)
|
323
333
|
{
|
324
334
|
:internal_name => xml_to_str(node, '//ApiVersion/internalName/text()'),
|
@@ -332,7 +342,7 @@ class Landslider < Handsoap::Service
|
|
332
342
|
def parse_get_accounts_result(node)
|
333
343
|
{
|
334
344
|
:accounts => node.xpath('//Accounts/accountList', ns).map { |child| parse_account(child) },
|
335
|
-
|
345
|
+
|
336
346
|
:error => xml_to_bool(node, '//Accounts/error/text()'),
|
337
347
|
:error_code => xml_to_int(node, '//Accounts/errorCode/text()'),
|
338
348
|
:result_msg => xml_to_str(node, '//Accounts/resultMsg/text()'),
|
@@ -340,19 +350,19 @@ class Landslider < Handsoap::Service
|
|
340
350
|
:total_results_available => xml_to_int(node, '//Accounts/totalResultsAvailable/text()')
|
341
351
|
}
|
342
352
|
end
|
343
|
-
|
353
|
+
|
344
354
|
def parse_get_account_by_id_result(node)
|
345
355
|
{
|
346
356
|
:account => parse_account(node.xpath('./Account/account')),
|
347
357
|
:error => xml_to_bool(node, './*/error/text()'),
|
348
358
|
:error_code => xml_to_int(node, './*/errorCode/text()'),
|
349
359
|
:result_msg => xml_to_str(node, './*/resultMsg/text()')
|
350
|
-
}
|
360
|
+
}
|
351
361
|
end
|
352
|
-
|
362
|
+
|
353
363
|
def parse_get_account_notes_result(node)
|
354
364
|
notes = parse_notes(node)
|
355
|
-
|
365
|
+
|
356
366
|
{
|
357
367
|
:error => xml_to_bool(node, './*/error/text()'),
|
358
368
|
:error_code => xml_to_int(node, './*/errorCode/text()'),
|
@@ -362,11 +372,11 @@ class Landslider < Handsoap::Service
|
|
362
372
|
:total_results_available => xml_to_int(node, './*/totalResultsAvailable/text()')
|
363
373
|
}.merge(notes)
|
364
374
|
end
|
365
|
-
|
375
|
+
|
366
376
|
def parse_get_account_opportunities_result(node)
|
367
377
|
{
|
368
378
|
:opportunities => node.xpath('./*/opportunityList', ns).map { |child| parse_opportunity(child) },
|
369
|
-
|
379
|
+
|
370
380
|
:error => xml_to_bool(node, './*/error/text()'),
|
371
381
|
:results_returned => xml_to_int(node, './*/resultsReturned/text()'),
|
372
382
|
:total_results_available => xml_to_int(node, './*/totalResultsAvailable/text()')
|
@@ -376,23 +386,30 @@ class Landslider < Handsoap::Service
|
|
376
386
|
def parse_get_account_contacts_result(node)
|
377
387
|
{
|
378
388
|
:contacts => node.xpath('./*/contactList', ns).map { |child| parse_contact(child) },
|
379
|
-
|
389
|
+
|
380
390
|
:error => xml_to_bool(node, './*/error/text()'),
|
381
391
|
:results_returned => xml_to_int(node, './*/resultsReturned/text()'),
|
382
392
|
:total_results_available => xml_to_int(node, './*/totalResultsAvailable/text()')
|
383
393
|
}
|
384
394
|
end
|
385
395
|
|
396
|
+
def parse_get_account_types_result(node)
|
397
|
+
{
|
398
|
+
:account_types => node.xpath('AccountTypes/accountTypes', ns).map { |child| parse_account_type(child) },
|
399
|
+
:error => xml_to_bool(node, 'AccountTypes/error/text()')
|
400
|
+
}
|
401
|
+
end
|
402
|
+
|
386
403
|
def parse_get_contacts_result(node)
|
387
404
|
{
|
388
405
|
:contacts => node.xpath('./*/contactList', ns).map { |child| parse_contact(child) },
|
389
|
-
|
406
|
+
|
390
407
|
:error => xml_to_bool(node, './*/error/text()'),
|
391
408
|
:results_returned => xml_to_int(node, './*/resultsReturned/text()'),
|
392
409
|
:total_results_available => xml_to_int(node, './*/totalResultsAvailable/text()')
|
393
410
|
}
|
394
411
|
end
|
395
|
-
|
412
|
+
|
396
413
|
def parse_get_contact_notes_result(node)
|
397
414
|
notes = parse_notes(node)
|
398
415
|
{
|
@@ -402,38 +419,38 @@ class Landslider < Handsoap::Service
|
|
402
419
|
:status_code => xml_to_int(node, './*/statusCode/text()'),
|
403
420
|
:results_returned => xml_to_int(node, './*/resultsReturned/text()'),
|
404
421
|
:total_results_available => xml_to_int(node, './*/totalResultsAvailable/text()')
|
405
|
-
|
422
|
+
|
406
423
|
}.merge(notes)
|
407
424
|
end
|
408
|
-
|
425
|
+
|
409
426
|
def parse_get_entity_custom_fields_result(node)
|
410
427
|
{
|
411
428
|
:custom_fields => node.xpath('./*/customFields', ns).map { |child| parse_custom_field(child) },
|
412
|
-
|
429
|
+
|
413
430
|
:error => xml_to_bool(node, './*/error/text()'),
|
414
431
|
:error_code => xml_to_int(node, './*/errorCode/text()'),
|
415
432
|
:result_msg => xml_to_str(node, './*/resultMsg/text()'),
|
416
433
|
:status_code => xml_to_int(node, './*/statusCode/text()')
|
417
434
|
}
|
418
435
|
end
|
419
|
-
|
436
|
+
|
420
437
|
def parse_get_instance_information_result(node)
|
421
438
|
{
|
422
439
|
:address => parse_address(node.xpath('./*/address')),
|
423
440
|
:company_name => xml_to_str(node, './*/companyName/text()'),
|
424
441
|
:instance_url => xml_to_str(node, './*/instanceURL/text()'),
|
425
|
-
|
442
|
+
|
426
443
|
:error => xml_to_bool(node, './*/error/text()'),
|
427
444
|
:error_code => xml_to_int(node, './*/errorCode/text()'),
|
428
445
|
:result_msg => xml_to_str(node, './*/resultMsg/text()'),
|
429
446
|
:status_code => xml_to_int(node, './*/statusCode/text()')
|
430
447
|
}
|
431
448
|
end
|
432
|
-
|
449
|
+
|
433
450
|
def parse_get_leads_result(node)
|
434
451
|
leads = parse_leads(node)
|
435
452
|
{
|
436
|
-
|
453
|
+
|
437
454
|
:error => xml_to_bool(node, './*/error/text()'),
|
438
455
|
:error_code => xml_to_int(node, './*/errorCode/text()'),
|
439
456
|
:result_msg => xml_to_str(node, './*/resultMsg/text()'),
|
@@ -442,9 +459,9 @@ class Landslider < Handsoap::Service
|
|
442
459
|
:total_results_available => xml_to_int(node, './*/totalResultsAvailable/text()')
|
443
460
|
}.merge(leads)
|
444
461
|
end
|
445
|
-
|
462
|
+
|
446
463
|
def parse_get_lead_notes_result(node)
|
447
|
-
|
464
|
+
|
448
465
|
notes = parse_notes(node)
|
449
466
|
{
|
450
467
|
:error => xml_to_bool(node, './Notes/error/text()'),
|
@@ -455,11 +472,11 @@ class Landslider < Handsoap::Service
|
|
455
472
|
:total_results_available => xml_to_int(node, './Notes/totalResultsAvailable/text()')
|
456
473
|
}.merge(notes)
|
457
474
|
end
|
458
|
-
|
475
|
+
|
459
476
|
def parse_get_opportunities_result(node)
|
460
477
|
{
|
461
478
|
:opportunities => node.xpath('./*/opportunityList', ns).map { |child| parse_opportunity(child) },
|
462
|
-
|
479
|
+
|
463
480
|
:error => xml_to_bool(node, './*/error/text()'),
|
464
481
|
:error_code => xml_to_int(node, './*/errorCode/text()'),
|
465
482
|
:result_msg => xml_to_str(node, './*/resultMsg/text()'),
|
@@ -468,7 +485,7 @@ class Landslider < Handsoap::Service
|
|
468
485
|
:total_results_available => xml_to_int(node, './*/totalResultsAvailable/text()')
|
469
486
|
}
|
470
487
|
end
|
471
|
-
|
488
|
+
|
472
489
|
def parse_get_opportunity_notes_result(node)
|
473
490
|
notes = parse_notes(node)
|
474
491
|
{
|
@@ -484,15 +501,14 @@ class Landslider < Handsoap::Service
|
|
484
501
|
def parse_get_user_information_by_id_result(node)
|
485
502
|
{
|
486
503
|
:employee => parse_employee(node.xpath('./WsEmployee/employee')),
|
487
|
-
|
504
|
+
|
488
505
|
:error => xml_to_bool(node, './*/error/text()'),
|
489
506
|
:error_code => xml_to_int(node, './*/errorCode/text()'),
|
490
507
|
:result_msg => xml_to_str(node, './*/resultMsg/text()'),
|
491
508
|
:status_code => xml_to_int(node, './*/statusCode/text()')
|
492
509
|
}
|
493
510
|
end
|
494
|
-
|
495
|
-
|
511
|
+
|
496
512
|
# WsAccount
|
497
513
|
def parse_account(node)
|
498
514
|
{
|
@@ -516,17 +532,18 @@ class Landslider < Handsoap::Service
|
|
516
532
|
:sync_with_quickbooks => xml_to_str(node, './isSyncWithQuickbooks/text()'),
|
517
533
|
:custom_fields => node.xpath('./customFields', ns).map { |child| parse_custom_field(child) }
|
518
534
|
}
|
519
|
-
|
535
|
+
|
520
536
|
end
|
521
|
-
|
537
|
+
|
522
538
|
# WsAccountType
|
523
539
|
def parse_account_type(node)
|
524
540
|
{
|
525
|
-
:
|
541
|
+
:account_type_id => xml_to_str(node, 'accountTypeId/text()'),
|
542
|
+
:account_type => xml_to_str(node, 'accountType/text()')
|
526
543
|
}
|
527
544
|
end
|
528
|
-
|
529
|
-
# WsAddress
|
545
|
+
|
546
|
+
# WsAddress
|
530
547
|
def parse_address(node)
|
531
548
|
{
|
532
549
|
:address => xml_to_str(node, './address1/text()'),
|
@@ -536,7 +553,7 @@ class Landslider < Handsoap::Service
|
|
536
553
|
:country => xml_to_str(node, './country/text()')
|
537
554
|
}
|
538
555
|
end
|
539
|
-
|
556
|
+
|
540
557
|
# WsContact
|
541
558
|
def parse_contact(node)
|
542
559
|
{
|
@@ -554,7 +571,7 @@ class Landslider < Handsoap::Service
|
|
554
571
|
:custom_fields => node.xpath('./customFields', ns).map { |child| parse_custom_field(child) }
|
555
572
|
}
|
556
573
|
end
|
557
|
-
|
574
|
+
|
558
575
|
# WsCustomField
|
559
576
|
def parse_custom_field(node)
|
560
577
|
{
|
@@ -564,7 +581,7 @@ class Landslider < Handsoap::Service
|
|
564
581
|
:custom_field_value => xml_to_str(node, './customFieldValue/customFieldValue/text()')
|
565
582
|
}
|
566
583
|
end
|
567
|
-
|
584
|
+
|
568
585
|
# WsEmployee
|
569
586
|
def parse_employee(node)
|
570
587
|
{
|
@@ -579,7 +596,7 @@ class Landslider < Handsoap::Service
|
|
579
596
|
:user_id => xml_to_str(node, './userId/text()')
|
580
597
|
}
|
581
598
|
end
|
582
|
-
|
599
|
+
|
583
600
|
def parse_notes(node)
|
584
601
|
{
|
585
602
|
:notes => node.xpath('./*/notes', ns).map { |child| parse_note(child) }
|
@@ -597,13 +614,13 @@ class Landslider < Handsoap::Service
|
|
597
614
|
:updated_on => xml_to_date(node, './updatedOn/text()'),
|
598
615
|
}
|
599
616
|
end
|
600
|
-
|
617
|
+
|
601
618
|
def parse_leads(node)
|
602
619
|
{
|
603
620
|
:leads => node.xpath('./*/leadList', ns).map { |child| parse_lead(child) }
|
604
621
|
}
|
605
622
|
end
|
606
|
-
|
623
|
+
|
607
624
|
# WsLead
|
608
625
|
def parse_lead(node)
|
609
626
|
{
|
@@ -621,10 +638,10 @@ class Landslider < Handsoap::Service
|
|
621
638
|
:ok_to_email => xml_to_bool(node, './okToEmail/text()'),
|
622
639
|
:primary_owner_id => xml_to_int(node, './primaryOwnerId/text()'),
|
623
640
|
:custom_fields => node.xpath('./customFields', ns).map { |child| parse_custom_field(child) }
|
624
|
-
|
641
|
+
|
625
642
|
}
|
626
643
|
end
|
627
|
-
|
644
|
+
|
628
645
|
# WsOpportunity
|
629
646
|
def parse_opportunity(node)
|
630
647
|
{
|
@@ -646,3 +663,4 @@ class Landslider < Handsoap::Service
|
|
646
663
|
end
|
647
664
|
|
648
665
|
end
|
666
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
class GetAccountTypesTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
# Landslider.logger = $stdout
|
8
|
+
$sesson_id ||= Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)[:session_id]
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_get_account_types
|
12
|
+
result = Landslider.get_account_types($sesson_id)
|
13
|
+
|
14
|
+
assert_not_nil result
|
15
|
+
assert_equal false, result[:error]
|
16
|
+
assert_kind_of Array, result[:account_types]
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: landslider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.5.
|
5
|
+
version: 0.5.11
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jay Prall
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
13
|
+
date: 2011-05-13 00:00:00 -04:00
|
14
14
|
default_executable: generate_api_key.rb
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- lib/landslider/entities/ws_selling_process.rb
|
114
114
|
- lib/landslider/entities/ws_user.rb
|
115
115
|
- lib/landslider/entities/ws_user_search.rb
|
116
|
+
- test/get_account_types_test.rb
|
116
117
|
- test/landslider_test.rb
|
117
118
|
- test/test_helper.rb
|
118
119
|
- test/ws_account_note_search_test.rb
|
@@ -148,5 +149,12 @@ rubygems_version: 1.6.2
|
|
148
149
|
signing_key:
|
149
150
|
specification_version: 3
|
150
151
|
summary: Landslide Ruby
|
151
|
-
test_files:
|
152
|
-
|
152
|
+
test_files:
|
153
|
+
- test/get_account_types_test.rb
|
154
|
+
- test/landslider_test.rb
|
155
|
+
- test/test_helper.rb
|
156
|
+
- test/ws_account_note_search_test.rb
|
157
|
+
- test/ws_contact_note_search_test.rb
|
158
|
+
- test/ws_lead_note_search_test.rb
|
159
|
+
- test/ws_opportunity_note_search_test.rb
|
160
|
+
- test/ws_search_test.rb
|