infusionsoft 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -102,7 +102,7 @@ module Infusionsoft
|
|
102
102
|
# @param [Boolean] bypass_commissions
|
103
103
|
# @return [Boolean]
|
104
104
|
def invoice_add_manual_payment(invoice_id, amount, date, type, description, bypass_commissions)
|
105
|
-
response = get('InvoiceService
|
105
|
+
response = get('InvoiceService.addManualPayment', invoice_id, amount, date, type,
|
106
106
|
description, bypass_commissions)
|
107
107
|
end
|
108
108
|
|
@@ -14,19 +14,21 @@ module Infusionsoft
|
|
14
14
|
begin
|
15
15
|
result = server.call("#{service_call}", api_key, *args)
|
16
16
|
if result.nil?; result = [] end
|
17
|
-
rescue Timeout::Error
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
rescue Timeout::Error => timeout
|
18
|
+
# Retry up to 5 times on a Timeout before raising it
|
19
|
+
ok_to_retry(timeout) ? retry : raise
|
20
|
+
rescue => e
|
21
|
+
# Wrap the underlying error in an InfusionAPIError
|
22
|
+
raise InfusionAPIError.new(e.to_s, e)
|
21
23
|
end
|
22
24
|
|
23
25
|
return result
|
24
26
|
end
|
25
27
|
|
26
|
-
def ok_to_retry
|
28
|
+
def ok_to_retry(e)
|
27
29
|
@retry_count += 1
|
28
30
|
if @retry_count <= 5
|
29
|
-
Rails.logger.info "*** INFUSION API ERROR: retrying #{@retry_count} ***" if Rails
|
31
|
+
Rails.logger.info "*** INFUSION API ERROR: [#{e}] retrying #{@retry_count} ***" if Rails
|
30
32
|
true
|
31
33
|
else
|
32
34
|
false
|
@@ -36,4 +38,12 @@ module Infusionsoft
|
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|
39
|
-
|
41
|
+
# Extend StandardError to keep track of Error being wrapped
|
42
|
+
# Pattern from Exceptional Ruby by Avdi Grimm (http://avdi.org/talks/exceptional-ruby-2011-02-04/)
|
43
|
+
class InfusionAPIError < StandardError
|
44
|
+
attr_reader :original
|
45
|
+
def initialize(msg, original=nil);
|
46
|
+
super(msg);
|
47
|
+
@original = original;
|
48
|
+
end
|
49
|
+
end
|
data/lib/infusionsoft/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infusionsoft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-05-07 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Ruby wrapper written for the Infusionsoft API
|
15
15
|
email:
|