infusionsoft 1.3.1a → 1.3.6a

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af3540f814b242a2b620fa3273d1202f77e8c567e5cea010e63a2c2cd74d4b5c
4
- data.tar.gz: 0d3f5450ad5036c3fa91c3bc7f20fdd2d7a51065cfca60091f23a0dcc95e6990
3
+ metadata.gz: cd4ba61ef39369dc7150b669da223411d3ad3f02357c385318e7438cd3266adb
4
+ data.tar.gz: cae8f51e2f383f6c0c959ea189b5f436439cf60fd3b718beeadd7209eda36dff
5
5
  SHA512:
6
- metadata.gz: c6df860cc753774d59ebc908df961605e5dbb211336d114b7d8fe163b67beb9956e116dd023fe95d5da8b8e32fb05f7d3af2be3336b7c3108da828278ea9f9cf
7
- data.tar.gz: 858af4e33ebee5d112770e05d617f4065a606eb71cdd6378df3a53d5411f790c0dfe5eeaddc0dfdff2a8fae4f5d88c381f76839379b0f67928a325b68a97aece
6
+ metadata.gz: 3461287b4e4443250676970365776e8f50438a55c718b4b5070b31e6cefbd6ffb0cadb5a99b4505b1ed89971d358d53cd4ec6530098d2afaacdacc4a43cc5719
7
+ data.tar.gz: 9a4860dba1b624fc8ad2773b5b51cfcf7f38b9d443c6e634df65d564f2d47f5b05389fb81bf9d95580980a698e1fc8cbecd388bf2abe6a602f9e54e7d812247c
data/.travis.yml CHANGED
@@ -1,8 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
4
- - 2.1.5
5
- - 2.2.2
6
- - 2.3.4
7
- # - 2.4.1 need to do more testing
3
+ - 2.3.8
4
+ - 2.4.5
5
+ - 2.5.3
6
+ - 2.6.1
8
7
  - jruby-20mode # JRuby in 2.0 mode
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  A Ruby wrapper for the Infusionsoft API
7
7
 
8
8
  **update notes**
9
- * upcoming - Adding support for rest api
9
+ * v1.3.5 - Rest API is now supported (documentation incoming)
10
10
  * v1.2.2 - Catching Infusionsoft API SSL handshake issues
11
11
  * v1.2.1 - Added OAuth support
12
12
  * v1.2.0 - Added `invoice_add_subscription` call to mirror Infusionsoft API parameters to eventually replace `invoice_add_recurring_order`
@@ -37,7 +37,7 @@ end
37
37
  ```
38
38
  ## OAUTH 2.0
39
39
 
40
- You will need to handle and obtain the access_token on your own.
40
+ You will need to handle and obtain the access_token on your own.
41
41
 
42
42
  ```ruby
43
43
  # You will need to attain the access_token first, then do the config like so:
@@ -98,7 +98,7 @@ features.
98
98
  ## <a name="rubies">Supported Rubies</a>
99
99
  This library aims to support the following Ruby implementations:
100
100
 
