Created
September 25, 2018 18:05
-
-
Save chrisallick/ebebe5e5556a091fc62a31b8b1a620ab to your computer and use it in GitHub Desktop.
Revisions
-
chrisallick created this gist
Sep 25, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ require 'aws-sdk-lambda' # https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/ruby/example_code/lambda/aws-ruby-sdk-lambda-example-run-function.rb require 'json' require 'sendgrid-ruby' include SendGrid # https://github.com/sendgrid/sendgrid-ruby Encoding.default_external = 'UTF-8' class EmailSender @queue = "email_sender_queue" def self.perform(data) puts "#{@@redis.get('test')}" puts data if data and data["note_attributes"] and data["note_attributes"].any? repeat = false all = Resque.redis.lrange("deliveries", 0, 20 ) all.each do |oid| delivery_object = JSON.parse(Resque.redis.get("delivery:#{oid}")) if delivery_object["order_id"] == data["id"] puts "already sent!" end end