This looks incredible. I've been wanting a clean way to select multiple random objects from my Parse db. Until now, this was the best answer: <a href="https://parse.com/questions/random-search-its-possibile" rel="nofollow">https://parse.com/questions/random-search-its-possibile</a>.<p>Also, it seems possible to combine this with IronWorker. You could create a worker in Ruby, then in the Parse Cloud Code, call that worker's endpoint. Something like this (rough sketch):<p>worker.rb:<p><pre><code> require "some_ruby_email_gem"
cgi_parsed = CGI::parse(payload)
email = payload["email"]
SomeRubyEmailGem.send(email, "Welcome, #{email}!")
</code></pre>
upload.rb:<p><pre><code> require 'iron_worker_ng'
client = IronWorkerNG::Client.new(:token => config['iw']['token'], :project_id => config['iw']['project_id'])
code = IronWorkerNG::Code::Ruby.new
code.merge_worker 'worker.rb'
code.merge_gem "some_ruby_email_gem"
client.codes.create(code)
url = "https://worker-aws-us-east-1.iron.io/2/projects/#{config['iw']['project_id']}/tasks/webhook?code_name=#{code.name}&oauth=#{config['iw']['token']}"
puts "Add this url to to your Parse Cloud Code:"
puts url
</code></pre>
Parse Cloud Code:<p><pre><code> Parse.Cloud.define("welcome, function(request, response) {
var user = request.object.get("user");
var url = "https://worker-aws-us-east-1.iron.io/2..." // the url from upload.rb
http.open("POST", url+"?email="+user.email, true);
});
</code></pre>
EDIT: HTTP requests to 3rd parties within Cloud Code are not possible <i>yet</i>, but Parse will add the feature soon. (<a href="http://twitter.com/ParseIt/status/245584646686003200" rel="nofollow">http://twitter.com/ParseIt/status/245584646686003200</a>)