landslider 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +5 -0
- data/README.rdoc +21 -1
- data/VERSION.yml +1 -1
- data/landslider.gemspec +1 -1
- data/lib/landslider.rb +19 -5
- data/test/landslider_test.rb +23 -6
- metadata +1 -1
data/CHANGELOG.markdown
CHANGED
data/README.rdoc
CHANGED
@@ -35,6 +35,26 @@ This gem requires the following gems:
|
|
35
35
|
:version => 2
|
36
36
|
}
|
37
37
|
|
38
|
+
response = Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)
|
38
39
|
|
40
|
+
response = Landslider.get_accounts(response[:session_id])
|
39
41
|
|
40
|
-
|
42
|
+
response[:accounts].each do |account|
|
43
|
+
puts "id: #{account[:account_id]} name: #{account[:account_name]}"
|
44
|
+
end
|
45
|
+
|
46
|
+
=== Supported API methods
|
47
|
+
|
48
|
+
* login
|
49
|
+
* getApiVersion
|
50
|
+
* getAccounts
|
51
|
+
* getAccountById
|
52
|
+
* getAccountContacts
|
53
|
+
* getAccountNotes
|
54
|
+
* getAccountOpportunities
|
55
|
+
* getContactNotes
|
56
|
+
* getInstanceInformation
|
57
|
+
* getLeads
|
58
|
+
* getLeadNotes
|
59
|
+
* getOpportunityNotes
|
60
|
+
* getUserInformationById
|
data/VERSION.yml
CHANGED
data/landslider.gemspec
CHANGED
data/lib/landslider.rb
CHANGED
@@ -73,7 +73,6 @@ class Landslider < Handsoap::Service
|
|
73
73
|
response = invoke("getAccountById", :soap_action => :none) do |message|
|
74
74
|
message.add 'accountId', account_id
|
75
75
|
end
|
76
|
-
|
77
76
|
node = response.document.xpath('//ns:getAccountByIdResponse', ns)
|
78
77
|
parse_get_account_by_id_result(node)
|
79
78
|
end
|
@@ -298,8 +297,14 @@ class Landslider < Handsoap::Service
|
|
298
297
|
|
299
298
|
def parse_get_instance_information_result(node)
|
300
299
|
{
|
300
|
+
:address => parse_address(node.xpath('./*/address')),
|
301
|
+
:company_name => xml_to_str(node, './*/companyName/text()'),
|
302
|
+
:instance_url => xml_to_str(node, './*/instanceURL/text()'),
|
303
|
+
|
301
304
|
:error => xml_to_bool(node, './*/error/text()'),
|
302
|
-
:error_code => xml_to_int(node, './*/errorCode/text()')
|
305
|
+
:error_code => xml_to_int(node, './*/errorCode/text()'),
|
306
|
+
:result_msg => xml_to_str(node, './*/resultMsg/text()'),
|
307
|
+
:status_code => xml_to_int(node, './*/statusCode/text()')
|
303
308
|
}
|
304
309
|
end
|
305
310
|
|
@@ -374,7 +379,8 @@ class Landslider < Handsoap::Service
|
|
374
379
|
:created_by => xml_to_int(node, './createdBy/text()'),
|
375
380
|
:created_on => xml_to_str(node, './createdOn/text()'),
|
376
381
|
:archived_by => xml_to_str(node, './archivedBy/text()'),
|
377
|
-
:sync_with_quickbooks => xml_to_str(node, './isSyncWithQuickbooks/text()')
|
382
|
+
:sync_with_quickbooks => xml_to_str(node, './isSyncWithQuickbooks/text()'),
|
383
|
+
:custom_fields => node.xpath('./customFields', ns).map { |child| parse_custom_field(child) }
|
378
384
|
}
|
379
385
|
|
380
386
|
end
|
@@ -417,6 +423,16 @@ class Landslider < Handsoap::Service
|
|
417
423
|
}
|
418
424
|
end
|
419
425
|
|
426
|
+
# WsCustomField
|
427
|
+
def parse_custom_field(node)
|
428
|
+
{
|
429
|
+
:custom_field_id => xml_to_int(node, './customFieldId/text()'),
|
430
|
+
:custom_field_name => xml_to_str(node, './customFieldName/text()'),
|
431
|
+
:custom_field_type => xml_to_str(node, './customFieldType/text()'),
|
432
|
+
:custom_field_value => xml_to_str(node, './customFieldValue/customFieldValue/text()')
|
433
|
+
}
|
434
|
+
end
|
435
|
+
|
420
436
|
# WsEmployee
|
421
437
|
def parse_employee(node)
|
422
438
|
{
|
@@ -449,7 +465,6 @@ class Landslider < Handsoap::Service
|
|
449
465
|
:latest => xml_to_bool(node, './latest/text()'),
|
450
466
|
:note_id => xml_to_int(node, './noteId/text()'),
|
451
467
|
:note_html => xml_to_str(node, './note/text()')
|
452
|
-
|
453
468
|
}
|
454
469
|
end
|
455
470
|
|
@@ -467,7 +482,6 @@ class Landslider < Handsoap::Service
|
|
467
482
|
:ok_to_email => xml_to_bool(node, './okToEmail/text()'),
|
468
483
|
:hot => xml_to_bool(node, './hot/text()')
|
469
484
|
}
|
470
|
-
|
471
485
|
end
|
472
486
|
|
473
487
|
# WsOpportunity
|
data/test/landslider_test.rb
CHANGED
@@ -3,6 +3,8 @@ require 'test_helper'
|
|
3
3
|
|
4
4
|
class LandsliderTest < Test::Unit::TestCase
|
5
5
|
|
6
|
+
JAYTEST_ACCOUNT_ID = 55647822
|
7
|
+
|
6
8
|
def setup
|
7
9
|
# TODO: fetch a session_id once
|
8
10
|
# if $sid.nil?
|
@@ -42,13 +44,26 @@ class LandsliderTest < Test::Unit::TestCase
|
|
42
44
|
end
|
43
45
|
|
44
46
|
def test_landslider_get_account_by_id
|
45
|
-
result = Landslider.get_account_by_id($sid,
|
47
|
+
result = Landslider.get_account_by_id($sid, JAYTEST_ACCOUNT_ID)
|
46
48
|
|
47
49
|
assert_not_nil result
|
48
50
|
assert_equal false, result[:error]
|
49
51
|
assert_not_nil result[:account]
|
50
52
|
end
|
51
53
|
|
54
|
+
def test_landslider_account_custom_fields
|
55
|
+
result = Landslider.get_account_by_id($sid, JAYTEST_ACCOUNT_ID)
|
56
|
+
|
57
|
+
assert_not_nil result
|
58
|
+
assert_equal false, result[:error]
|
59
|
+
assert_not_nil result[:account]
|
60
|
+
|
61
|
+
assert_not_nil result[:account][:custom_fields]
|
62
|
+
assert_equal Array, result[:account][:custom_fields].class
|
63
|
+
assert_operator result[:account][:custom_fields].length, :>=, 2
|
64
|
+
|
65
|
+
end
|
66
|
+
|
52
67
|
def test_landslider_get_account_contacts
|
53
68
|
# exists on jaytest
|
54
69
|
result = Landslider.get_account_contacts($sid, 51857822)
|
@@ -59,7 +74,7 @@ class LandsliderTest < Test::Unit::TestCase
|
|
59
74
|
|
60
75
|
def test_landslider_get_account_notes
|
61
76
|
# exists on jaytest
|
62
|
-
result = Landslider.get_account_notes($sid,
|
77
|
+
result = Landslider.get_account_notes($sid, JAYTEST_ACCOUNT_ID)
|
63
78
|
|
64
79
|
validate_standard_api_result result
|
65
80
|
validate_at_least_one_note_returned result
|
@@ -87,12 +102,14 @@ class LandsliderTest < Test::Unit::TestCase
|
|
87
102
|
end
|
88
103
|
|
89
104
|
def test_landslider_get_instance_information
|
90
|
-
|
91
|
-
result = Landslider.get_instance_information($sid,
|
92
|
-
|
105
|
+
# Landslide API doc bug.. integer user_id doesn't work
|
106
|
+
result = Landslider.get_instance_information($sid, 'jayp@landslide.com')
|
107
|
+
|
93
108
|
assert_not_nil result
|
94
109
|
assert_equal false, result[:error]
|
95
|
-
|
110
|
+
assert_not_nil result[:address]
|
111
|
+
assert_not_nil result[:company_name]
|
112
|
+
assert_not_nil result[:instance_url]
|
96
113
|
end
|
97
114
|
|
98
115
|
def test_landslider_get_leads
|