Module: GoAcoustic::Client::Reporting

Included in:
GoAcoustic::Client
Defined in:
lib/client/reporting.rb

Instance Method Summary collapse

Instance Method Details

#get_job_status(job_id) ⇒ Mash

GetJobStatus - After initiating a data job, you can monitor the status of the job using this operation.

Examples:

Get Job Status for JOB_ID 1234

s = GoAcoustic.new({access_token: "abc123", url: "https://api-campaign-us-1.goacoustic.com"})
s.get_job_status(1234)


84
85
86
87
88
89
90
91
92
93
94
# File 'lib/client/reporting.rb', line 84

def get_job_status(job_id)
  builder = Builder::XmlMarkup.new
  xml = builder.Envelope {
    builder.Body {
      builder.GetJobStatus {
        builder.JOB_ID job_id
        }
      }
    }
  post(xml)
end

#get_sent_mailings_for_org(date_start, date_end, options = {}) ⇒ Mash

GetSentMailingsForOrg - This interface extracts a listing of mailings sent for an organization for a specified date range.

Examples:

Get sent mailing for organization for 1/1/2014 to 1/2/2014

s = GoAcoustic.new({access_token: "abc123", url: "https://api-campaign-us-1.goacoustic.com"})
s.get_sent_mailings_for_org("1/1/2014", "1/2/2014)


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/client/reporting.rb', line 14

def get_sent_mailings_for_org(date_start, date_end, options={})
  builder = Builder::XmlMarkup.new
  xml = builder.Envelope {
    builder.Body {
      builder.GetSentMailingsForOrg {
        unless options.empty?
          options.each do |o|
              builder.tag! o[0], o[1]
          end
        end
        builder.DATE_START date_start
        builder.DATE_END date_end
        }
      }
    }
  post(xml)
end

#raw_recipient_data_export(query_params = {}, options = {}, columns = []) ⇒ Mash

RawRecipientDataExport - Allows exporting unique contact-level events and creates a .zip file containing a single flat file with all metrics

Examples:

Export raw data events for mailing id

s = GoAcoustic.new({access_token: "abc123", url: "https://api-campaign-us-1.goacoustic.com"})
s.raw_recipient_data_export({MAILING_ID: 1234},{MOVE_TO_FTP: nil})


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/client/reporting.rb', line 41

def raw_recipient_data_export(query_params={}, options={}, columns=[])
  builder = Builder::XmlMarkup.new
  xml = builder.Envelope {
    builder.Body {
      builder.RawRecipientDataExport {
        unless query_params.empty?
          query_params.each do |q|
            if q[0] == :MAILING_ID || q[0] == :REPORT_ID
              builder.MAILING {
                builder.tag! q[0], q[1]
              }
            else
              builder.tag! q[0], q[1]
            end
          end
        end
        unless options.empty?
          options.each do |opt|
            builder.tag! opt[0], opt[1]
          end
        end
        unless columns.empty?
          builder.COLUMNS {
            columns.each do |column|
              builder.COLUMN {
                builder.NAME column
              }
            end
          }
        end
        }
      }
    }
  post(xml)
end