Contact Importer for Ruby

API

Additionally to our simple widget integration, CloudSponge offers an API for Ruby.

Get Started

Create your CloudSponge account and tell us your domain. If it’s your development environment you’ll get a CloudSponge Key for free.

Requirements

JSON decoding package, currently supported are ActiveSupport::JSON and the JSON gem. Neither of these are required, but if you don’t have either on your system, a runtime error will be generated.

Install

gem install cloudsponge

Usage

contacts = nil
importer = Cloudsponge::ContactImporter.new(DOMAIN_KEY, DOMAIN_PASSWORD)
resp = importer.begin_import('YAHOO')
puts "Navigate to #{resp[:consent_url]} and complete the authentication process."
loop do
  events = importer.get_events
  break unless events.select{ |e| e.is_error? }.empty?
  unless events.select{ |e| e.is_complete? }.empty?
    contacts = importer.get_contacts
    break
  end
end

Other languages than Ruby

Don’t want to use Ruby? Not a problem! CloudSponge offers API for several languages: PHP - Java - Ruby - .Net - ColdFusion - or even a Do-It-Yourself Approach, which uses a REST API to return Contacts in JSON format.