Created
September 25, 2018 18:05
-
-
Save chrisallick/ebebe5e5556a091fc62a31b8b1a620ab to your computer and use it in GitHub Desktop.
This file contains 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 characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment