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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d0bf53243fc89d01af35d4197fa256c3585507d
4
- data.tar.gz: 2db7db139663c393dd99cce6e6a87d8fabaf54eb
3
+ metadata.gz: d5b581abefe135102c389fdba5deed02f20c0cd9
4
+ data.tar.gz: 78469beda0ddca51299bcf610c1ad0147171086b
5
5
  SHA512:
6
- metadata.gz: 97bd42c843cd05f5bf7b747ee4400727e61fdba74546230d104a7b02d5bec7b28d68aab961744e744c962f7eb61ff388d3aa606e04e5565d106a7fbbfff67e8d
7
- data.tar.gz: 31ebb238bd1d52f38dd64c21c08e054782af92fdd1f5aa85015dbb30803fed0658a94e4ca9ff503bc217e99545a2a099b37f6a08988ee0f61bbf729d11441940
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
- * Currently - 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.
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/frames](http://rubydoc.info/gems/infusionsoft/frames)
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
- <b></b>
27
-
28
- # Added to your config\initializers file
29
- Infusionsoft.configure do |config|
30
- config.api_url = 'YOUR_INFUSIONSOFT_URL' # example infused.infusionsoft.com DO NOT INCLUDE https://
31
- config.api_key = 'YOUR_INFUSIONSOFT_API_KEY'
32
- config.api_logger = Logger.new("#{Rails.root}/log/infusionsoft_api.log") # optional logger file
33
- end
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
- # Get a users first and last name using the DataService
38
- Infusionsoft.data_load('Contact', contact_id, [:FirstName, :LastName])
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
- # Get a list of custom fields
41
- Infusionsoft.data_find_by_field('DataFormField', 100, 0, 'FormId', -1, ['Name'])
42
- # Note, when updating custom fields they are case sensisitve and need to be prefaced with a '_'
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
- # Update a contact with specific field values
45
- Infusionsoft.contact_update(contact_id, { :FirstName => 'first_name', :Email => 'test@test.com' })
60
+ # Update a contact with specific field values
61
+ Infusionsoft.contact_update(contact_id, { :FirstName => 'first_name', :Email => 'test@test.com' })
46
62
 
47
- # Add a new Contact
48
- Infusionsoft.contact_add({:FirstName => 'first_name', :LastName => 'last_name', :Email => 'test@test.com'})
63
+ # Add a new Contact
64
+ Infusionsoft.contact_add({:FirstName => 'first_name', :LastName => 'last_name', :Email => 'test@test.com'})
49
65
 
50
- # Create a blank Invoice
51
- invoice_id = Infusionsoft.invoice_create_blank_order(contact_id, description, Date.today, lead_affiliate_id, sale_affiliate_id)
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
- # Then add item to invoice
54
- Infusionsoft.invoice_add_order_item(invoice_id, product_id, product_type, amount, quantity, description_here, notes)
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
- # Then charge the invoice
57
- Infusionsoft.invoice_charge_invoice(invoice_id, notes, credit_card_id, merchange_id, bypass_commissions)
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) 2015 Nathan Leavitt
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' => "/api/xmlrpc",
13
+ 'path' => path,
12
14
  'port' => 443,
13
15
  'use_ssl' => true
14
16
  })
@@ -1,4 +1,4 @@
1
1
  module Infusionsoft
2
2
  # The version of the gem
3
- VERSION = '1.2.0'.freeze unless defined?(::Infusionsoft::VERSION)
3
+ VERSION = '1.2.1-a2'.freeze unless defined?(::Infusionsoft::VERSION)
4
4
  end
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.0
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-05-17 00:00:00.000000000 Z
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.6
117
+ version: 1.3.1
118
118
  requirements: []
119
119
  rubyforge_project:
120
- rubygems_version: 2.5.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