Class: TrafficMansion::Tracker
- Inherits:
-
Object
- Object
- TrafficMansion::Tracker
- Defined in:
- lib/traffic_mansion/tracker.rb
Instance Method Summary collapse
- #activate(options = {}) ⇒ Object
-
#initialize(options = {}, endpoint = ENV["TRAFFIC_MANSION_ENDPOINT"], http_host = ENV["TRAFFIC_MANSION_HTTP_HOST"], log_requests = ENV["TRAFFIC_MANSION_LOG_REQUESTS"], log_to_file = ENV["TRAFFIC_MANSION_LOG_TO_FILE"]) ⇒ Tracker
constructor
A new instance of Tracker.
- #rebill(options = {}) ⇒ Object
- #refund(options = {}) ⇒ Object
- #sale(options = {}) ⇒ Object
- #set_data(data) ⇒ Object
- #signup(options = {}) ⇒ Object
- #visit(options = {}) ⇒ Object
Constructor Details
#initialize(options = {}, endpoint = ENV["TRAFFIC_MANSION_ENDPOINT"], http_host = ENV["TRAFFIC_MANSION_HTTP_HOST"], log_requests = ENV["TRAFFIC_MANSION_LOG_REQUESTS"], log_to_file = ENV["TRAFFIC_MANSION_LOG_TO_FILE"]) ⇒ Tracker
Returns a new instance of Tracker.
5 6 7 8 9 10 11 |
# File 'lib/traffic_mansion/tracker.rb', line 5 def initialize = {}, endpoint = ENV["TRAFFIC_MANSION_ENDPOINT"], http_host = ENV["TRAFFIC_MANSION_HTTP_HOST"], log_requests = ENV["TRAFFIC_MANSION_LOG_REQUESTS"], log_to_file = ENV["TRAFFIC_MANSION_LOG_TO_FILE"] @endpoint = endpoint @http_host = http_host @log_requests = log_requests @log_to_file = log_to_file set_data end |
Instance Method Details
#activate(options = {}) ⇒ Object
40 41 42 |
# File 'lib/traffic_mansion/tracker.rb', line 40 def activate = {} auth false, end |
#rebill(options = {}) ⇒ Object
48 49 50 |
# File 'lib/traffic_mansion/tracker.rb', line 48 def rebill = {} payment "rebill", end |
#refund(options = {}) ⇒ Object
52 53 54 |
# File 'lib/traffic_mansion/tracker.rb', line 52 def refund = {} payment "refund", end |
#sale(options = {}) ⇒ Object
44 45 46 |
# File 'lib/traffic_mansion/tracker.rb', line 44 def sale = {} payment "sale", end |
#set_data(data) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/traffic_mansion/tracker.rb', line 13 def set_data data @remote_addr = data[:remote_addr] ? data[:remote_addr] : nil @campaign_id = data[:campaign_id] ? data[:campaign_id] : nil @visit_id = data[:visit_id] ? data[:visit_id] : nil @affiliate_id = data[:affiliate_id] ? data[:affiliate_id] : nil @user_id = data[:user_id] ? data[:user_id] : nil end |
#signup(options = {}) ⇒ Object
36 37 38 |
# File 'lib/traffic_mansion/tracker.rb', line 36 def signup = {} auth true, end |
#visit(options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/traffic_mansion/tracker.rb', line 21 def visit = {} url = "#{@endpoint}/xd_visit.php" params = { "campaign_id" => @campaign_id, "keyword" => nil, "timestamp" => Time.now.to_i, "http_host" => @http_host, "remote_addr" => @remote_addr, "http_referer" => nil, "visit_id" => @visit_id, "affiliate_id" => @affiliate_id }.merge get_response url, params end |