Sha256: 94cde18832c851109aac4ee67b446bedd0ccb8e59514718d66deb7ddb4168fc8

Contents?: true

Size: 899 Bytes

Versions: 29

Compression:

Stored size: 899 Bytes

Contents

module Auth
	module Mailgun
		## returns the email after adding a webhook identifier variable.
		def add_webhook_identifier_to_email(email)
			email.message.mailgun_variables = {}
        	email.message.mailgun_variables["webhook_identifier"] = BSON::ObjectId.new.to_s
        	email
		end

		def self.set_webhook_identifier(notification_response,last_response)
			
			last_response = JSON.parse(last_response).deep_symbolize_keys
			notification_response.webhook_identifier = last_response[:webhook_identifier] if not last_response[:webhook_identifier].nil?
		end


		def email_webhook(params)	
			
			Auth.configuration.notification_response_class.constantize.find_and_update_notification_response(params[:webhook_identifier], JSON.generate(params)) do |notification_response|

				#puts "found email notification response:"
				#puts notification_response.attributes.to_s

			end
		end
	end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
wordjelly-auth-1.2.8 lib/auth/mailgun.rb
wordjelly-auth-1.2.6 lib/auth/mailgun.rb
wordjelly-auth-1.2.5 lib/auth/mailgun.rb
wordjelly-auth-1.2.4 lib/auth/mailgun.rb
wordjelly-auth-1.2.3 lib/auth/mailgun.rb
wordjelly-auth-1.2.2 lib/auth/mailgun.rb
wordjelly-auth-1.2.1 lib/auth/mailgun.rb
wordjelly-auth-1.2.0 lib/auth/mailgun.rb
wordjelly-auth-1.1.9 lib/auth/mailgun.rb
wordjelly-auth-1.1.8 lib/auth/mailgun.rb
wordjelly-auth-1.1.7 lib/auth/mailgun.rb
wordjelly-auth-1.1.6 lib/auth/mailgun.rb
wordjelly-auth-1.1.5 lib/auth/mailgun.rb
wordjelly-auth-1.1.4 lib/auth/mailgun.rb
wordjelly-auth-1.1.3 lib/auth/mailgun.rb
wordjelly-auth-1.1.2 lib/auth/mailgun.rb
wordjelly-auth-1.1.1 lib/auth/mailgun.rb
wordjelly-auth-1.1.0 lib/auth/mailgun.rb
wordjelly-auth-1.0.9 lib/auth/mailgun.rb
wordjelly-auth-1.0.8 lib/auth/mailgun.rb