infusionsoft 1.2.0 → 1.2.1.pre.a2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -26
- data/lib/infusionsoft/configuration.rb +5 -0
- data/lib/infusionsoft/connection.rb +3 -1
- data/lib/infusionsoft/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5b581abefe135102c389fdba5deed02f20c0cd9
|
4
|
+
data.tar.gz: 78469beda0ddca51299bcf610c1ad0147171086b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef1b40a838280b47929dec982f007a64b729be3de4648d40fee25aaaab3a4825c1d1bacd99601e1b3bdc21b9545ac186a31b9eb6183d3351413618578174f294
|
7
|
+
data.tar.gz: bac8aa1af90ea31c6d6e011219f961a469f028e55d6c7549db9722907c16385a300fb298d2524e2df35156940fdefd486264404c64239db5ceb74968833dfa11
|
data/README.md
CHANGED
@@ -6,7 +6,9 @@
|
|
6
6
|
A Ruby wrapper for the Infusionsoft API
|
7
7
|
|
8
8
|
**update notes**
|
9
|
-
*
|
9
|
+
* v1.2.1 - Added OAuth support
|
10
|
+
* v1.2.0 - Added `invoice_add_subscription` call to mirror Infusionsoft API parameters to eventually replace `invoice_add_recurring_order`
|
11
|
+
* maybe?? - Going to add Infusionsoft API authentication Oauth flow. Also, I'm thinking of rewriting parts of it to make the calls more user friendly and adding some convenience methods. If you have any suggestions, let me know.
|
10
12
|
* 07/21/2015 - Implementation of tests and build/coverage (Thanks! @TheMetalCode)
|
11
13
|
* v1.1.8 - Added a default user-agent in the headers. Also, give the
|
12
14
|
ability to set your own user-agent in the config block.
|
@@ -16,45 +18,60 @@ A Ruby wrapper for the Infusionsoft API
|
|
16
18
|
gem install infusionsoft
|
17
19
|
|
18
20
|
## <a name="documentation">Documentation</a>
|
19
|
-
[http://rubydoc.info/gems/infusionsoft
|
21
|
+
[http://rubydoc.info/gems/infusionsoft](http://rubydoc.info/gems/infusionsoft)
|
20
22
|
|
21
23
|
## <a name="setup">Setup & Configuration</a>
|
22
24
|
1. **Rails 2.3** - add `config.gem 'infusionsoft'` **Rails >= 3** - add `'infusionsoft'` to your `Gemfile`
|
23
25
|
2. Enable the API on your Infusionsoft account (if you haven't already) and generate your API Key: [See Infusionsoft Doc](http://ug.infusionsoft.com/article/AA-00442/0/How-do-I-enable-the-Infusionsoft-API-and-generate-an-API-Key.html)
|
24
26
|
3. Then create an initializer in `config\initializers` called infusionsoft.rb and the following
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
```ruby
|
29
|
+
# Added to your config\initializers file
|
30
|
+
Infusionsoft.configure do |config|
|
31
|
+
config.api_url = 'YOUR_INFUSIONSOFT_URL' # example infused.infusionsoft.com DO NOT INCLUDE https://
|
32
|
+
config.api_key = 'YOUR_INFUSIONSOFT_API_KEY'
|
33
|
+
config.api_logger = Logger.new("#{Rails.root}/log/infusionsoft_api.log") # optional logger file
|
34
|
+
end
|
35
|
+
```
|
36
|
+
## OAUTH 2.0
|
37
|
+
|
38
|
+
You will need to handle and obtain the access_token on your own.
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
# You will need to attain the access_token first, then do the config like so:
|
42
|
+
Infusionsoft.configure do |config|
|
43
|
+
config.use_oauth = true
|
44
|
+
config.api_url = 'api.infusionsoft.com' # do not include https://
|
45
|
+
config.api_key = 'ACCESS_TOKEN' # access_token
|
46
|
+
config.api_logger = Logger.new("#{Rails.root}/log/infusionsoft_api.log") # optional logger file
|
47
|
+
end
|
48
|
+
```
|
34
49
|
|
35
50
|
## <a name="examples">Usage Examples</a>
|
36
51
|
|
37
|
-
|
38
|
-
|
52
|
+
```ruby
|
53
|
+
# Get a users first and last name using the DataService
|
54
|
+
Infusionsoft.data_load('Contact', contact_id, [:FirstName, :LastName])
|
39
55
|
|
40
|
-
|
41
|
-
|
42
|
-
|
56
|
+
# Get a list of custom fields
|
57
|
+
Infusionsoft.data_find_by_field('DataFormField', 100, 0, 'FormId', -1, ['Name'])
|
58
|
+
# Note, when updating custom fields they are case sensisitve and need to be prefaced with a '_'
|
43
59
|
|
44
|
-
|
45
|
-
|
60
|
+
# Update a contact with specific field values
|
61
|
+
Infusionsoft.contact_update(contact_id, { :FirstName => 'first_name', :Email => 'test@test.com' })
|
46
62
|
|
47
|
-
|
48
|
-
|
63
|
+
# Add a new Contact
|
64
|
+
Infusionsoft.contact_add({:FirstName => 'first_name', :LastName => 'last_name', :Email => 'test@test.com'})
|
49
65
|
|
50
|
-
|
51
|
-
|
66
|
+
# Create a blank Invoice
|
67
|
+
invoice_id = Infusionsoft.invoice_create_blank_order(contact_id, description, Date.today, lead_affiliate_id, sale_affiliate_id)
|
52
68
|
|
53
|
-
|
54
|
-
|
69
|
+
# Then add item to invoice
|
70
|
+
Infusionsoft.invoice_add_order_item(invoice_id, product_id, product_type, amount, quantity, description_here, notes)
|
55
71
|
|
56
|
-
|
57
|
-
|
72
|
+
# Then charge the invoice
|
73
|
+
Infusionsoft.invoice_charge_invoice(invoice_id, notes, credit_card_id, merchange_id, bypass_commissions)
|
74
|
+
```
|
58
75
|
|
59
76
|
|
60
77
|
## <a name="contributing">Contributing</a>
|
@@ -103,7 +120,7 @@ time of a major release, support for that Ruby version may be dropped.
|
|
103
120
|
* Need to add a history log for additional contributers
|
104
121
|
|
105
122
|
## <a name="copyright">Copyright</a>
|
106
|
-
Copyright (c)
|
123
|
+
Copyright (c) 2017 Nathan Leavitt
|
107
124
|
|
108
125
|
See [LICENSE](https://github.com/nateleavitt/infusionsoft/blob/master/LICENSE.md) for details.
|
109
126
|
|
@@ -8,6 +8,7 @@ module Infusionsoft
|
|
8
8
|
:api_url,
|
9
9
|
:api_key,
|
10
10
|
:api_logger,
|
11
|
+
:use_oauth,
|
11
12
|
:user_agent # allows you to change the User-Agent of the request headers
|
12
13
|
].freeze
|
13
14
|
|
@@ -36,6 +37,10 @@ module Infusionsoft
|
|
36
37
|
#self.api_key = 'na'
|
37
38
|
#end
|
38
39
|
|
40
|
+
def use_oauth
|
41
|
+
@use_oath || false
|
42
|
+
end
|
43
|
+
|
39
44
|
def user_agent
|
40
45
|
@user_agent ||= "Infusionsoft-#{VERSION} (RubyGem)"
|
41
46
|
end
|
@@ -6,9 +6,11 @@ module Infusionsoft
|
|
6
6
|
private
|
7
7
|
|
8
8
|
def connection(service_call, *args)
|
9
|
+
path = use_oauth ? "/crm/xmlrpc/v1?access_token=#{api_key}" : "/api/xmlrpc"
|
10
|
+
|
9
11
|
client = XMLRPC::Client.new3({
|
10
12
|
'host' => api_url,
|
11
|
-
'path' =>
|
13
|
+
'path' => path,
|
12
14
|
'port' => 443,
|
13
15
|
'use_ssl' => true
|
14
16
|
})
|
data/lib/infusionsoft/version.rb
CHANGED
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.2.
|
4
|
+
version: 1.2.1.pre.a2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Leavitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -112,12 +112,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
112
|
version: '0'
|
113
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.3.
|
117
|
+
version: 1.3.1
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.6.13
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Ruby wrapper for the Infusionsoft API
|