Project

leadtune

0.0
No commit activity in last 3 years
No release in over 3 years
LeadTune Ruby API Gem
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0.0
= 2.0.0.beta.19
= 2.0.0.beta.19
= 2.0.0.beta.19
= 2.0.0.beta.19

Runtime

>= 0
>= 0
>= 0
 Project Readme

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.