infusionsoft 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/infusionsoft/connection.rb +17 -30
- data/lib/infusionsoft/version.rb +1 -1
- metadata +4 -4
@@ -4,45 +4,32 @@ module Infusionsoft
|
|
4
4
|
module Connection
|
5
5
|
private
|
6
6
|
|
7
|
+
@retry_count = 0
|
8
|
+
|
7
9
|
def connection(service_call, *args)
|
8
10
|
server = XMLRPC::Client.new3({
|
9
|
-
'host' => api_url,
|
10
|
-
'path' => "/api/xmlrpc",
|
11
|
-
'port' => 443,
|
11
|
+
'host' => api_url,
|
12
|
+
'path' => "/api/xmlrpc",
|
13
|
+
'port' => 443,
|
12
14
|
'use_ssl' => true
|
13
15
|
})
|
14
|
-
begin
|
15
|
-
|
16
|
+
begin
|
17
|
+
result = server.call("#{service_call}", api_key, *args)
|
18
|
+
if result.nil?; result = [] end
|
19
|
+
rescue Timeout::Error
|
20
|
+
@retry_count += 1
|
21
|
+
puts "*** INFUSION API TIMEOUT: retrying #{@retry_count} ***"
|
22
|
+
retry if ok_to_retry
|
16
23
|
rescue XMLRPC::FaultException => e
|
17
|
-
|
24
|
+
puts "*** INFUSION API ERROR: #{e.faultCode} - #{e.faultString} ***"
|
18
25
|
end
|
26
|
+
|
19
27
|
return result
|
20
28
|
end
|
21
29
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
## Catch for transietn Infusionsoft connection errors
|
26
|
-
#puts "*** INFUSION API ERROR: Transient read error *** retrying: #{@retry_count}"
|
27
|
-
#self.retry_count += 1
|
28
|
-
#retry if detail.ok_to_retry
|
29
|
-
#rescue XMLRPC::FaultException => e
|
30
|
-
#puts "*** INFUSION API ERROR: #{e.faultCode} - #{e.faultString} ***"
|
31
|
-
#rescue Timeout::Error
|
32
|
-
#detail = RetryException.new(true, @retry_count)
|
33
|
-
#puts "*** INFUSION API ERROR: Timeout *** retrying #{@retry_count}"
|
34
|
-
#@retry_count += 1
|
35
|
-
#retry if detail.ok_to_retry
|
36
|
-
#rescue
|
37
|
-
#detail = RetryException.new(true, @retry_count)
|
38
|
-
## This is most likely a catch for the infamous Content-Type bug from Infusionsoft.
|
39
|
-
## Their response has an issue where it isn't sending back a Content-Type in the header,
|
40
|
-
## which throws an nill error in the xml-rpc client in Ruby.
|
41
|
-
## see xmlrcp/client.rb:552 and xmlrpc/utils.rb:159 in Ruby Standard Library.
|
42
|
-
#puts "*** INFUSION API ERROR: Content Type is nil back from Infusionsoft *** retrying: #{@retry_count}"
|
43
|
-
#@retry_count += 1
|
44
|
-
#retry if detail.ok_to_retry
|
45
|
-
#end
|
30
|
+
def ok_to_retry
|
31
|
+
@retry_count <= 5 ? true : false
|
32
|
+
end
|
46
33
|
|
47
34
|
end
|
48
35
|
end
|
data/lib/infusionsoft/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infusionsoft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 7
|
10
|
+
version: 1.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nathan Leavitt
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-11-
|
18
|
+
date: 2011-11-22 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|