landslider 0.5.12 → 0.5.15
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +6 -3
- data/README.md +11 -8
- data/VERSION.yml +1 -1
- data/landslider.gemspec +6 -16
- data/lib/landslider/entities/ws_account_search.rb +7 -0
- data/lib/landslider/entities/ws_opportunity_search.rb +7 -0
- data/lib/landslider.rb +45 -5
- data/tasks/landslider.rake +27 -0
- data/test/landslider_test.rb +1 -1
- data/test/run_mylist_by_id_test.rb +22 -0
- metadata +11 -16
- data/bin/generate_api_key.rb +0 -8
data/HISTORY.md
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
|
2
|
-
# landslider 0.5.
|
2
|
+
# landslider 0.5.13 2011-05-22
|
3
|
+
* add support for the runMyListbyId api call
|
4
|
+
|
5
|
+
# landslider 0.5.7 2011-05-07
|
3
6
|
* added support for WsSearch, WsSearchCriterion, Ws*NoteSearch
|
4
7
|
|
5
|
-
# landslider 0.3.2
|
8
|
+
# landslider 0.3.2 2011-04-28
|
6
9
|
|
7
10
|
* add in custom field data for accounts
|
8
11
|
* new api methods: getInstanceInformation, getUserInformationById
|
9
12
|
|
10
|
-
# landslider 0.2.5
|
13
|
+
# landslider 0.2.5 2011-04-27
|
11
14
|
|
12
15
|
* remove curb dependency
|
data/README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
Landslider
|
2
2
|
==========
|
3
3
|
|
4
|
-
Ruby
|
4
|
+
A Ruby library for interacting with Landslide’s SOAP-based API
|
5
5
|
|
6
6
|
Introduction
|
7
7
|
------------
|
8
8
|
|
9
9
|
This gem can be used to communicate with Landslide's SOAP-based API using ruby code.
|
10
10
|
|
11
|
-
[WSDL](https://
|
11
|
+
[WSDL](https://instance_name.api.landslide.com/webservices/SoapService?wsdl) endpoint url: [https://instance_name.api.landslide.com/webservices/SoapService?wsdl](https://instance_name.api.landslide.com/webservices/SoapService?wsdl)
|
12
12
|
|
13
13
|
If you already have a landslide account, contact support to enable the API. You can also start a 30-day trial account [here](http://www.landslide.com/~jayp/en/trial).
|
14
14
|
|
@@ -31,8 +31,12 @@ Read the [ruby doc](http://rdoc.info/github/j4y/landslider).
|
|
31
31
|
Configuration
|
32
32
|
-------------
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
There is a rake task to generate the configuration settings.
|
35
|
+
|
36
|
+
$ rake landslider:gen_config
|
37
|
+
|
38
|
+
Example config:
|
39
|
+
|
36
40
|
LS_INSTANCE_NAME = 'jaytest'
|
37
41
|
LS_API_USERNAME = 'jayp@landslide.com'
|
38
42
|
LS_API_KEY = '53308ccbdcb7f23fbd81a0b2ebcf12a4'
|
@@ -41,7 +45,7 @@ Usage
|
|
41
45
|
-----
|
42
46
|
|
43
47
|
This is calling login to get a session id which is then used to get a list of accounts.
|
44
|
-
|
48
|
+
|
45
49
|
require 'landslider'
|
46
50
|
response = Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)
|
47
51
|
response = Landslider.get_accounts(response[:session_id])
|
@@ -50,8 +54,6 @@ This is calling login to get a session id which is then used to get a list of ac
|
|
50
54
|
end
|
51
55
|
|
52
56
|
|
53
|
-
|
54
|
-
|
55
57
|
Testing
|
56
58
|
-------
|
57
59
|
|
@@ -60,7 +62,7 @@ The default rake task is set to run the tests.
|
|
60
62
|
$ rake
|
61
63
|
|
62
64
|
Tests are needed here because the API uses a specific XML structure for requests and responses.
|
63
|
-
|
65
|
+
|
64
66
|
|
65
67
|
Contributing
|
66
68
|
------------
|
@@ -98,6 +100,7 @@ API methods
|
|
98
100
|
* getOpportunityNotes
|
99
101
|
* getUserInformation
|
100
102
|
* getUserInformationById
|
103
|
+
* runMyListbyId
|
101
104
|
|
102
105
|
TODO
|
103
106
|
----
|
data/VERSION.yml
CHANGED
data/landslider.gemspec
CHANGED
@@ -5,15 +5,13 @@
|
|
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.15"
|
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-
|
13
|
-
s.default_executable = %q{generate_api_key.rb}
|
12
|
+
s.date = %q{2011-05-22}
|
14
13
|
s.description = %q{Landslider is a ruby interface to the Landslide SOAP-based API}
|
15
14
|
s.email = %q{jay@j4y.net}
|
16
|
-
s.executables = ["generate_api_key.rb"]
|
17
15
|
s.extra_rdoc_files = [
|
18
16
|
"LICENSE",
|
19
17
|
"README.md"
|
@@ -26,7 +24,6 @@ Gem::Specification.new do |s|
|
|
26
24
|
"README.md",
|
27
25
|
"Rakefile",
|
28
26
|
"VERSION.yml",
|
29
|
-
"bin/generate_api_key.rb",
|
30
27
|
"init.rb",
|
31
28
|
"landslider.gemspec",
|
32
29
|
"lib/landslider.rb",
|
@@ -34,6 +31,7 @@ Gem::Specification.new do |s|
|
|
34
31
|
"lib/landslider/entities/ws_account.rb",
|
35
32
|
"lib/landslider/entities/ws_account_note.rb",
|
36
33
|
"lib/landslider/entities/ws_account_note_search.rb",
|
34
|
+
"lib/landslider/entities/ws_account_search.rb",
|
37
35
|
"lib/landslider/entities/ws_address.rb",
|
38
36
|
"lib/landslider/entities/ws_contact.rb",
|
39
37
|
"lib/landslider/entities/ws_contact_note.rb",
|
@@ -51,6 +49,7 @@ Gem::Specification.new do |s|
|
|
51
49
|
"lib/landslider/entities/ws_opportunity.rb",
|
52
50
|
"lib/landslider/entities/ws_opportunity_note.rb",
|
53
51
|
"lib/landslider/entities/ws_opportunity_note_search.rb",
|
52
|
+
"lib/landslider/entities/ws_opportunity_search.rb",
|
54
53
|
"lib/landslider/entities/ws_opportunity_status.rb",
|
55
54
|
"lib/landslider/entities/ws_payment_term.rb",
|
56
55
|
"lib/landslider/entities/ws_pick_list_item.rb",
|
@@ -66,9 +65,11 @@ Gem::Specification.new do |s|
|
|
66
65
|
"lib/landslider/entities/ws_selling_process.rb",
|
67
66
|
"lib/landslider/entities/ws_user.rb",
|
68
67
|
"lib/landslider/entities/ws_user_search.rb",
|
68
|
+
"tasks/landslider.rake",
|
69
69
|
"test/get_account_types_test.rb",
|
70
70
|
"test/get_accounts_test.rb",
|
71
71
|
"test/landslider_test.rb",
|
72
|
+
"test/run_mylist_by_id_test.rb",
|
72
73
|
"test/test_helper.rb",
|
73
74
|
"test/ws_account_note_search_test.rb",
|
74
75
|
"test/ws_contact_note_search_test.rb",
|
@@ -81,17 +82,6 @@ Gem::Specification.new do |s|
|
|
81
82
|
s.require_paths = ["lib"]
|
82
83
|
s.rubygems_version = %q{1.6.2}
|
83
84
|
s.summary = %q{Landslide Ruby}
|
84
|
-
s.test_files = [
|
85
|
-
"test/get_account_types_test.rb",
|
86
|
-
"test/get_accounts_test.rb",
|
87
|
-
"test/landslider_test.rb",
|
88
|
-
"test/test_helper.rb",
|
89
|
-
"test/ws_account_note_search_test.rb",
|
90
|
-
"test/ws_contact_note_search_test.rb",
|
91
|
-
"test/ws_lead_note_search_test.rb",
|
92
|
-
"test/ws_opportunity_note_search_test.rb",
|
93
|
-
"test/ws_search_test.rb"
|
94
|
-
]
|
95
85
|
|
96
86
|
if s.respond_to? :specification_version then
|
97
87
|
s.specification_version = 3
|
data/lib/landslider.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
|
2
|
+
require 'handsoap'
|
3
|
+
|
2
4
|
# Landslider is a soap client to the Landslide CRM SOAP-based API
|
3
5
|
# Example:
|
4
6
|
#
|
@@ -8,10 +10,6 @@
|
|
8
10
|
# response[:accounts].each do |account|
|
9
11
|
# puts "id: #{account[:account_id]} name: #{account[:account_name]}"
|
10
12
|
# end
|
11
|
-
#
|
12
|
-
|
13
|
-
require 'handsoap'
|
14
|
-
|
15
13
|
class Landslider < Handsoap::Service
|
16
14
|
|
17
15
|
require 'landslider/entities'
|
@@ -289,6 +287,7 @@ class Landslider < Handsoap::Service
|
|
289
287
|
end
|
290
288
|
|
291
289
|
# @param [String] session_id
|
290
|
+
# @param [String] user_id usually in the form of user@example.com
|
292
291
|
# @return [Hash]
|
293
292
|
def get_user_information(session_id, user_id)
|
294
293
|
|
@@ -301,6 +300,7 @@ class Landslider < Handsoap::Service
|
|
301
300
|
end
|
302
301
|
|
303
302
|
# @param [String] session_id
|
303
|
+
# @param [Integer] user_id
|
304
304
|
# @return [Hash]
|
305
305
|
def get_user_information_by_id(session_id, user_id)
|
306
306
|
self.session_id = session_id
|
@@ -312,10 +312,23 @@ class Landslider < Handsoap::Service
|
|
312
312
|
parse_get_user_information_by_id_result(node)
|
313
313
|
end
|
314
314
|
|
315
|
+
# @param [String] session_id
|
316
|
+
# @param [Integer] mylist_id
|
317
|
+
# @return [Hash]
|
318
|
+
def run_mylist_by_id(session_id, mylist_id)
|
319
|
+
self.session_id = session_id
|
320
|
+
|
321
|
+
response = invoke('runMyListbyId', :soap_action => :none) do |message|
|
322
|
+
message.add 'myListId', mylist_id
|
323
|
+
end
|
324
|
+
node = response.document.xpath('//ns:runMyListbyIdResponse', ns)
|
325
|
+
parse_run_mylist_by_id_result(node)
|
326
|
+
end
|
327
|
+
|
315
328
|
private
|
316
329
|
|
317
330
|
def ns
|
318
|
-
{ 'ns' => LS_API_NAMESPACE }
|
331
|
+
{ 'ns' => LS_API_NAMESPACE, 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance' }
|
319
332
|
end
|
320
333
|
|
321
334
|
def parse_login_result(node)
|
@@ -509,6 +522,16 @@ class Landslider < Handsoap::Service
|
|
509
522
|
}
|
510
523
|
end
|
511
524
|
|
525
|
+
def parse_run_mylist_by_id_result(node)
|
526
|
+
{
|
527
|
+
:results => node.xpath('MyListQueryResultSet/myList', ns).map { |child| parse_mylist_result(child) },
|
528
|
+
|
529
|
+
:error => xml_to_bool(node, 'MyListQueryResultSet/error/text()'),
|
530
|
+
:results_returned => xml_to_int(node, 'MyListQueryResultSet/resultsReturned/text()'),
|
531
|
+
:total_results_available => xml_to_int(node, 'MyListQueryResultSet/totalResultsAvailable/text()')
|
532
|
+
}
|
533
|
+
end
|
534
|
+
|
512
535
|
# WsAccount
|
513
536
|
def parse_account(node)
|
514
537
|
{
|
@@ -642,6 +665,23 @@ class Landslider < Handsoap::Service
|
|
642
665
|
}
|
643
666
|
end
|
644
667
|
|
668
|
+
# There are two dynamic pieces of the mylist results
|
669
|
+
# 1) A mylist result has type which is either WsAccount, WsContact, WsOpportunity, WsLead, WsNote, etc.
|
670
|
+
# 2) The fields available in the mylist result are selected as fields to display when the user builds the mylist
|
671
|
+
def parse_mylist_result(node)
|
672
|
+
result_type = xml_to_str(node, '@xsi:type')
|
673
|
+
case result_type
|
674
|
+
when "ns2:wsContact"
|
675
|
+
parse_contact(node)
|
676
|
+
when "ns2:wsLead"
|
677
|
+
parse_lead(node)
|
678
|
+
when "ns2:wsOpportunity"
|
679
|
+
parse_opportunity(node)
|
680
|
+
else
|
681
|
+
raise NotImplementedError.new result_type
|
682
|
+
end
|
683
|
+
end
|
684
|
+
|
645
685
|
# WsOpportunity
|
646
686
|
def parse_opportunity(node)
|
647
687
|
{
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'digest/md5'
|
2
|
+
|
3
|
+
namespace :landslider do
|
4
|
+
|
5
|
+
desc "generate configuration for the landslide api"
|
6
|
+
task :gen_config do
|
7
|
+
|
8
|
+
# TODO: refactor and test
|
9
|
+
def get_input
|
10
|
+
$stdin.gets.to_s.chomp
|
11
|
+
end
|
12
|
+
|
13
|
+
print "Enter a Landslide instance name: "
|
14
|
+
instance_name = get_input
|
15
|
+
|
16
|
+
print "Enter your api username:"
|
17
|
+
api_user = get_input
|
18
|
+
|
19
|
+
print "Enter your api password:"
|
20
|
+
api_password = get_input
|
21
|
+
|
22
|
+
puts "LS_INSTANCE_NAME = '#{instance_name}'"
|
23
|
+
puts "LS_API_USERNAME = '#{api_user}'"
|
24
|
+
# api key is just an md5 hash of the api password and instance name
|
25
|
+
puts "LS_API_KEY = '#{Digest::MD5.hexdigest(api_password + instance_name)}'"
|
26
|
+
end
|
27
|
+
end
|
data/test/landslider_test.rb
CHANGED
@@ -135,7 +135,7 @@ class LandsliderTest < Test::Unit::TestCase
|
|
135
135
|
assert_not_nil result[:custom_fields]
|
136
136
|
assert_not_nil result[:custom_fields].first[:custom_field_id]
|
137
137
|
end
|
138
|
-
|
138
|
+
|
139
139
|
def test_landslider_get_user_information
|
140
140
|
result = Landslider.get_user_information($sid, 'jayp@landslide.com')
|
141
141
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
class RunMylistByIdTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
# this test depends on data in the jaytest instance
|
7
|
+
JAYTEST_MYLIST_ID = 10293817
|
8
|
+
|
9
|
+
def setup
|
10
|
+
$sid7 ||= Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)[:session_id]
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_landslider_run_mylist_by_id
|
14
|
+
|
15
|
+
result = Landslider.run_mylist_by_id($sid7, JAYTEST_MYLIST_ID)
|
16
|
+
assert_equal false, result[:error]
|
17
|
+
|
18
|
+
assert_operator result[:results_returned], :>=, 0
|
19
|
+
assert_kind_of Array, result[:results]
|
20
|
+
end
|
21
|
+
|
22
|
+
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.15
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jay Prall
|
@@ -10,8 +10,8 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
14
|
-
default_executable:
|
13
|
+
date: 2011-05-22 00:00:00 -04:00
|
14
|
+
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: jeweler
|
@@ -59,8 +59,8 @@ dependencies:
|
|
59
59
|
version_requirements: *id004
|
60
60
|
description: Landslider is a ruby interface to the Landslide SOAP-based API
|
61
61
|
email: jay@j4y.net
|
62
|
-
executables:
|
63
|
-
|
62
|
+
executables: []
|
63
|
+
|
64
64
|
extensions: []
|
65
65
|
|
66
66
|
extra_rdoc_files:
|
@@ -74,7 +74,6 @@ files:
|
|
74
74
|
- README.md
|
75
75
|
- Rakefile
|
76
76
|
- VERSION.yml
|
77
|
-
- bin/generate_api_key.rb
|
78
77
|
- init.rb
|
79
78
|
- landslider.gemspec
|
80
79
|
- lib/landslider.rb
|
@@ -82,6 +81,7 @@ files:
|
|
82
81
|
- lib/landslider/entities/ws_account.rb
|
83
82
|
- lib/landslider/entities/ws_account_note.rb
|
84
83
|
- lib/landslider/entities/ws_account_note_search.rb
|
84
|
+
- lib/landslider/entities/ws_account_search.rb
|
85
85
|
- lib/landslider/entities/ws_address.rb
|
86
86
|
- lib/landslider/entities/ws_contact.rb
|
87
87
|
- lib/landslider/entities/ws_contact_note.rb
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- lib/landslider/entities/ws_opportunity.rb
|
100
100
|
- lib/landslider/entities/ws_opportunity_note.rb
|
101
101
|
- lib/landslider/entities/ws_opportunity_note_search.rb
|
102
|
+
- lib/landslider/entities/ws_opportunity_search.rb
|
102
103
|
- lib/landslider/entities/ws_opportunity_status.rb
|
103
104
|
- lib/landslider/entities/ws_payment_term.rb
|
104
105
|
- lib/landslider/entities/ws_pick_list_item.rb
|
@@ -114,9 +115,11 @@ files:
|
|
114
115
|
- lib/landslider/entities/ws_selling_process.rb
|
115
116
|
- lib/landslider/entities/ws_user.rb
|
116
117
|
- lib/landslider/entities/ws_user_search.rb
|
118
|
+
- tasks/landslider.rake
|
117
119
|
- test/get_account_types_test.rb
|
118
120
|
- test/get_accounts_test.rb
|
119
121
|
- test/landslider_test.rb
|
122
|
+
- test/run_mylist_by_id_test.rb
|
120
123
|
- test/test_helper.rb
|
121
124
|
- test/ws_account_note_search_test.rb
|
122
125
|
- test/ws_contact_note_search_test.rb
|
@@ -151,13 +154,5 @@ rubygems_version: 1.6.2
|
|
151
154
|
signing_key:
|
152
155
|
specification_version: 3
|
153
156
|
summary: Landslide Ruby
|
154
|
-
test_files:
|
155
|
-
|
156
|
-
- test/get_accounts_test.rb
|
157
|
-
- test/landslider_test.rb
|
158
|
-
- test/test_helper.rb
|
159
|
-
- test/ws_account_note_search_test.rb
|
160
|
-
- test/ws_contact_note_search_test.rb
|
161
|
-
- test/ws_lead_note_search_test.rb
|
162
|
-
- test/ws_opportunity_note_search_test.rb
|
163
|
-
- test/ws_search_test.rb
|
157
|
+
test_files: []
|
158
|
+
|
data/bin/generate_api_key.rb
DELETED