A Ruby wrapper for the Infusionsoft API
update notes
- 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.
- 07/21/2015 - Implementation of tests and build/coverage (Thanks! @TheMetalCode)
- v1.1.8 - Added a default user-agent in the headers. Also, give the ability to set your own user-agent in the config block.
- v1.1.5 - Added a custom logger option. This will allow you to track all api calls/results in a separate log file. Defaults to $stdout if none is specified. To add logger specify
api_logger
in your config block.
gem install infusionsoft
http://rubydoc.info/gems/infusionsoft/frames
- Rails 2.3 - add
config.gem 'infusionsoft'
Rails >= 3 - add'infusionsoft'
to yourGemfile
- Enable the API on your Infusionsoft account (if you haven't already) and generate your API Key: See Infusionsoft Doc
- Then create an initializer in
config\initializers
called infusionsoft.rb and the following
# Added to your config\initializers file
Infusionsoft.configure do |config|
config.api_url = 'YOUR_INFUSIONSOFT_URL' # example infused.infusionsoft.com DO NOT INCLUDE https://
config.api_key = 'YOUR_INFUSIONSOFT_API_KEY'
config.api_logger = Logger.new("#{Rails.root}/log/infusionsoft_api.log") # optional logger file
end
# Get a users first and last name using the DataService
Infusionsoft.data_load('Contact', contact_id, [:FirstName, :LastName])
# Get a list of custom fields
Infusionsoft.data_find_by_field('DataFormField', 100, 0, 'FormId', -1, ['Name'])
# Note, when updating custom fields they are case sensisitve and need to be prefaced with a '_'
# Update a contact with specific field values
Infusionsoft.contact_update(contact_id, { :FirstName => 'first_name', :Email => '[email protected]' })
# Add a new Contact
Infusionsoft.contact_add({:FirstName => 'first_name', :LastName => 'last_name', :Email => '[email protected]'})
# Create a blank Invoice
invoice_id = Infusionsoft.invoice_create_blank_order(contact_id, description, Date.today, lead_affiliate_id, sale_affiliate_id)
# Then add item to invoice
Infusionsoft.invoice_add_order_item(invoice_id, product_id, product_type, amount, quantity, description_here, notes)
# Then charge the invoice
Infusionsoft.invoice_charge_invoice(invoice_id, notes, credit_card_id, merchange_id, bypass_commissions)
In the spirit of free software, everyone is encouraged to help improve this project.
Here are some ways you can contribute:
- by using alpha, beta, and prerelease versions
- by reporting bugs
- by suggesting new features
- by writing or editing documentation
- by writing specifications
- by writing code (no patch is too small: fix typos, add comments, clean up inconsistent whitespace)
- by refactoring code
- by closing issues
- by reviewing patches
We use the GitHub issue tracker to track bugs and features.
This library aims to support the following Ruby implementations:
- Ruby = 1.8.7 (It will work, but tests require Ruby >= 1.9)
- Ruby >= 1.9
- JRuby
- Rubinius
- Ruby Enterprise Edition
If something doesn't work on one of these interpreters, it should be considered a bug.
This library may inadvertently work (or seem to work) on other Ruby implementations, however support will only be provided for the versions listed above.
If you would like this library to support another Ruby version, you may volunteer to be a maintainer. Being a maintainer entails making sure all tests run and pass on that implementation. When something breaks on your implementation, you will be personally responsible for providing patches in a timely fashion. If critical issues for a particular implementation exist at the time of a major release, support for that Ruby version may be dropped.
- Need to fully implement testing
- Need to add a history log for additional contributers
Copyright (c) 2015 Nathan Leavitt
See LICENSE for details.