landslider 0.5.26 → 0.5.28
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -0
- data/VERSION.yml +1 -1
- data/landslider.gemspec +6 -2
- data/lib/landslider.rb +66 -1
- data/lib/landslider/entities.rb +3 -0
- data/lib/landslider/entities/ws_entity.rb +3 -0
- data/lib/landslider/entities/ws_task.rb +36 -0
- data/lib/landslider/entities/ws_task_search.rb +26 -0
- data/test/get_accounts_test.rb +2 -2
- data/test/get_tasks_test.rb +39 -0
- data/test/landslider_test.rb +0 -1
- data/test/ws_account_contact_search_test.rb +7 -7
- data/test/ws_search_test.rb +3 -3
- metadata +6 -2
data/README.md
CHANGED
@@ -79,6 +79,7 @@ API methods
|
|
79
79
|
|
80
80
|
Here is a list of API methods that have been added:
|
81
81
|
|
82
|
+
* addTask
|
82
83
|
* login
|
83
84
|
* getApiVersion
|
84
85
|
* getAccounts
|
@@ -99,6 +100,7 @@ API methods
|
|
99
100
|
* getOpportunities
|
100
101
|
* getOpportunityCustomFields
|
101
102
|
* getOpportunityNotes
|
103
|
+
* getTasks
|
102
104
|
* getUserInformation
|
103
105
|
* getUserInformationById
|
104
106
|
* runMyListbyId
|
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.28"
|
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-
|
12
|
+
s.date = %q{2011-12-15}
|
13
13
|
s.description = %q{Landslider is a ruby interface to the Landslide SOAP-based API}
|
14
14
|
s.email = %q{jay@j4y.net}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -64,12 +64,15 @@ Gem::Specification.new do |s|
|
|
64
64
|
"lib/landslider/entities/ws_search_criterion.rb",
|
65
65
|
"lib/landslider/entities/ws_search_operator.rb",
|
66
66
|
"lib/landslider/entities/ws_selling_process.rb",
|
67
|
+
"lib/landslider/entities/ws_task.rb",
|
68
|
+
"lib/landslider/entities/ws_task_search.rb",
|
67
69
|
"lib/landslider/entities/ws_user.rb",
|
68
70
|
"lib/landslider/entities/ws_user_search.rb",
|
69
71
|
"tasks/landslider.rake",
|
70
72
|
"test/get_account_types_test.rb",
|
71
73
|
"test/get_accounts_test.rb",
|
72
74
|
"test/get_contact_test.rb",
|
75
|
+
"test/get_tasks_test.rb",
|
73
76
|
"test/landslider_test.rb",
|
74
77
|
"test/run_mylist_by_id_test.rb",
|
75
78
|
"test/test_helper.rb",
|
@@ -89,6 +92,7 @@ Gem::Specification.new do |s|
|
|
89
92
|
"test/get_account_types_test.rb",
|
90
93
|
"test/get_accounts_test.rb",
|
91
94
|
"test/get_contact_test.rb",
|
95
|
+
"test/get_tasks_test.rb",
|
92
96
|
"test/landslider_test.rb",
|
93
97
|
"test/run_mylist_by_id_test.rb",
|
94
98
|
"test/test_helper.rb",
|
data/lib/landslider.rb
CHANGED
@@ -51,6 +51,18 @@ class Landslider < Handsoap::Service
|
|
51
51
|
node = response.document.xpath('//ns:loginResponse/loginResponse', ns)
|
52
52
|
parse_login_result(node)
|
53
53
|
end
|
54
|
+
|
55
|
+
def add_task(session_id, task)
|
56
|
+
self.session_id = session_id
|
57
|
+
response = invoke('urn:addTask', :soap_action => :none) do |message|
|
58
|
+
message.add('task') { |req|
|
59
|
+
task.soapify_for(req)
|
60
|
+
}
|
61
|
+
end
|
62
|
+
node = response.document.xpath('//ns:addTaskResponse/Status', ns)
|
63
|
+
parse_add_task_result(node)
|
64
|
+
|
65
|
+
end
|
54
66
|
|
55
67
|
# @param [WsAccountSearch] search
|
56
68
|
# @param [String] session_id
|
@@ -292,6 +304,20 @@ class Landslider < Handsoap::Service
|
|
292
304
|
parse_get_opportunity_notes_result(node)
|
293
305
|
end
|
294
306
|
|
307
|
+
# @param [String] session_id
|
308
|
+
# @return [Hash]
|
309
|
+
def get_tasks(session_id, search)
|
310
|
+
self.session_id = session_id
|
311
|
+
|
312
|
+
response = invoke('urn:getTasks', :soap_action => :none) do |message|
|
313
|
+
message.add('taskSearch') { |req|
|
314
|
+
search.soapify_for(req)
|
315
|
+
}
|
316
|
+
end
|
317
|
+
node = response.document.xpath('//ns:getTasksResponse', ns)
|
318
|
+
parse_get_tasks_result(node)
|
319
|
+
end
|
320
|
+
|
295
321
|
# @param [String] session_id
|
296
322
|
# @param [String] user_id usually in the form of user@example.com
|
297
323
|
# @return [Hash]
|
@@ -347,6 +373,14 @@ class Landslider < Handsoap::Service
|
|
347
373
|
:session_id => xml_to_str(node, './sessionId/text()')
|
348
374
|
}
|
349
375
|
end
|
376
|
+
|
377
|
+
def parse_add_task_result(node)
|
378
|
+
{
|
379
|
+
:error => xml_to_bool(node, './error/text()'),
|
380
|
+
:error_code => xml_to_int(node, './errorCode/text()'),
|
381
|
+
:created => xml_to_bool(node, './created/text()')
|
382
|
+
}
|
383
|
+
end
|
350
384
|
|
351
385
|
def parse_api_version_result(node)
|
352
386
|
{
|
@@ -523,7 +557,19 @@ class Landslider < Handsoap::Service
|
|
523
557
|
:total_results_available => xml_to_int(node, './*/totalResultsAvailable/text()')
|
524
558
|
}.merge(notes)
|
525
559
|
end
|
526
|
-
|
560
|
+
|
561
|
+
def parse_get_tasks_result(node)
|
562
|
+
tasks = parse_tasks(node)
|
563
|
+
{
|
564
|
+
:error => xml_to_bool(node, './*/error/text()'),
|
565
|
+
:error_code => xml_to_int(node, './*/errorCode/text()'),
|
566
|
+
:result_msg => xml_to_str(node, './*/resultMsg/text()'),
|
567
|
+
:status_code => xml_to_int(node, './*/statusCode/text()'),
|
568
|
+
:results_returned => xml_to_int(node, './*/resultsReturned/text()'),
|
569
|
+
:total_results_available => xml_to_int(node, './*/totalResultsAvailable/text()')
|
570
|
+
}.merge(tasks)
|
571
|
+
end
|
572
|
+
|
527
573
|
def parse_get_user_information_by_id_result(node)
|
528
574
|
{
|
529
575
|
:employee => parse_employee(node.xpath('./WsEmployee/employee')),
|
@@ -718,6 +764,25 @@ class Landslider < Handsoap::Service
|
|
718
764
|
:start_date => xml_to_date(node, './startDate/text()')
|
719
765
|
}
|
720
766
|
end
|
767
|
+
|
768
|
+
def parse_tasks(node)
|
769
|
+
{
|
770
|
+
:tasks => node.xpath('./*/taskList', ns).map { |child| parse_task(child) }
|
771
|
+
}
|
772
|
+
end
|
773
|
+
|
774
|
+
# WsTask
|
775
|
+
def parse_task(node)
|
776
|
+
{
|
777
|
+
:created_by => xml_to_int(node, './task/createdBy/text()'),
|
778
|
+
:created_on => xml_to_date(node, './task/createdOn/text()'),
|
779
|
+
:completed => xml_to_bool(node, './task/completed/text()'),
|
780
|
+
:description => xml_to_str(node, './task/description/text()'),
|
781
|
+
:due_date => xml_to_date(node, './task/dueDate/text()'),
|
782
|
+
:assigned_to => xml_to_int(node, './task/assignedTo/text()'),
|
783
|
+
:updated_on => xml_to_date(node, './task/updatedOn/text()'),
|
784
|
+
}
|
785
|
+
end
|
721
786
|
|
722
787
|
end
|
723
788
|
|
data/lib/landslider/entities.rb
CHANGED
@@ -38,6 +38,9 @@ require 'landslider/entities/ws_product'
|
|
38
38
|
require 'landslider/entities/ws_product_family'
|
39
39
|
require 'landslider/entities/ws_product_result'
|
40
40
|
|
41
|
+
require 'landslider/entities/ws_task_search'
|
42
|
+
require 'landslider/entities/ws_task'
|
43
|
+
|
41
44
|
|
42
45
|
require 'landslider/entities/ws_search'
|
43
46
|
require 'landslider/entities/ws_selling_process'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
class Landslider
|
3
|
+
|
4
|
+
class WsTask < WsEntity
|
5
|
+
|
6
|
+
# @return [Integer]
|
7
|
+
attr_reader :task_id, :created_by, :archived_by, :associated_contact_id, :associated_entity_id, :updated_by
|
8
|
+
|
9
|
+
# Required
|
10
|
+
# @return [String]
|
11
|
+
attr_writer :task_name
|
12
|
+
|
13
|
+
# @return [Date]
|
14
|
+
attr_writer :due_date
|
15
|
+
|
16
|
+
# @return [Integer]
|
17
|
+
attr_writer :assigned_to
|
18
|
+
|
19
|
+
# @return [Boolean]
|
20
|
+
attr_reader :completed
|
21
|
+
|
22
|
+
# @param [Handsoap::XmlMason::Node] msg
|
23
|
+
# @return [Handsoap::XmlMason::Node]
|
24
|
+
def soapify_for(msg)
|
25
|
+
super(msg)
|
26
|
+
msg.add 'taskName', @task_name unless @task_name.nil?
|
27
|
+
msg.add 'dueDate', @due_date unless @due_date.nil?
|
28
|
+
msg.add 'assignedTo', @assigned_to.to_i unless @assigned_to.nil?
|
29
|
+
|
30
|
+
msg.add 'completed', @completed
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
class Landslider
|
3
|
+
|
4
|
+
# search criteria for getTasks
|
5
|
+
class WsTaskSearch < WsSearch
|
6
|
+
|
7
|
+
# @return [Integer]
|
8
|
+
attr_writer :assigned_to, :created_by, :task_type_id, :associated_entity_id, :associated_contact_id
|
9
|
+
|
10
|
+
# @return [Date]
|
11
|
+
attr_writer :updated_on
|
12
|
+
|
13
|
+
# @param [Handsoap::XmlMason::Node] msg
|
14
|
+
# @return [Handsoap::XmlMason::Node]
|
15
|
+
def soapify_for(msg)
|
16
|
+
super(msg)
|
17
|
+
msg.add 'assignedTo', @assigned_to unless @assigned_to.nil?
|
18
|
+
msg.add 'createdBy', @created_by unless @created_by.nil?
|
19
|
+
msg.add 'taskTypeId', @task_type_id unless @task_type_id.nil?
|
20
|
+
msg.add 'associatedContactId', @associated_contact_id unless @associated_contact_id.nil?
|
21
|
+
msg.add 'associatedEntityId', @associated_entity_id unless @associated_entity_id.nil?
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/test/get_accounts_test.rb
CHANGED
@@ -16,7 +16,7 @@ class GetAccountsTest < Test::Unit::TestCase
|
|
16
16
|
assert_not_nil result
|
17
17
|
assert_equal false, result[:error]
|
18
18
|
assert_kind_of Array, result[:accounts]
|
19
|
-
assert_equal
|
19
|
+
assert_equal 16, result[:accounts].size
|
20
20
|
|
21
21
|
end
|
22
22
|
|
@@ -46,4 +46,4 @@ class GetAccountsTest < Test::Unit::TestCase
|
|
46
46
|
end
|
47
47
|
|
48
48
|
|
49
|
-
end
|
49
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
class GetTasksTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
# uncomment this line to debug
|
9
|
+
# Landslider.logger = $stdout
|
10
|
+
$sesson_idt7 ||= Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)[:session_id]
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_get_tasks_with_default_search
|
14
|
+
search = Landslider::WsTaskSearch.new
|
15
|
+
result = Landslider.get_tasks($sesson_idt7, search)
|
16
|
+
assert_not_nil result
|
17
|
+
assert_equal false, result[:error]
|
18
|
+
assert_kind_of Array, result[:tasks]
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def test_add_task
|
23
|
+
|
24
|
+
user_info = Landslider.get_user_information($sesson_idt7, LS_API_USERNAME)
|
25
|
+
|
26
|
+
# TODO: come up with a better way for constructing objects
|
27
|
+
task = Landslider::WsTask.new
|
28
|
+
dt = DateTime.strptime("2011-12-25T11:25:56-05:00")
|
29
|
+
task.task_name='task for ' + dt.to_s
|
30
|
+
task.due_date= dt
|
31
|
+
task.assigned_to = user_info[:employee][:employee_id]
|
32
|
+
|
33
|
+
result = Landslider.add_task($sesson_idt7, task)
|
34
|
+
assert_not_nil result
|
35
|
+
assert_equal false, result[:error]
|
36
|
+
assert_equal true, result[:created]
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
data/test/landslider_test.rb
CHANGED
@@ -138,7 +138,6 @@ class LandsliderTest < Test::Unit::TestCase
|
|
138
138
|
|
139
139
|
def test_landslider_get_user_information
|
140
140
|
result = Landslider.get_user_information($sid, 'jayp@landslide.com')
|
141
|
-
|
142
141
|
assert_not_nil result
|
143
142
|
assert_equal false, result[:error]
|
144
143
|
assert_not_nil result[:employee]
|
@@ -8,14 +8,14 @@ class WsAccountContactSearchTest < Test::Unit::TestCase
|
|
8
8
|
$sess4 ||= Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)[:session_id]
|
9
9
|
end
|
10
10
|
|
11
|
-
def test_ws_account_contact_search
|
12
|
-
search = Landslider::WsAccountContactSearch.new(55647822)
|
13
|
-
|
14
|
-
result = Landslider.get_account_contacts($sess4, search)
|
11
|
+
#def test_ws_account_contact_search
|
12
|
+
#search = Landslider::WsAccountContactSearch.new(55647822)
|
13
|
+
#
|
14
|
+
#result = Landslider.get_account_contacts($sess4, search)
|
15
15
|
|
16
|
-
assert_equal false, result[:error]
|
16
|
+
#assert_equal false, result[:error]
|
17
17
|
# assert_equal 2, result[:results_returned]
|
18
|
-
end
|
18
|
+
#end
|
19
19
|
|
20
20
|
# def test_contact_note_search_limit_by_results_requested
|
21
21
|
# search = Landslider::WsContactNoteSearch.new(62813411)
|
@@ -26,4 +26,4 @@ class WsAccountContactSearchTest < Test::Unit::TestCase
|
|
26
26
|
# assert_equal 1, result[:results_returned]
|
27
27
|
# end
|
28
28
|
|
29
|
-
end
|
29
|
+
end
|
data/test/ws_search_test.rb
CHANGED
@@ -19,7 +19,7 @@ class WsSearchTest < Test::Unit::TestCase
|
|
19
19
|
result = Landslider.get_accounts($sid2)
|
20
20
|
|
21
21
|
assert_equal false, result[:error]
|
22
|
-
assert_equal
|
22
|
+
assert_equal 16, result[:results_returned]
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_get_accounts_with_search_criteria
|
@@ -46,7 +46,7 @@ class WsSearchTest < Test::Unit::TestCase
|
|
46
46
|
result = Landslider.get_opportunities($sid2)
|
47
47
|
|
48
48
|
assert_equal false, result[:error]
|
49
|
-
assert_equal
|
49
|
+
assert_equal 17, result[:results_returned]
|
50
50
|
end
|
51
51
|
|
52
52
|
def test_get_opportunities_with_search_criteria
|
@@ -76,4 +76,4 @@ class WsSearchTest < Test::Unit::TestCase
|
|
76
76
|
assert_equal 50, search.instance_variable_get(:@total_results_requested)
|
77
77
|
end
|
78
78
|
|
79
|
-
end
|
79
|
+
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.28
|
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-
|
13
|
+
date: 2011-12-15 00:00:00 -05:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -125,12 +125,15 @@ files:
|
|
125
125
|
- lib/landslider/entities/ws_search_criterion.rb
|
126
126
|
- lib/landslider/entities/ws_search_operator.rb
|
127
127
|
- lib/landslider/entities/ws_selling_process.rb
|
128
|
+
- lib/landslider/entities/ws_task.rb
|
129
|
+
- lib/landslider/entities/ws_task_search.rb
|
128
130
|
- lib/landslider/entities/ws_user.rb
|
129
131
|
- lib/landslider/entities/ws_user_search.rb
|
130
132
|
- tasks/landslider.rake
|
131
133
|
- test/get_account_types_test.rb
|
132
134
|
- test/get_accounts_test.rb
|
133
135
|
- test/get_contact_test.rb
|
136
|
+
- test/get_tasks_test.rb
|
134
137
|
- test/landslider_test.rb
|
135
138
|
- test/run_mylist_by_id_test.rb
|
136
139
|
- test/test_helper.rb
|
@@ -172,6 +175,7 @@ test_files:
|
|
172
175
|
- test/get_account_types_test.rb
|
173
176
|
- test/get_accounts_test.rb
|
174
177
|
- test/get_contact_test.rb
|
178
|
+
- test/get_tasks_test.rb
|
175
179
|
- test/landslider_test.rb
|
176
180
|
- test/run_mylist_by_id_test.rb
|
177
181
|
- test/test_helper.rb
|