Sha256: 082077de828c11ce2e8cd86e311d037bbe5ed49b8fa0c117900d97520d26e8ae

Contents?: true

Size: 755 Bytes

Versions: 5

Compression:

Stored size: 755 Bytes

Contents

# frozen_string_literal: true

require 'aws-sdk-sns'
require 'json'

module HermesMessengerOfTheGods
  module Endpoints
    class Sns < Base
      def sns_topic
        @sns_topic ||= Aws::SNS::Topic.new(endpoint,
                                           {
                                             client: HermesMessengerOfTheGods.configuration.sns_client
                                           }.merge(options[:client_options] || {}))
      end

      def transmit(message, raw_message, dispatch_options = {})
        pub_opts = fetch_option(:publish_options, raw_message) || {}

        message = JSON.dump(message) if options[:jsonify]
        sns_topic.publish(pub_opts.merge(dispatch_options, message: message))
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hermes_messenger_of_the_gods-2.4.0.pre2 lib/hermes_messenger_of_the_gods/endpoints/sns.rb
hermes_messenger_of_the_gods-2.4.0.pre1 lib/hermes_messenger_of_the_gods/endpoints/sns.rb
hermes_messenger_of_the_gods-2.3.4 lib/hermes_messenger_of_the_gods/endpoints/sns.rb
hermes_messenger_of_the_gods-2.3.3 lib/hermes_messenger_of_the_gods/endpoints/sns.rb
hermes_messenger_of_the_gods-2.3.2 lib/hermes_messenger_of_the_gods/endpoints/sns.rb