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 characters
| class S3Worker < IronWorker::Base | |
| merge_gem 'aws' | |
| attr_accessor :image_url, :aws_access, :aws_secret | |
| File.open('~/image.jpg', 'wb') do |fo| | |
| fo.write open(image_url).read | |
| end | |
| Aws::S3Interface.new(aws_access, aws_secret) | |
| s3.put("mybucket", 'img.jpg', File.open('~/image.jpg')) |
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 characters
| ENV['IRON_MQ_TOKEN'] = 'YOUR TOKEN' | |
| ENV['IRON_MQ_PROJECT_ID'] = 'YOUR PROJECT ID' |
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 characters
| tweets = Twitter.search("IronMQ") | |
| ironmq = IronMQ::Client.new( | |
| "token"=>ENV["IRON_MQ_TOKEN"], | |
| "project_id"=>ENV["IRON_MQ_PROJECT_ID"], | |
| "queue_name"=>"tweets" | |
| ) | |
| tweets.map do |tweet| | |
| ironmq.messages.post("#{tweet.id}") |
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 characters
| tweets = Twitter.search("getiron") | |
| ironmq = IronMQ::Client.new( | |
| "token"=>ENV["IRON_MQ_TOKEN"], | |
| "project_id"=>ENV["IRON_MQ_PROJECT_ID"], | |
| "queue_name"=>"tweets" | |
| ) | |
| tweets.map do |tweet| | |
| ironmq.messages.post("#{tweet.id}") |
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 characters
| tweets_array.each do |t| | |
| Twitter.configure do |config| | |
| config.consumer_key = "CONSUMER_KEY" | |
| config.consumer_secret = "CONSUMER_SECRET" | |
| config.oauth_token = "ACCESS_TOKEN" | |
| config.oauth_token_secret = "ACCESS_SECRET" | |
| end | |
| output << Twitter.oembed(t.body.to_i).html | |
| end |
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 characters
| IronMQ::Client.new(:host => 'rackspace') | |
| IronMQ::Client.new(:host => 'aws') | |
| IronMQ::Client.new(:host => 'my_private_cloud') |
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 characters
| class Mailer < ActionMailer::Base | |
| layout 'email' | |
| default :from => "[email protected]" | |
| def hello_world(email) | |
| mail(:to => email, | |
| :subject => "Hello World from IronWorker!") | |
| end | |
| end |
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 characters
| <!DOCTYPE html> | |
| <html> | |
| <head><title></title></head> | |
| <body> | |
| <%= yield %> | |
| </body> | |
| </html> |
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 characters
| Hello from Iron.io! |
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 characters
| runtime "ruby" | |
| # Naming our worker (this is an arbitrary string, we like camelcasing) | |
| name "IronMailer" | |
| # The actual worker file to execute | |
| exec "iron_mailer.rb" | |
| # Merging all of our Rails apps models | |
| dir '../app/models' |
OlderNewer