Sha256: 85d86d92919a9bcfbd8ac7502b167561c217d3e7cb8368e7af4767e1dde2973f

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require 'json'
require 'typhoeus'

require 'woodpecker/version'

require 'woodpecker/configuration'
require 'woodpecker/errors/configuration'

require 'woodpecker/utils/request'

require 'woodpecker/campaign'
require 'woodpecker/prospect'
require 'woodpecker/errors/prospect'

module Woodpecker
  class << self
    attr_accessor :configuration
  end

  def self.configuration
    @configuration ||= Configuration.new
  end

  def self.reset
    @configuration = Configuration.new
  end

  def self.configure
    yield(configuration)
  end

  def self.campaign_list
    Woodpecker::Utils::Request.get('campaign_list').map { |campaign| Campaign.new(campaign) }
  end

  def self.add_prospects_campaign(campaign_id, params = {}, prospects)
    payload = { campaign: { campaign_id: campaign_id },
                update: 'true',
                prospects: Array(prospects) }.to_json
    Woodpecker::Utils::Request.post('add_prospects_campaign', params, payload)
  end

  def self.add_prospects_list(params = {}, prospects)
    payload = { update: 'true', prospects: Array(prospects) }.to_json
    Woodpecker::Utils::Request.post('add_prospects_list', params, payload)
  end

  def self.stop_followups(params = {}, prospect)
    payload = { prospect: { email: prospect.email } }.to_json
    Woodpecker::Utils::Request.post('stop_followups', params, payload)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
woodpecker-0.1.2 lib/woodpecker.rb