Class: RBET::Tracker

Inherits:
Client show all
Defined in:
lib/rbet/tracker.rb

Overview

usage:

# First load the Tracker client
tracker_client = ET::Tracker.new('username', 'password')

# get job summary
summary = job_client.retrieve_summary(12345) # pass a job_id
=> {'sentCount' => 163, 'deliveredCount' => 159, ... }

Instance Attribute Summary

Attributes inherited from Client

#headers, #password, #username

Instance Method Summary collapse

Methods inherited from Client

#live?, #send, #status

Methods included from Renderable

#render_template, #set_template_path, #template_path

Constructor Details

#initialize(username, password, options = {}) ⇒ Tracker

Returns a new instance of Tracker.



41
42
43
# File 'lib/rbet/tracker.rb', line 41

def initialize(username,password,options={})
  super
end

Instance Method Details

#retrieve_summary(job_id) ⇒ Object

retrieves tracking information for a particular job id



46
47
48
49
50
51
52
53
54
# File 'lib/rbet/tracker.rb', line 46

def retrieve_summary( job_id )
  @job_id = job_id
  response = send do|io|
    io << render_template('tracker_retrieve_summary')
  end
  Error.check_response_error(response)
  h = Hash.from_xml(response.read_body)
  h['exacttarget']['system']['tracking']['emailSummary']
end