landslider 0.5.4 → 0.5.5
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 +9 -1
- data/lib/landslider.rb +92 -27
- data/test/landslider_test.rb +0 -30
- data/test/ws_account_note_search_test.rb +33 -0
- data/test/ws_contact_note_search_test.rb +27 -0
- data/test/ws_lead_note_search_test.rb +19 -0
- data/test/ws_opportunity_note_search_test.rb +25 -0
- metadata +9 -1
data/VERSION.yml
CHANGED
data/landslider.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
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.5"
|
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"]
|
@@ -31,6 +31,10 @@ Gem::Specification.new do |s|
|
|
31
31
|
"lib/landslider.rb",
|
32
32
|
"test/landslider_test.rb",
|
33
33
|
"test/test_helper.rb",
|
34
|
+
"test/ws_account_note_search_test.rb",
|
35
|
+
"test/ws_contact_note_search_test.rb",
|
36
|
+
"test/ws_lead_note_search_test.rb",
|
37
|
+
"test/ws_opportunity_note_search_test.rb",
|
34
38
|
"test/ws_search_test.rb"
|
35
39
|
]
|
36
40
|
s.homepage = %q{https://github.com/j4y/landslider}
|
@@ -41,6 +45,10 @@ Gem::Specification.new do |s|
|
|
41
45
|
s.test_files = [
|
42
46
|
"test/landslider_test.rb",
|
43
47
|
"test/test_helper.rb",
|
48
|
+
"test/ws_account_note_search_test.rb",
|
49
|
+
"test/ws_contact_note_search_test.rb",
|
50
|
+
"test/ws_lead_note_search_test.rb",
|
51
|
+
"test/ws_opportunity_note_search_test.rb",
|
44
52
|
"test/ws_search_test.rb"
|
45
53
|
]
|
46
54
|
|
data/lib/landslider.rb
CHANGED
@@ -8,6 +8,10 @@ class Landslider < Handsoap::Service
|
|
8
8
|
:uri => "https://#{LS_INSTANCE_NAME}.api.landslide.com/webservices/SoapService",
|
9
9
|
:version => 1
|
10
10
|
}
|
11
|
+
|
12
|
+
DEFAULT_FIRST_RESULT_POSITION=1
|
13
|
+
DEFAULT_TOTAL_RESULTS_REQUESTED=25
|
14
|
+
|
11
15
|
endpoint LS_API_ENDPOINT
|
12
16
|
|
13
17
|
attr_accessor :session_id
|
@@ -88,16 +92,11 @@ class Landslider < Handsoap::Service
|
|
88
92
|
parse_get_entity_custom_fields_result(node)
|
89
93
|
end
|
90
94
|
|
91
|
-
def get_account_notes(session_id,
|
95
|
+
def get_account_notes(session_id, search)
|
92
96
|
self.session_id = session_id
|
93
97
|
|
94
98
|
response = invoke('getAccountNotes', :soap_action => :none) do |message|
|
95
|
-
|
96
|
-
|
97
|
-
ans.add 'accountId', account_id
|
98
|
-
ans.add 'firstResultPosition', first_result_position
|
99
|
-
ans.add 'totalResultsRequested', total_results_requested
|
100
|
-
}
|
99
|
+
search.soapify_for(message)
|
101
100
|
end
|
102
101
|
node = response.document.xpath('//ns:getAccountNotesResponse', ns)
|
103
102
|
parse_get_account_notes_result(node)
|
@@ -146,15 +145,11 @@ class Landslider < Handsoap::Service
|
|
146
145
|
parse_get_entity_custom_fields_result(node)
|
147
146
|
end
|
148
147
|
|
149
|
-
def get_contact_notes(session_id,
|
148
|
+
def get_contact_notes(session_id, search)
|
150
149
|
self.session_id = session_id
|
151
150
|
|
152
151
|
response = invoke('getContactNotes', :soap_action => :none) do |message|
|
153
|
-
|
154
|
-
ans.add 'contactId', contact_id
|
155
|
-
ans.add 'firstResultPosition', first_result_position
|
156
|
-
ans.add 'totalResultsRequested', total_results_requested
|
157
|
-
}
|
152
|
+
search.soapify_for(message)
|
158
153
|
end
|
159
154
|
node = response.document.xpath('//ns:getContactNotesResponse', ns)
|
160
155
|
parse_get_contact_notes_result(node)
|
@@ -194,15 +189,11 @@ class Landslider < Handsoap::Service
|
|
194
189
|
parse_get_entity_custom_fields_result(node)
|
195
190
|
end
|
196
191
|
|
197
|
-
def get_lead_notes(session_id,
|
192
|
+
def get_lead_notes(session_id, search)
|
198
193
|
self.session_id = session_id
|
199
194
|
|
200
195
|
response = invoke('getLeadNotes', :soap_action => :none) do |message|
|
201
|
-
|
202
|
-
ans.add 'leadId', lead_id
|
203
|
-
ans.add 'firstResultPosition', first_result_position
|
204
|
-
ans.add 'totalResultsRequested', total_results_requested
|
205
|
-
}
|
196
|
+
search.soapify_for(message)
|
206
197
|
end
|
207
198
|
node = response.document.xpath('//ns:getLeadNotesResponse', ns)
|
208
199
|
parse_get_lead_notes_result(node)
|
@@ -232,16 +223,11 @@ class Landslider < Handsoap::Service
|
|
232
223
|
parse_get_entity_custom_fields_result(node)
|
233
224
|
end
|
234
225
|
|
235
|
-
def get_opportunity_notes(session_id,
|
226
|
+
def get_opportunity_notes(session_id, search)
|
236
227
|
self.session_id = session_id
|
237
228
|
|
238
229
|
response = invoke('getOpportunityNotes', :soap_action => :none) do |message|
|
239
|
-
|
240
|
-
|
241
|
-
ans.add 'opportunityId', opportunity_id
|
242
|
-
ans.add 'firstResultPosition', first_result_position
|
243
|
-
ans.add 'totalResultsRequested', total_results_requested
|
244
|
-
}
|
230
|
+
search.soapify_for(message)
|
245
231
|
end
|
246
232
|
node = response.document.xpath('//ns:getOpportunityNotesResponse', ns)
|
247
233
|
parse_get_opportunity_notes_result(node)
|
@@ -622,14 +608,93 @@ class Landslider < Handsoap::Service
|
|
622
608
|
# @param [Handsoap::XmlMason::Node] msg
|
623
609
|
# @return [Handsoap::XmlMason::Node]
|
624
610
|
def soapify_for(msg)
|
625
|
-
|
626
611
|
msg.add('searchCriteria') { |crit|
|
627
612
|
crit.add 'fieldId', @field_id
|
628
613
|
crit.add 'operator', @operator
|
629
614
|
crit.add 'queryValue', @query_value unless @query_value.nil?
|
630
615
|
}
|
631
616
|
end
|
617
|
+
end
|
632
618
|
|
619
|
+
class WsAccountNoteSearch
|
620
|
+
attr_reader :account_id
|
621
|
+
attr_writer :first_result_position, :total_results_requested, :updated_on
|
622
|
+
|
623
|
+
def initialize(account_id)
|
624
|
+
@account_id = account_id
|
625
|
+
end
|
626
|
+
|
627
|
+
# @param [Handsoap::XmlMason::Node] msg
|
628
|
+
# @return [Handsoap::XmlMason::Node]
|
629
|
+
def soapify_for(msg)
|
630
|
+
msg.add('accountNoteSearch') { |crit|
|
631
|
+
crit.add 'accountId', @account_id
|
632
|
+
crit.add 'firstResultPosition', @first_result_position || DEFAULT_FIRST_RESULT_POSITION
|
633
|
+
crit.add 'totalResultsRequested', @total_results_requested || DEFAULT_TOTAL_RESULTS_REQUESTED
|
634
|
+
crit.add 'updatedOn', @updated_on unless @updated_on.nil?
|
635
|
+
}
|
636
|
+
end
|
637
|
+
end
|
638
|
+
|
639
|
+
class WsContactNoteSearch
|
640
|
+
attr_reader :contact_id
|
641
|
+
attr_writer :first_result_position, :total_results_requested, :updated_on
|
642
|
+
|
643
|
+
def initialize(contact_id)
|
644
|
+
@contact_id = contact_id
|
645
|
+
end
|
646
|
+
|
647
|
+
# @param [Handsoap::XmlMason::Node] msg
|
648
|
+
# @return [Handsoap::XmlMason::Node]
|
649
|
+
def soapify_for(msg)
|
650
|
+
msg.add('contactNote') { |crit|
|
651
|
+
crit.add 'contactId', @contact_id
|
652
|
+
crit.add 'firstResultPosition', @first_result_position || DEFAULT_FIRST_RESULT_POSITION
|
653
|
+
crit.add 'totalResultsRequested', @total_results_requested || DEFAULT_TOTAL_RESULTS_REQUESTED
|
654
|
+
crit.add 'updatedOn', @updated_on unless @updated_on.nil?
|
655
|
+
}
|
656
|
+
end
|
657
|
+
end
|
658
|
+
|
659
|
+
class WsLeadNoteSearch
|
660
|
+
attr_reader :lead_id
|
661
|
+
attr_writer :first_result_position, :total_results_requested, :updated_on
|
662
|
+
|
663
|
+
def initialize(lead_id)
|
664
|
+
@lead_id = lead_id
|
665
|
+
end
|
666
|
+
|
667
|
+
# @param [Handsoap::XmlMason::Node] msg
|
668
|
+
# @return [Handsoap::XmlMason::Node]
|
669
|
+
def soapify_for(msg)
|
670
|
+
msg.add('leadNote') { |crit|
|
671
|
+
crit.add 'leadId', @lead_id
|
672
|
+
crit.add 'firstResultPosition', @first_result_position || DEFAULT_FIRST_RESULT_POSITION
|
673
|
+
crit.add 'totalResultsRequested', @total_results_requested || DEFAULT_TOTAL_RESULTS_REQUESTED
|
674
|
+
crit.add 'updatedOn', @updated_on unless @updated_on.nil?
|
675
|
+
}
|
676
|
+
end
|
677
|
+
|
678
|
+
end
|
679
|
+
|
680
|
+
class WsOpportunityNoteSearch
|
681
|
+
attr_reader :opportunity_id
|
682
|
+
attr_writer :first_result_position, :total_results_requested, :updated_on
|
683
|
+
|
684
|
+
def initialize(opportunity_id)
|
685
|
+
@opportunity_id = opportunity_id
|
686
|
+
end
|
687
|
+
|
688
|
+
# @param [Handsoap::XmlMason::Node] msg
|
689
|
+
# @return [Handsoap::XmlMason::Node]
|
690
|
+
def soapify_for(msg)
|
691
|
+
msg.add('opportunityNote') { |crit|
|
692
|
+
crit.add 'opportunityId', @opportunity_id
|
693
|
+
crit.add 'firstResultPosition', @first_result_position || DEFAULT_FIRST_RESULT_POSITION
|
694
|
+
crit.add 'totalResultsRequested', @total_results_requested || DEFAULT_TOTAL_RESULTS_REQUESTED
|
695
|
+
crit.add 'updatedOn', @updated_on unless @updated_on.nil?
|
696
|
+
}
|
697
|
+
end
|
633
698
|
end
|
634
699
|
|
635
700
|
end
|
data/test/landslider_test.rb
CHANGED
@@ -86,14 +86,7 @@ class LandsliderTest < Test::Unit::TestCase
|
|
86
86
|
assert_not_nil result[:custom_fields]
|
87
87
|
assert_not_nil result[:custom_fields].first[:custom_field_id]
|
88
88
|
end
|
89
|
-
|
90
|
-
def test_landslider_get_account_notes
|
91
|
-
result = Landslider.get_account_notes($sid, JAYTEST_ACCOUNT_ID)
|
92
89
|
|
93
|
-
validate_standard_api_result result
|
94
|
-
validate_at_least_one_note_returned result
|
95
|
-
end
|
96
|
-
|
97
90
|
def test_landslider_get_account_opportunities
|
98
91
|
# exists on jaytest
|
99
92
|
result = Landslider.get_account_opportunities($sid, 51858821)
|
@@ -122,13 +115,6 @@ class LandsliderTest < Test::Unit::TestCase
|
|
122
115
|
assert_not_nil result[:custom_fields].first[:custom_field_id]
|
123
116
|
end
|
124
117
|
|
125
|
-
def test_landslider_get_contact_notes
|
126
|
-
result = Landslider.get_contact_notes($sid, 62813411)
|
127
|
-
|
128
|
-
validate_standard_api_result result
|
129
|
-
validate_at_least_one_note_returned result
|
130
|
-
end
|
131
|
-
|
132
118
|
def test_landslider_get_instance_information
|
133
119
|
# Landslide API doc bug.. integer user_id doesn't work
|
134
120
|
result = Landslider.get_instance_information($sid, 'jayp@landslide.com')
|
@@ -160,27 +146,11 @@ class LandsliderTest < Test::Unit::TestCase
|
|
160
146
|
assert_not_nil result[:custom_fields].first[:custom_field_id]
|
161
147
|
end
|
162
148
|
|
163
|
-
def test_landslider_get_lead_notes
|
164
|
-
# exists on jaytest
|
165
|
-
result = Landslider.get_lead_notes($sid, 33592028)
|
166
|
-
|
167
|
-
validate_standard_api_result result
|
168
|
-
validate_at_least_one_note_returned result
|
169
|
-
end
|
170
|
-
|
171
149
|
def test_landslider_get_opportunities
|
172
150
|
result = Landslider.get_opportunities($sid)
|
173
151
|
assert_not_nil result[:opportunities]
|
174
152
|
end
|
175
153
|
|
176
|
-
def test_landslider_get_opportunity_notes
|
177
|
-
# exists on jaytest
|
178
|
-
result = Landslider.get_opportunity_notes($sid, 55952453)
|
179
|
-
|
180
|
-
validate_standard_api_result result
|
181
|
-
validate_at_least_one_note_returned result
|
182
|
-
end
|
183
|
-
|
184
154
|
def test_landslider_get_user_information
|
185
155
|
result = Landslider.get_user_information($sid, 'jayp@landslide.com')
|
186
156
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
class WsAccountNoteSearchTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
$sid3 ||= Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)[:session_id]
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_account_note_search
|
11
|
+
search = Landslider::WsAccountNoteSearch.new(55647822)
|
12
|
+
result = Landslider.get_account_notes($sid3, search)
|
13
|
+
assert_equal false, result[:error]
|
14
|
+
assert_equal 7, result[:results_returned]
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_account_note_search_limit_by_updated_on
|
18
|
+
search = Landslider::WsAccountNoteSearch.new(55647822)
|
19
|
+
search.updated_on = '2011-04-21'
|
20
|
+
result = Landslider.get_account_notes($sid3, search)
|
21
|
+
assert_equal false, result[:error]
|
22
|
+
assert_equal 2, result[:results_returned]
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_account_note_search_limit_by_results_requested
|
26
|
+
search = Landslider::WsAccountNoteSearch.new(55647822)
|
27
|
+
search.total_results_requested = 4
|
28
|
+
result = Landslider.get_account_notes($sid3, search)
|
29
|
+
assert_equal false, result[:error]
|
30
|
+
assert_equal 4, result[:results_returned]
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
class WsContactNoteSearchTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
$sid4 ||= Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)[:session_id]
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_contact_note_search
|
11
|
+
search = Landslider::WsContactNoteSearch.new(62813411)
|
12
|
+
result = Landslider.get_contact_notes($sid4, search)
|
13
|
+
|
14
|
+
assert_equal false, result[:error]
|
15
|
+
assert_equal 2, result[:results_returned]
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_contact_note_search_limit_by_results_requested
|
19
|
+
search = Landslider::WsContactNoteSearch.new(62813411)
|
20
|
+
search.total_results_requested = 1
|
21
|
+
result = Landslider.get_contact_notes($sid4, search)
|
22
|
+
|
23
|
+
assert_equal false, result[:error]
|
24
|
+
assert_equal 1, result[:results_returned]
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
class WsLeadNoteSearchTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
$sid5 ||= Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)[:session_id]
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_opportunity_note_search
|
11
|
+
search = Landslider::WsLeadNoteSearch.new(33592028)
|
12
|
+
result = Landslider.get_lead_notes($sid5, search)
|
13
|
+
|
14
|
+
assert_equal false, result[:error]
|
15
|
+
assert_equal 1, result[:results_returned]
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
class WsOpportunityNoteSearchTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
$sid0 ||= Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)[:session_id]
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_opportunity_note_search
|
11
|
+
search = Landslider::WsOpportunityNoteSearch.new(55952453)
|
12
|
+
result = Landslider.get_opportunity_notes($sid0, search)
|
13
|
+
assert_equal false, result[:error]
|
14
|
+
assert_equal 2, result[:results_returned]
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_opportunity_note_search_limit_by_results_requested
|
18
|
+
search = Landslider::WsOpportunityNoteSearch.new(55952453)
|
19
|
+
search.total_results_requested = 1
|
20
|
+
result = Landslider.get_opportunity_notes($sid0, search)
|
21
|
+
assert_equal false, result[:error]
|
22
|
+
assert_equal 1, result[:results_returned]
|
23
|
+
end
|
24
|
+
|
25
|
+
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.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jay Prall
|
@@ -79,6 +79,10 @@ files:
|
|
79
79
|
- lib/landslider.rb
|
80
80
|
- test/landslider_test.rb
|
81
81
|
- test/test_helper.rb
|
82
|
+
- test/ws_account_note_search_test.rb
|
83
|
+
- test/ws_contact_note_search_test.rb
|
84
|
+
- test/ws_lead_note_search_test.rb
|
85
|
+
- test/ws_opportunity_note_search_test.rb
|
82
86
|
- test/ws_search_test.rb
|
83
87
|
has_rdoc: true
|
84
88
|
homepage: https://github.com/j4y/landslider
|
@@ -111,4 +115,8 @@ summary: Landslide Ruby
|
|
111
115
|
test_files:
|
112
116
|
- test/landslider_test.rb
|
113
117
|
- test/test_helper.rb
|
118
|
+
- test/ws_account_note_search_test.rb
|
119
|
+
- test/ws_contact_note_search_test.rb
|
120
|
+
- test/ws_lead_note_search_test.rb
|
121
|
+
- test/ws_opportunity_note_search_test.rb
|
114
122
|
- test/ws_search_test.rb
|