module SendGrid4r::REST::Stats

SendGrid Web API v3 Stats

Constants

Metric
Stat
TopStat

Public Class Methods

create_metric(resp) click to toggle source
# File lib/sendgrid4r/rest/stats/stats.rb, line 50
def self.create_metric(resp)
  return resp if resp.nil?
  Metric.new(
    resp['blocks'],       resp['bounce_drops'],
    resp['bounces'],      resp['clicks'],
    resp['deferred'],     resp['delivered'],
    resp['drops'],        resp['invalid_emails'],
    resp['opens'],        resp['processed'],
    resp['requests'],     resp['spam_report_drops'],
    resp['spam_reports'], resp['unique_clicks'],
    resp['unique_opens'], resp['unsubscribe_drops'],
    resp['unsubscribes'], resp['received']
  )
end
create_stat(resp) click to toggle source
# File lib/sendgrid4r/rest/stats/stats.rb, line 45
def self.create_stat(resp)
  return resp if resp.nil?
  Stat.new(Stats.create_metric(resp['metrics']), resp['name'], resp['type'])
end
create_top_stat(resp) click to toggle source
# File lib/sendgrid4r/rest/stats/stats.rb, line 39
def self.create_top_stat(resp)
  return resp if resp.nil?
  stats = resp['stats'].map { |stat| Stats.create_stat(stat) }
  TopStat.new(resp['date'], stats)
end
create_top_stats(resp_a) click to toggle source
# File lib/sendgrid4r/rest/stats/stats.rb, line 65
def self.create_top_stats(resp_a)
  return resp_a if resp_a.nil?
  resp_a.map { |resp| Stats.create_top_stat(resp) }
end