class Smtpcom::Sendapi::RealTimeReporting

Constants

MAPPINGS

Public Class Methods

build_from_response(data) click to toggle source
# File lib/smtpcom/sendapi/real_time_reporting.rb, line 20
def self.build_from_response(data)
  new Hash[MAPPINGS.map { |k, v| [k.to_sym, data["InstantNotification_#{v}"]] }].merge \
    notify_opens:         data['InstantNotification_NotifyOpens'] == 'On',
    notify_clicks:        data['InstantNotification_NotifyClicks'] == 'On',
    notify_delivert_info: data['InstantNotification_NotifyDelivertInfo'] == 'On'
end
settings() click to toggle source
# File lib/smtpcom/sendapi/real_time_reporting.rb, line 16
def self.settings
  build_from_response(_get('/realtimereporting/get'))
end

Public Instance Methods

prepare_params() click to toggle source
# File lib/smtpcom/sendapi/real_time_reporting.rb, line 31
def prepare_params
  super.merge \
    NotifyOpens:        (notify_opens ? 'On' : 'Off'),
    NotifyClicks:       (notify_clicks ? 'On' : 'Off'),
    NotifyDelivertInfo: (notify_delivert_info ? 'On' : 'Off')
end
save() click to toggle source
# File lib/smtpcom/sendapi/real_time_reporting.rb, line 27
def save
  _post '/realtimereporting/update', prepare_params, :formatted
end