infusionsoft 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE.md +18 -17
- data/README.md +4 -4
- data/lib/infusionsoft.rb +1 -0
- data/lib/infusionsoft/api_logger.rb +19 -0
- data/lib/infusionsoft/client/data.rb +14 -0
- data/lib/infusionsoft/client/email.rb +11 -0
- data/lib/infusionsoft/configuration.rb +6 -1
- data/lib/infusionsoft/connection.rb +5 -2
- data/lib/infusionsoft/version.rb +1 -1
- metadata +3 -2
data/LICENSE.md
CHANGED
@@ -1,21 +1,22 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
2
|
|
3
|
-
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
3
|
+
Copyright (c) 2013 Nathan Leavitt
|
10
4
|
|
11
|
-
|
12
|
-
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
21
22
|
|
data/README.md
CHANGED
@@ -80,9 +80,8 @@ operating system. Ideally, a bug report should include a pull request with faili
|
|
80
80
|
## <a name="rubies">Supported Rubies</a>
|
81
81
|
This library aims to support the following Ruby implementations:
|
82
82
|
|
83
|
-
* Ruby 1.8.7
|
84
|
-
* Ruby 1.9
|
85
|
-
* Ruby 1.9.2
|
83
|
+
* Ruby = 1.8.7
|
84
|
+
* Ruby >= 1.9
|
86
85
|
* [JRuby](http://www.jruby.org/)
|
87
86
|
* [Rubinius](http://rubini.us/)
|
88
87
|
* [Ruby Enterprise Edition](http://www.rubyenterpriseedition.com/)
|
@@ -106,6 +105,7 @@ time of a major release, support for that Ruby version may be dropped.
|
|
106
105
|
* Need to add a history log for additional contributers
|
107
106
|
|
108
107
|
## <a name="copyright">Copyright</a>
|
109
|
-
Copyright (c)
|
108
|
+
Copyright (c) 2013 Nathan Leavitt
|
109
|
+
|
110
110
|
See [LICENSE](https://github.com/nateleavitt/infusionsoft/blob/master/LICENSE.md) for details.
|
111
111
|
|
data/lib/infusionsoft.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Infusionsoft
|
2
|
+
class APILogger
|
3
|
+
|
4
|
+
def info; end
|
5
|
+
def info(msg); $stdout.print msg end
|
6
|
+
|
7
|
+
def warn; end
|
8
|
+
def warn(msg); $stdout.print msg end
|
9
|
+
|
10
|
+
def error; end
|
11
|
+
def error(msg); $stdout.print msg end
|
12
|
+
|
13
|
+
def debug; end
|
14
|
+
def debug(msg); $stdout.print msg end
|
15
|
+
|
16
|
+
def fatal; end
|
17
|
+
def fatal(msg); $stdout.print msg end
|
18
|
+
end
|
19
|
+
end
|
@@ -71,6 +71,20 @@ module Infusionsoft
|
|
71
71
|
response = get('DataService.query', table, limit, page, data, selected_fields)
|
72
72
|
end
|
73
73
|
|
74
|
+
# Queries records in a given table to find matches on certain fields.
|
75
|
+
#
|
76
|
+
# @param [String] table
|
77
|
+
# @param [Integer] limit
|
78
|
+
# @param [Integer] page
|
79
|
+
# @param [Hash] data the data you would like to query on. { :FirstName => 'first_name' }
|
80
|
+
# @param [Array] selected_fields the fields and values you want back
|
81
|
+
# @param [String] field by which to order the output results
|
82
|
+
# @param [Boolean] true ascending, false descending
|
83
|
+
# @return [Array<Hash>] the fields and associated values
|
84
|
+
def data_query_order_by(table, limit, page, data, selected_fields, by, ascending)
|
85
|
+
response = get('DataService.query', table, limit, page, data, selected_fields, by, ascending)
|
86
|
+
end
|
87
|
+
|
74
88
|
# Adds a custom field to Infusionsoft
|
75
89
|
#
|
76
90
|
# @param [String] field_type options include Person, Company, Affiliate, Task/Appt/Note,
|
@@ -116,6 +116,17 @@ module Infusionsoft
|
|
116
116
|
html_body, text_body)
|
117
117
|
end
|
118
118
|
|
119
|
+
# This will send an email to a list of contacts, as well as record the email in the
|
120
|
+
# contacts' email history.
|
121
|
+
#
|
122
|
+
# @param [Array<Integer>] contact_list is an array of Contact id numbers you would like to send this email to
|
123
|
+
# @param [String] The Id of the template to send
|
124
|
+
# @return returns true if the email has been sent, an error will be sent back otherwise.
|
125
|
+
def email_send_template(contact_list, template_id)
|
126
|
+
response = get('APIEmailService.sendTemplate', contact_list, template_id)
|
127
|
+
end
|
128
|
+
|
129
|
+
|
119
130
|
# This method is used to update an already existing email template.
|
120
131
|
#
|
121
132
|
# @param [Integer] id
|
@@ -1,9 +1,11 @@
|
|
1
1
|
module Infusionsoft
|
2
2
|
|
3
3
|
module Configuration
|
4
|
+
# The list of available options
|
4
5
|
VALID_OPTION_KEYS = [
|
5
6
|
:api_url,
|
6
|
-
:api_key
|
7
|
+
:api_key,
|
8
|
+
:api_logger
|
7
9
|
].freeze
|
8
10
|
|
9
11
|
# @private
|
@@ -31,6 +33,9 @@ module Infusionsoft
|
|
31
33
|
#self.api_key = 'na'
|
32
34
|
#end
|
33
35
|
|
36
|
+
def api_logger
|
37
|
+
@api_logger || Infusionsoft::APILogger.new
|
38
|
+
end
|
34
39
|
end
|
35
40
|
|
36
41
|
end
|
@@ -12,8 +12,9 @@ module Infusionsoft
|
|
12
12
|
'use_ssl' => true
|
13
13
|
})
|
14
14
|
begin
|
15
|
+
api_logger.info "CALL: #{service_call} api_key:#{api_key} at:#{Time.now} args:#{args.inspect}"
|
15
16
|
result = server.call("#{service_call}", api_key, *args)
|
16
|
-
if result.nil?;
|
17
|
+
if result.nil?; ok_to_retry('nil response') end
|
17
18
|
rescue Timeout::Error => timeout
|
18
19
|
# Retry up to 5 times on a Timeout before raising it
|
19
20
|
ok_to_retry(timeout) ? retry : raise
|
@@ -22,13 +23,14 @@ module Infusionsoft
|
|
22
23
|
raise InfusionAPIError.new(e.to_s, e)
|
23
24
|
end
|
24
25
|
|
26
|
+
api_logger.info "RESULT:#{result.inspect}"
|
25
27
|
return result
|
26
28
|
end
|
27
29
|
|
28
30
|
def ok_to_retry(e)
|
29
31
|
@retry_count += 1
|
30
32
|
if @retry_count <= 5
|
31
|
-
|
33
|
+
api_logger.warn "WARNING: [#{e}] retrying #{@retry_count}"
|
32
34
|
true
|
33
35
|
else
|
34
36
|
false
|
@@ -43,6 +45,7 @@ end
|
|
43
45
|
class InfusionAPIError < StandardError
|
44
46
|
attr_reader :original
|
45
47
|
def initialize(msg, original=nil);
|
48
|
+
api_logger.error "ERROR: #{msg}"
|
46
49
|
super(msg);
|
47
50
|
@original = original;
|
48
51
|
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.5
|
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: 2013-
|
12
|
+
date: 2013-06-18 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Ruby wrapper written for the Infusionsoft API
|
15
15
|
email:
|
@@ -24,6 +24,7 @@ files:
|
|
24
24
|
- infusionsoft.gemspec
|
25
25
|
- lib/infusionsoft.rb
|
26
26
|
- lib/infusionsoft/api.rb
|
27
|
+
- lib/infusionsoft/api_logger.rb
|
27
28
|
- lib/infusionsoft/client.rb
|
28
29
|
- lib/infusionsoft/client/affiliate.rb
|
29
30
|
- lib/infusionsoft/client/contact.rb
|