class Osm::Email::DeliveryReport::Recipient

Constants

SORT_BY
VALID_STATUSES

Public Instance Methods

get_email(api, options={}) click to toggle source

Get email contents for this recipient @param [Osm::Api] api The api to use to make the request @!macro options_get @return [Osm::Email::DeliveryReport::Email]

# File lib/osm/email.rb, line 264
def get_email(api, options={})
  Osm::Model.require_access_to_section(api, delivery_report.section_id, options)
  cache_key = ['email_delivery_reports_email', delivery_report.section_id, delivery_report.id, id]

  if !options[:no_cache] && Osm::Model.cache_exist?(api, cache_key)
    return cache_read(api, cache_key)
  end

  email = Osm::Email::DeliveryReport::Email.fetch_from_osm(api, delivery_report.section_id, delivery_report.id, member_id, address)

  cache_write(api, cache_key, email)
  return email
end
inspect() click to toggle source
# File lib/osm/email.rb, line 316
def inspect
  Osm::inspect_instance(self, {replace_with: {'delivery_report' => :id}})
end
to_s() click to toggle source
# File lib/osm/email.rb, line 312
def to_s
  "#{address} - #{status}"
end
unblock_address(api) click to toggle source

Unblock email address from being sent emails @param [Osm::Api] api The api to use to make the request @param [Boolean] whether removal was successful

# File lib/osm/email.rb, line 281
def unblock_address(api)
  return true unless bounced?

  data = api.perform_query('ext/settings/emails/?action=unBlockEmail', {
    'section_id' => delivery_report.section_id,
    'email'      => address,
    'email_id'   => delivery_report.id
  })

  if data.is_a?(Hash)
    fail Osm::Error, data['error'].to_s unless data['error'].nil?
    return !!data['status']
  end
  return false
end