landslider 0.2.2 → 0.2.3

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: 2
4
- :patch: 2
4
+ :patch: 3
5
5
  :build:
data/lib/landslider.rb CHANGED
@@ -67,6 +67,17 @@ class Landslider < Handsoap::Service
67
67
  node = response.document.xpath('//ns:getAccountsResponse', ns)
68
68
  parse_get_accounts_result(node)
69
69
  end
70
+
71
+ def get_account_by_id(session_id, account_id)
72
+ self.session_id = session_id
73
+
74
+ response = invoke("getAccountById", :soap_action => :none) do |message|
75
+ message.add 'accountId', account_id
76
+ end
77
+
78
+ node = response.document.xpath('//ns:getAccountByIdResponse', ns)
79
+ parse_get_account_by_id_result(node)
80
+ end
70
81
 
71
82
  def get_account_contacts(session_id, account_id)
72
83
  self.session_id = session_id
@@ -132,6 +143,45 @@ class Landslider < Handsoap::Service
132
143
  parse_get_opportunity_notes_result(node)
133
144
  end
134
145
 
146
+ def get_leads(session_id)
147
+ # <soap:getLeads>
148
+ # <!--Optional:-->
149
+ # <leadRequest>
150
+ # <entityId>?</entityId>
151
+ # <!--Optional:-->
152
+ # <entityName>?</entityName>
153
+ # <!--Optional:-->
154
+ # <entityType>?</entityType>
155
+ # <allowDuplicateCriterion>?</allowDuplicateCriterion>
156
+ # <firstResultPosition>?</firstResultPosition>
157
+ # <returnDeletedRecords>?</returnDeletedRecords>
158
+ # <!--Zero or more repetitions:-->
159
+ # <searchCriteria>
160
+ # <!--Optional:-->
161
+ # <fieldId>?</fieldId>
162
+ # <!--Optional:-->
163
+ # <operator>?</operator>
164
+ # <!--Optional:-->
165
+ # <queryValue>?</queryValue>
166
+ # </searchCriteria>
167
+ # <!--Optional:-->
168
+ # <sourceSystemId>?</sourceSystemId>
169
+ # <totalResultsRequested>?</totalResultsRequested>
170
+ # <!--Optional:-->
171
+ # <updatedOn>?</updatedOn>
172
+ # <accountId>?</accountId>
173
+ # <hot>?</hot>
174
+ # <hotSpecified>?</hotSpecified>
175
+ # <!--Optional:-->
176
+ # <name>?</name>
177
+ # <primaryOwnerId>?</primaryOwnerId>
178
+ # <statusId>?</statusId>
179
+ # <targetId>?</targetId>
180
+ # </leadRequest>
181
+ # </soap:getLeads>
182
+
183
+ end
184
+
135
185
  def get_lead_notes(session_id, lead_id)
136
186
  self.session_id = session_id
137
187
 
@@ -186,6 +236,15 @@ class Landslider < Handsoap::Service
186
236
  }
187
237
  end
188
238
 
239
+ def parse_get_account_by_id_result(node)
240
+ {
241
+ :account => parse_account(node.xpath('./Account/account')),
242
+ :error => xml_to_bool(node, './*/error/text()'),
243
+ :error_code => xml_to_int(node, './*/errorCode/text()'),
244
+ :result_msg => xml_to_str(node, './*/resultMsg/text()')
245
+ }
246
+ end
247
+
189
248
  def parse_get_account_notes_result(node)
190
249
  {
191
250
  :notes => parse_notes(node),
@@ -334,9 +393,9 @@ class Landslider < Handsoap::Service
334
393
  #:entity_type => xml_to_str(node, './entityType/text()'),
335
394
  :archived_by => xml_to_int(node, './archivedBy/text()'),
336
395
  :created_by => xml_to_int(node, './createdBy/text()'),
337
- :created_on => xml_to_str(node, './createdOn/text()'),
396
+ :created_on => xml_to_date(node, './createdOn/text()'),
338
397
  :latest => xml_to_bool(node, './latest/text()'),
339
- :note_id => xml_to_str(node, './noteId/text()'),
398
+ :note_id => xml_to_int(node, './noteId/text()'),
340
399
  :note_html => xml_to_str(node, './note/text()')
341
400
 
342
401
  }
@@ -32,7 +32,7 @@ class LandsliderTest < Test::Unit::TestCase
32
32
 
33
33
  def test_landslider_get_accounts
34
34
  result = Landslider.get_accounts($sid)
35
-
35
+
36
36
  assert_equal false, result[:error]
37
37
  assert_not_nil result[:accounts]
38
38
  assert result[:accounts].all? { |a| !a[:account_name].nil? }, "account name required"
@@ -41,6 +41,14 @@ class LandsliderTest < Test::Unit::TestCase
41
41
  assert_not_nil result[:result_msg]
42
42
  end
43
43
 
44
+ def test_landslider_get_account_by_id
45
+ result = Landslider.get_account_by_id($sid, 51857822)
46
+
47
+ assert_not_nil result
48
+ assert_equal false, result[:error]
49
+ assert_not_nil result[:account]
50
+ end
51
+
44
52
  def test_landslider_get_account_contacts
45
53
  # exists on jaytest
46
54
  result = Landslider.get_account_contacts($sid, 51857822)
@@ -78,6 +86,13 @@ class LandsliderTest < Test::Unit::TestCase
78
86
  validate_at_least_one_note_returned result
79
87
  end
80
88
 
89
+ def test_landslider_get_leads
90
+ result = Landslider.get_leads($sid)
91
+ puts result.inspect
92
+
93
+ end
94
+
95
+
81
96
  def test_landslider_get_lead_notes
82
97
  # exists on jaytest
83
98
  result = Landslider.get_lead_notes($sid, 33592028)
@@ -113,10 +128,5 @@ class LandsliderTest < Test::Unit::TestCase
113
128
  assert_equal Hash, result[:notes].class
114
129
  end
115
130
 
116
- # def login(session_id)
117
- # Landslider.login(session_id)
118
- # end
119
- #
120
-
121
131
  end
122
132
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: landslider
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.2
5
+ version: 0.2.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jay Prall