Skip to content

Instantly share code, notes, and snippets.

@maier-stefan
Created January 8, 2015 18:34
Show Gist options
  • Save maier-stefan/07bd866831ceaf3a3c72 to your computer and use it in GitHub Desktop.
Save maier-stefan/07bd866831ceaf3a3c72 to your computer and use it in GitHub Desktop.
require "httparty"
class Plugrush
include HTTParty
default_options.update(verify: false)
base_uri "https://www.plugrush.com/api"
def initialize(email, api_key)
@credentials = "?user=#{email}&api_key=#{api_key}"
end
def stats_on_date(start_date, end_date)
self.class.get("#{@credentials}&action=advertiser/stats&start=#{start_date}&end=#{end_date}&breakdown=dates")
end
def campaign_list
self.class.get("#{@credentials}&action=campaign/list")
end
def stop(campaign_id)
self.class.get("#{@credentials}&action=campaign/pause&id=#{campaign_id}&pause=1")
end
def start(campaign_id)
self.class.get("#{@credentials}&action=campaign/pause&id=#{campaign_id}&pause=0")
end
end
plugrush = Plugrush.new("[email protected]", "xxxxxxxxxxxxxxxx" )
puts plugrush.campaign_list
puts plugrush.stats_on_date("10-10-2014", "11-10-2014")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment