Sha256: 3a46d4b2faed54546db465f7e708b05f5e373673589b48182e0f5406cfa76854

Contents?: true

Size: 951 Bytes

Versions: 30

Compression:

Stored size: 951 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)
			
			puts "last response is:"
			puts 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

30 entries across 30 versions & 1 rubygems

Version Path
wordjelly-auth-1.6.0 lib/auth/mailgun.rb
wordjelly-auth-1.5.9 lib/auth/mailgun.rb
wordjelly-auth-1.5.8 lib/auth/mailgun.rb
wordjelly-auth-1.5.7 lib/auth/mailgun.rb
wordjelly-auth-1.5.6 lib/auth/mailgun.rb
wordjelly-auth-1.5.5 lib/auth/mailgun.rb
wordjelly-auth-1.5.4 lib/auth/mailgun.rb
wordjelly-auth-1.5.3 lib/auth/mailgun.rb
wordjelly-auth-1.5.2 lib/auth/mailgun.rb
wordjelly-auth-1.5.1 lib/auth/mailgun.rb
wordjelly-auth-1.5.0 lib/auth/mailgun.rb
wordjelly-auth-1.4.9 lib/auth/mailgun.rb
wordjelly-auth-1.4.8 lib/auth/mailgun.rb
wordjelly-auth-1.4.7 lib/auth/mailgun.rb
wordjelly-auth-1.4.6 lib/auth/mailgun.rb
wordjelly-auth-1.4.5 lib/auth/mailgun.rb
wordjelly-auth-1.4.4 lib/auth/mailgun.rb
wordjelly-auth-1.4.3 lib/auth/mailgun.rb
wordjelly-auth-1.4.2 lib/auth/mailgun.rb
wordjelly-auth-1.4.0 lib/auth/mailgun.rb