简体   繁体   中英

Adding Contact to InfusionSoft DB Fails using Ruby Gem

I'm using the Infusionsoft Ruby API Wrapper. I put

gem 'infusionsoft'

in my gemfile.

I added my API Key and URL as environmental variables that get loaded into an initializer like so:

Infusionsoft.configure do |config|
  config.api_url = ENV['INFUSIONSOFT_URL'] # example infused.infusionsoft.com
  config.api_key = ENV['INFUSIONSOFT_API_KEY']
  config.api_logger = Logger.new("#{Rails.root}/log/infusionsoft_api.log") # optional logger file
end

But when I test the contact add service in my rails console I get this error:

SocketError: getaddrinfo: nodename nor servname provided, or not known
from /Users/Justus/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:879:in `initialize'

Is anyone aware of a fix for this?

Create a file under /root/config/initializers/infusionsoft.rb

Infusionsoft.configure do |config|
  config.api_url = 'xyz.infusionsoft.com'
  config.api_key = '6rytrt7c4035aeee7895d2c45fe4595'
  config.api_logger = Logger.new("#{Rails.root}/log/infusionsoft_api.log") # optional logger file
end

I got the answer

while configuring infusionsoft we first need to enable the api key

Reference doc

http://ug.infusionsoft.com/article/AA-00442/0/How-do-I-enable-the-Infusionsoft-API-and-generate-an-API-Key.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM