Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 leadtune.gemspec
README.rdoc

LeadTune API Ruby Gem

github.com/leadtune/leadtune-ruby

rubygems.org/gems/leadtune

Copyright 2010 LeadTune, LLC

Eric Wollesen (devs@leadtune.com)

For details about the LeadTune API, see: leadtune.com/api

Configuration

Authentication credentials can be specified by any of several methods, as detailed below. Available configuration values include:

  • api_key

  • organization

Rack Initializer

# config/initializers/leadtune.rb
Leadtune::Config.api_key = "DeadB33fDeadB33fDeadB33fDeadB33fDeadB33f"
Leadtune::Config.organization = "MYC"

Factors Hash

When initializing your Leadtune::Prospect, you can include your API key and organization along with any factors you wish to submit. These values take precedence over values read from the rack initializer.

Instance Methods

You can also set your API key and organization by calling the Leadtune::Prospect object's #api_key= and #organization= methods. These values take precedence over values read from the factors hash and the rack initializer.

Example Usage

An attempt was made to allow for an ActiveModel-like interface.

require "rubygems"
require "leadtune"

prospect = Leadtune::Prospect.post({
  :api_key => "DeadB33fDeadB33fDeadB33fDeadB33fDeadB33f", # required (See Leadtune::Config)
  :organization => "LOL",                 # required (See Leadtune::Config)
  :event => "offers_prepared",            # required
  :email => "test@example.com",           # required
  :target_buyers => ["TB-LOL", "AcmeU"],  # required
  # ... include optional factors here, see http://leadtune.com/factors for details
})

Or alternatively

prospect = Leadtune::Prospect.post do |p|
  p.event = "offers_prepared"
  p.email = "test@example.com"
  ... and so on
end

Or even

prospect = Leadtune::Prospect.new
prospect.event = "offers_prepared"
prospect.email = "test@example.com"   
... and so on
prospect.post

Automatic Environment Detection

At initialization, an attempt is made to detect your application's current environment. If a rack or rails production environment is detected, prospects will be posted to LeadTune's production host. Otherwise prospects will be posted to LeadTune's sandbox host. The application environment can be overriden via the APP_ENV environment variable, which takes precedence over all other methods.

Something went wrong with that request. Please try again.