Sha256: 3af903478f3ef3f0de5bb0b4b227ba0af6a2c0d8b2f5dd1fa8531ab1f7ab8447

Contents?: true

Size: 770 Bytes

Versions: 3

Compression:

Stored size: 770 Bytes

Contents

# encoding: UTF-8

require 'contactology/issues'

module Contactology
  ##
  # Contains the campaign send request results which indicate success or
  # failure, as well as any issues found with the campaign.
  #
  class SendResult
    attr_reader :issues

    def initialize(response)
      @success = response['success']
      @issues = Issues.new(response['issues'])
    end

    ##
    # Public: Indicates whether or not the send was successful
    #
    # Returns true when successful.
    # Returns false when unsuccessful.
    #
    def successful?
      !!@success
    end

    ##
    # Public: Returns the spam score of the campaign.
    #
    # Returns a numeric from 0 to 100 (where higher is better).
    #
    def score
      @issues.score
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
contactology-0.1.1 lib/contactology/send_result.rb
contactology-0.1.0 lib/contactology/send_result.rb
contactology-0.0.2 lib/contactology/send_result.rb