module Infusion

Constants

VERSION

Public Class Methods

add_contact(contact) click to toggle source

method for contact add

# File lib/infusion.rb, line 56
def self.add_contact(contact)
  attempts = 0
  begin
    $server.call("ContactService.add", $key, contact)
  rescue Exception
    attempts += 1
  retry unless attempts > 1000
    exit -1
  ensure
    puts "ensure! #{attempts}"
 end
end
campaign(results, campaign_id) click to toggle source

method for add contact to campaign

# File lib/infusion.rb, line 98
def self.campaign(results, campaign_id)
  attempts = 0
   begin
     $server.call("ContactService.addToGroup",$key,results,campaign_id)
    rescue Exception
     attempts += 1
    retry unless attempts > 1000
     exit -1
    ensure
     puts "ensure! #{attempts}"
   end
end
data_load(table, id, selected_fields) click to toggle source

method for get the data from the table

# File lib/infusion.rb, line 22
def self.data_load(table, id, selected_fields)
    attempts = 0
   begin
     main_product = $server.call("DataService.load", $key,table, id, selected_fields)
   rescue Exception
    attempts += 1
   retry unless attempts > 1000
    exit -1
   ensure
    puts "ensure! #{attempts}"
   end
end
file_path(file) click to toggle source
# File lib/infusion.rb, line 9
def self.file_path(file)
   begin
     config = YAML::load(IO.read(file))
   rescue => e
     raise "YAML configuration file couldn't be found: #{e}"
   end
   $key = config["key"]
   server = config["server"]
   $server = XMLRPC::Client.new2(server)
end
findByEmail(email, contact_info) click to toggle source

method for find email from IS

# File lib/infusion.rb, line 42
def self.findByEmail(email, contact_info)
attempts = 0
   begin
     $server.call("ContactService.findByEmail", $key, email,contact_info)
   rescue Exception
     attempts += 1
   retry unless attempts > 1000
     exit -1
   ensure
    puts "ensure! #{attempts}"
   end
 end
merge(user_id, merge_id) click to toggle source

method for merge contacts

# File lib/infusion.rb, line 84
def self.merge(user_id, merge_id)
  attempts = 0
  begin
    $server.call("ContactService.merge", $key,user_id, merge_id)
  rescue Exception
     attempts += 1
  retry unless attempts > 1000
     exit -1
  ensure
     puts "ensure! #{attempts}"
  end
end
optin(email, message) click to toggle source

method to opt in email

# File lib/infusion.rb, line 37
def self.optin(email, message)
 $server.call("APIEmailService.optIn", $key,email,message)
end
order(query, fields) click to toggle source

Find the order from contact id

# File lib/infusion.rb, line 126
def self.order(query, fields)
  attempts = 0
    begin
    $server.call("DataService.query",key,"Job",10,0,query,fields )
    rescue Exception
      attempts += 1
     retry unless attempts > 1000
      exit -1
     ensure
     puts "ensure! #{attempts}"
    end
end
orderitems(query, fields) click to toggle source

Find the order iteams from order_id

# File lib/infusion.rb, line 140
def self.orderitems(query, fields)
   attempts = 0
    begin
     $server.call("DataService.query",key,"OrderItem",10,0,query,fields )
    rescue Exception
       attempts += 1
    retry unless attempts > 1000
       exit -1
    ensure
      puts "ensure! #{attempts}"
    end
end
query(query, fields) click to toggle source

find by query this method is for to check subscription

# File lib/infusion.rb, line 112
def self.query(query, fields)
 attempts = 0
   begin
   $server.call("DataService.query",$key,"RecurringOrder",10,0,query,fields)
   rescue Exception
     attempts += 1
    retry unless attempts > 1000
     exit -1
    ensure
    puts "ensure! #{attempts}"
   end
end
update(user_id, contact) click to toggle source

method for update the contact_info

# File lib/infusion.rb, line 70
def self.update(user_id, contact)
   attempts = 0
    begin
      $server.call("ContactService.update", $key,user_id,contact)
    rescue Exception
      attempts += 1
    retry unless attempts > 1000
      exit -1
    ensure
      puts "ensure! #{attempts}"
   end
end

Public Instance Methods

method_missing(method, *args, &block) click to toggle source

Delegate to ApiInfusionsoft::Client

Calls superclass method
# File lib/infusion.rb, line 154
def method_missing(method, *args, &block)
    return super unless new.respond_to?(method)
    new.send(method, *args, &block)
end