Sha256: f6e9e82aea0f194b1007790ffa186b4f658462f6e559bd36864956f9df47731a

Contents?: true

Size: 671 Bytes

Versions: 3

Compression:

Stored size: 671 Bytes

Contents

# frozen_string_literal: true

module LoopsSdk
  class Transactional < Base
    class << self
      def send(transactional_id:, email:, add_to_audience: false, data_variables: {}, attachments: [])
        attachments = attachments.map do |attachment|
          attachment.transform_keys { |key| key == :content_type ? :contentType : key }
        end
        email_data = {
          transactionalId: transactional_id,
          email: email,
          addToAudience: add_to_audience,
          dataVariables: data_variables,
          attachments: attachments
        }.compact
        make_request(:post, "v1/transactional", {}, email_data)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
loops_sdk-0.2.0 lib/loops_sdk/transactional.rb
loops_sdk-0.1.2 lib/loops_sdk/transactional.rb
loops_sdk-0.1.0 lib/loops_sdk/transactional.rb