Created
January 8, 2015 18:34
-
-
Save maier-stefan/07bd866831ceaf3a3c72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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