landslider 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 5
4
- :patch: 3
4
+ :patch: 4
5
5
  :build:
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.3"
8
+ s.version = "0.5.4"
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"]
data/lib/landslider.rb CHANGED
@@ -33,7 +33,6 @@ class Landslider < Handsoap::Service
33
33
 
34
34
  def login(session_id)
35
35
  self.session_id = session_id
36
-
37
36
  response = invoke('login', :soap_action => :none) do |message|
38
37
  message.add('wsUser') { |u|
39
38
  u.add 'username', ::LS_API_USERNAME
@@ -45,27 +44,14 @@ class Landslider < Handsoap::Service
45
44
  parse_login_result(node)
46
45
  end
47
46
 
48
- def get_api_version(session_id)
49
- self.session_id = session_id
50
-
51
- response = invoke('getApiVersion', :soap_action => :none)
52
-
53
- node = response.document.xpath('//ns:getApiVersionResponse', ns)
54
- parse_api_version_result(node)
55
- end
56
-
57
47
  def get_accounts(session_id, first_result_position=1, total_results_requested=25, search_criteria=nil)
58
48
  self.session_id = session_id
59
49
  response = invoke('getAccounts', :soap_action => :none) do |message|
60
- message.add('accountsRequest') { |ar|
61
- ar.add 'firstResultPosition', first_result_position
62
- ar.add 'totalResultsRequested', total_results_requested
50
+ message.add('accountsRequest') { |req|
51
+ req.add 'firstResultPosition', first_result_position
52
+ req.add 'totalResultsRequested', total_results_requested
63
53
  unless search_criteria.nil?
64
- ar.add('searchCriteria') { |sc|
65
- sc.add 'fieldId', search_criteria.field_id
66
- sc.add 'operator', search_criteria.operator
67
- sc.add 'queryValue', search_criteria.query_value
68
- }
54
+ search_criteria.soapify_for(req)
69
55
  end
70
56
  }
71
57
  end
@@ -127,13 +113,25 @@ class Landslider < Handsoap::Service
127
113
  parse_get_account_opportunities_result(node)
128
114
  end
129
115
 
130
- def get_contacts(session_id, first_result_position=1, total_results_requested=25)
116
+ def get_api_version(session_id)
117
+ self.session_id = session_id
118
+
119
+ response = invoke('getApiVersion', :soap_action => :none)
120
+
121
+ node = response.document.xpath('//ns:getApiVersionResponse', ns)
122
+ parse_api_version_result(node)
123
+ end
124
+
125
+ def get_contacts(session_id, first_result_position=1, total_results_requested=25, search_criteria=nil)
131
126
  self.session_id = session_id
132
127
 
133
128
  response = invoke('getContacts', :soap_action => :none) do |message|
134
- message.add('contactsRequest') { |c|
135
- c.add 'firstResultPosition', first_result_position
136
- c.add 'totalResultsRequested', total_results_requested
129
+ message.add('contactsRequest') { |req|
130
+ req.add 'firstResultPosition', first_result_position
131
+ req.add 'totalResultsRequested', total_results_requested
132
+ unless search_criteria.nil?
133
+ search_criteria.soapify_for(req)
134
+ end
137
135
  }
138
136
  end
139
137
  node = response.document.xpath('//ns:getContactsResponse', ns)
@@ -173,13 +171,16 @@ class Landslider < Handsoap::Service
173
171
  parse_get_instance_information_result(node)
174
172
  end
175
173
 
176
- def get_leads(session_id, account_id, first_result_position=1, total_results_requested=25)
174
+ def get_leads(session_id, account_id, first_result_position=1, total_results_requested=25, search_criteria=nil)
177
175
  self.session_id = session_id
178
176
 
179
177
  response = invoke('getLeads', :soap_action => :none) do |message|
180
- message.add('leadRequest') { |lr|
181
- lr.add 'firstResultPosition', first_result_position
182
- lr.add 'totalResultsRequested', total_results_requested
178
+ message.add('leadRequest') { |req|
179
+ req.add 'firstResultPosition', first_result_position
180
+ req.add 'totalResultsRequested', total_results_requested
181
+ unless search_criteria.nil?
182
+ search_criteria.soapify_for(req)
183
+ end
183
184
  }
184
185
  end
185
186
 
@@ -215,11 +216,7 @@ class Landslider < Handsoap::Service
215
216
  req.add 'firstResultPosition', first_result_position
216
217
  req.add 'totalResultsRequested', total_results_requested
217
218
  unless search_criteria.nil?
218
- req.add('searchCriteria') { |sc|
219
- sc.add 'fieldId', search_criteria.field_id
220
- sc.add 'operator', search_criteria.operator
221
- sc.add 'queryValue', search_criteria.query_value
222
- }
219
+ search_criteria.soapify_for(req)
223
220
  end
224
221
  }
225
222
  end
@@ -621,6 +618,18 @@ class Landslider < Handsoap::Service
621
618
  @operator = operator
622
619
  @query_value = query_value
623
620
  end
621
+
622
+ # @param [Handsoap::XmlMason::Node] msg
623
+ # @return [Handsoap::XmlMason::Node]
624
+ def soapify_for(msg)
625
+
626
+ msg.add('searchCriteria') { |crit|
627
+ crit.add 'fieldId', @field_id
628
+ crit.add 'operator', @operator
629
+ crit.add 'queryValue', @query_value unless @query_value.nil?
630
+ }
631
+ end
632
+
624
633
  end
625
634
 
626
635
  end
@@ -6,11 +6,7 @@ class LandsliderTest < Test::Unit::TestCase
6
6
  JAYTEST_ACCOUNT_ID = 55647822
7
7
 
8
8
  def setup
9
- if $sid.nil?
10
- # only get a session once
11
- result = Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)
12
- $sid = result[:session_id]
13
- end
9
+ $sid ||= Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)[:session_id]
14
10
  end
15
11
 
16
12
  def test_landslider_login
@@ -4,11 +4,7 @@ require 'test_helper'
4
4
  class WsSearchTest < Test::Unit::TestCase
5
5
 
6
6
  def setup
7
- if $sid2.nil?
8
- # only get a session once
9
- result = Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)
10
- $sid2 = result[:session_id]
11
- end
7
+ $sid2 ||= Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)[:session_id]
12
8
  end
13
9
 
14
10
  def test_ws_search_object
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: landslider
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.3
5
+ version: 0.5.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jay Prall