infusionsoft 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- result = server.call("#{service_call}", api_key, *args)
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
- puts "*** INFUSION API ERROR: #{e.faultCode} - #{e.faultString} ***"
24
+ puts "*** INFUSION API ERROR: #{e.faultCode} - #{e.faultString} ***"
18
25
  end
26
+
19
27
  return result
20
28
  end
21
29
 
22
- #end
23
- #if result.nil?; raise RetryException.new(true, @retry_count), "transient read error" end
24
- #rescue RetryException => detail
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
@@ -1,4 +1,4 @@
1
1
  module Infusionsoft
2
2
  # The version of the gem
3
- VERSION = '1.0.6'.freeze unless defined?(::Infusionsoft::VERSION)
3
+ VERSION = '1.0.7'.freeze unless defined?(::Infusionsoft::VERSION)
4
4
  end
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: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 6
10
- version: 1.0.6
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-01 00:00:00 -07:00
18
+ date: 2011-11-22 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21