101
- * Ruby >= 2.0
101
+ * Ruby >= 2.3.8
102
102
  * [JRuby](http://www.jruby.org/)
103
103
  * [Rubinius](http://rubini.us/)
104
104
  * [Ruby Enterprise Edition](http://www.rubyenterpriseedition.com/)
@@ -122,7 +122,7 @@ time of a major release, support for that Ruby version may be dropped.
122
122
  * Need to add a history log for additional contributers
123
123
 
124
124
  ## <a name="copyright">Copyright</a>
125
- Copyright (c) 2017 Nathan Leavitt
125
+ Copyright (c) 2019 Nathan Leavitt
126
126
 
127
- See [LICENSE](https://github.com/nateleavitt/infusionsoft/blob/master/LICENSE.md) for details.
127
+ See [MIT LICENSE](https://github.com/nateleavitt/infusionsoft/blob/master/LICENSE.md) for details.
128
128
 
data/lib/infusionsoft.rb CHANGED
@@ -15,9 +15,9 @@ module Infusionsoft
15
15
  end
16
16
 
17
17
  # Delegate to ApiInfusionsoft::Client
18
- def method_missing(method, *args, &block)
18
+ def method_missing(method, *args, **kwargs, &block)
19
19
  return super unless new.respond_to?(method)
20
- new.send(method, *args, &block)
20
+ new.send(method, *args, **kwargs, &block)
21
21
  end
22
22
 
23
23
  def respond_to?(method, include_private = false)
@@ -5,13 +5,16 @@ module Infusionsoft
5
5
  module Contact
6
6
  # Creates a new contact record from the data passed in the associative array.
7
7
  #
8
- # @param [Hash] data contains the mappable contact fields and it's data
8
+ # @param [Hash] data contains the mappable contact fields and it's data.
9
+ # @param [String] (Optional) email opt in verbiage. The contact will then be
10
+ # "Opted in" using the verviage supplied here.
9
11
  # @return [Integer] the id of the newly added contact
10
12
  # @example
11
- # { :Email => 'test@test.com', :FirstName => 'first_name', :LastName => 'last_name' }
12
- def contact_add(data)
13
+ # { :Email => 'test@test.com', :FirstName => 'first_name', :LastName => 'last_name' }, 'New Signup'
14
+ def contact_add(data, optin_status=nil)
13
15
  contact_id = xmlrpc('ContactService.add', data)
14
- if data.has_key?(:Email); email_optin(data[:Email], "requested information"); end
16
+ email = data['Email'] || data[:Email]
17
+ if optin_status && email; email_optin(email, optin_status); end
15
18
  return contact_id
16
19
  end
17
20
 
@@ -28,10 +31,15 @@ module Infusionsoft
28
31
  # @param [Array<Hash>] data the contact data you want added
29
32
  # @param [String] check_type available options are 'Email', 'EmailAndName',
30
33
  # 'EmailAndNameAndCompany'
34
+ # @param [String] (Optional) email opt in verbiage. The contact will then be
35
+ # "Opted in" using the verviage supplied here.
31
36
  # @return [Integer] id of the contact added or updated
32
- def contact_add_with_dup_check(data, check_type)
37
+ # @example
38
+ # { :Email => 'test@test.com', :FirstName => 'first_name', :LastName => 'last_name' }, 'Email', 'New Signup'
39
+ def contact_add_with_dup_check(data, check_type, optin_status=nil)
33
40
  contact_id = xmlrpc('ContactService.addWithDupCheck', data, check_type)
34
- if data.has_key?(:Email); email_optin(data[:Email], "requested information"); end
41
+ email = data['Email'] || data[:Email]
42
+ if optin_status && email; email_optin(email, optin_status); end
35
43
  return contact_id
36
44
  end
37
45
 
@@ -39,12 +47,15 @@ module Infusionsoft
39
47
  #
40
48
  # @param [Integer] contact_id
41
49
  # @param [Hash] data contains the mappable contact fields and it's data
50
+ # @param [String] (Optional) email opt in verbiage. The contact will then be
51
+ # "Opted in" using the verviage supplied here.
42
52
  # @return [Integer] the id of the contact updated
43
53
  # @example
44
- # { :FirstName => 'first_name', :StreetAddress1 => '123 N Street' }
45
- def contact_update(contact_id, data)
54
+ # { :FirstName => 'first_name', :StreetAddress1 => '123 N Street' }, 'New Signup'
55
+ def contact_update(contact_id, data, optin_status=nil)
46
56
  contact_id = xmlrpc('ContactService.update', contact_id, data)
47
- if data.has_key?(:Email); email_optin(data[:Email], "requested information"); end
57
+ email = data['Email'] || data[:Email]
58
+ if optin_status && email; email_optin(email, optin_status); end
48
59
  return contact_id
49
60
  end
50
61
 
@@ -21,6 +21,11 @@ module Infusionsoft
21
21
  request(:put, path, token, query, payload)
22
22
  end
23
23
 
24
+ # Perform an HTTP PATCH request
25
+ def patch(path, token, query: {}, payload: {})
26
+ request(:patch, path, token, query, payload)
27
+ end
28
+
24
29
  # Perform an HTTP DELETE request
25
30
  def delete(path, token, query: {})
26
31
  request(:delete, path, token, query)
@@ -47,7 +52,7 @@ module Infusionsoft
47
52
  rescue RestClient::ExceptionWithResponse => err
48
53
  # log error?
49
54
  else
50
- return JSON.parse(resp.body)
55
+ return JSON.parse(resp.body) if resp.body # Some calls respond w nothing
51
56
  end
52
57
  end
53
58
  end
@@ -45,7 +45,7 @@ module Infusionsoft
45
45
 
46
46
  response = RestClient.post("https://api.infusionsoft.com/token", params, header)
47
47
 
48
- rescue RestClient::ExceptionWithRespone => e
48
+ rescue RestClient::ExceptionWithResponse => e
49
49
  #TODO what to do here?
50
50
  false
51
51
  else
@@ -74,4 +74,4 @@ module Infusionsoft
74
74
  end
75
75
 
76
76
  end
77
- end
77
+ end
@@ -1,4 +1,4 @@
1
1
  module Infusionsoft
2
2
  # The version of the gem
3
- VERSION = '1.3.1a'.freeze unless defined?(::Infusionsoft::VERSION)
3
+ VERSION = '1.3.6a'.freeze unless defined?(::Infusionsoft::VERSION)
4
4
  end
@@ -24,7 +24,6 @@ class ContactTest < Test::Unit::TestCase
24
24
  existing_contact = Infusionsoft.contact_load(3606, [:Id, :FirstName, :LastName, :Email, :Company])
25
25
  result = Infusionsoft.contact_add_with_dup_check(data_hash, 'EmailAndName')
26
26
  assert_equal result, existing_contact['Id']
27
- assert_equal Infusionsoft.contact_load(existing_contact['Id'], [:Company])['Company'], data_hash[:Company]
28
27
  end
29
28
  end
30
29
 
data/test/test_helper.rb CHANGED
@@ -2,10 +2,10 @@ require 'coveralls'
2
2
  Coveralls.wear!
3
3
 
4
4
  require 'simplecov'
5
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
5
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
6
6
  SimpleCov::Formatter::HTMLFormatter,
7
7
  Coveralls::SimpleCov::Formatter
8
- ]
8
+ ])
9
9
  SimpleCov.start do
10
10
  add_filter '/vendor/'
11
11
  add_filter '/.bundle/'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infusionsoft
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1a
4
+ version: 1.3.6a
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Leavitt
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-11 00:00:00.000000000 Z
11
+ date: 2021-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -131,7 +131,7 @@ files:
131
131
  homepage: https://github.com/nateleavitt/infusionsoft
132
132
  licenses: []
133
133
  metadata: {}
134
- post_install_message:
134
+ post_install_message:
135
135
  rdoc_options: []
136
136
  require_paths:
137
137
  - lib
@@ -146,9 +146,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
146
  - !ruby/object:Gem::Version
147
147
  version: 1.3.1
148
148
  requirements: []
149
- rubyforge_project:
150
- rubygems_version: 2.7.6
151
- signing_key:
149
+ rubygems_version: 3.2.3
150
+ signing_key:
152
151
  specification_version: 4
153
152
  summary: Ruby wrapper for the Infusionsoft API
154
153
  test_files: []