Sha256: 40862fea3dc08454bb80877a5bc052d1204fa4f04726134091d777c168578bc2

Contents?: true

Size: 597 Bytes

Versions: 11

Compression:

Stored size: 597 Bytes

Contents

require 'emaildirect'
require 'json'

module EmailDirect
  # Represents a relay send custom email
  class RelaySend::Email
    attr_reader :category_id

    def initialize(category_id)
      @category_id = category_id
      raise ArgumentError, 'Category ID is required' unless @category_id
    end

    # Sends a custom message.  See the docs for all the possible options
    # @see https://docs.emaildirect.com/#RelaySendCustomEmail
    def send(options)
      response = EmailDirect.post "/RelaySends/#{category_id}", :body => options.to_json
      Hashie::Mash.new(response)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
emaildirect-2.0.0 lib/emaildirect/relay_send/email.rb
emaildirect-1.3.4 lib/emaildirect/relay_send/email.rb
emaildirect-1.3.3 lib/emaildirect/relay_send/email.rb
emaildirect-1.3.2 lib/emaildirect/relay_send/email.rb
emaildirect-1.3.1 lib/emaildirect/relay_send/email.rb
emaildirect-1.3.0 lib/emaildirect/relay_send/email.rb
emaildirect-1.2.1 lib/emaildirect/relay_send/email.rb
emaildirect-1.2.0 lib/emaildirect/relay_send/email.rb
emaildirect-1.1.0 lib/emaildirect/relay_send/email.rb
emaildirect-1.0.1 lib/emaildirect/relay_send/email.rb
emaildirect-1.0.0 lib/emaildirect/relay_send/email.rb