Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removing iron creds from config.yml and cleanup

  • Loading branch information...
commit 12e81493fe1167b5383c53fcfcf122fcd1b853e5 1 parent b919ca1
@carimura carimura authored
View
6 ruby_ng/twilio_insanity/config/config.yml
@@ -2,9 +2,5 @@ twilio:
account_sid: TWILIO_ACCOUNT_SID
auth_token: TWILIO_AUTH_TOKEN
-iron:
- token: IRON_TOKEN
- project_id: IRON_PROJECT_ID
-
app:
- from: VALID_TWILIO_NUMBER
+ from: TWILIO_PHONE_NUMBER (eg. +14151112222)
View
25 ruby_ng/twilio_insanity/web.rb
@@ -18,22 +18,25 @@ def puts(msg)
number = params[:number]
config = YAML.load_file("config/config.yml")
- worker_client = IronWorkerNG::Client.new(:token => config['iron']['token'], :project_id => config['iron']['project_id'])
- cache_client = IronCache::Client.new(:token => config['iron']['token'], :project_id => config['iron']['project_id'])
- cache = cache_client.cache("insanity-#{number}")
+ config_iron = JSON.parse(File.read("workers/iron.json"))
+
+ worker_client = IronWorkerNG::Client.new(:token => config_iron['token'], :project_id => config_iron['project_id'])
+ cache_client = IronCache::Client.new(:token => config_iron['token'], :project_id => config_iron['project_id'])
+ cache = cache_client.cache("insanity-#{number}")
load_schedule(cache)
cache.put("day", 0)
worker_client.schedules.create('SendInsanity',
- {
- :number => number
- },
- {
- :start_at => Time.now,
- :run_times => 60,
- :run_every => 3600*24
- })
+ {
+ :number => number,
+ :config => worker_client.api.options
+ },
+ {
+ :start_at => Time.now,
+ :run_times => 5,
+ :run_every => 60
+ })
redirect '/done'
end
View
6 ruby_ng/twilio_insanity/workers/iron.json
@@ -1,4 +1,4 @@
{
- "token": "MY_TOKEN",
- "project_id": "MY_PROJECT_ID"
- }
+ "token":"MY_TOKEN",
+ "project_id":"MY_PROJECT_ID"
+}
View
4 ruby_ng/twilio_insanity/workers/send_insanity.rb
@@ -5,8 +5,8 @@
config = YAML.load_file("config.yml")
account_sid = config['twilio']['account_sid']
auth_token = config['twilio']['auth_token']
-project_id = config['iron']['project_id']
-token = config['iron']['token']
+project_id = params[:config][:project_id]
+token = params[:config][:token]
number = params[:number]
twilio = Twilio::REST::Client.new account_sid, auth_token
View
3  ruby_ng/twilio_insanity/workers/twilio_webhook.rb
@@ -35,10 +35,11 @@ def move_day_forward(number)
puts "Moving Day Forward"
config = YAML.load_file("config.yml")
+ config_iron = JSON.parse(File.read("iron.json"))
twilio = Twilio::REST::Client.new config['twilio']['account_sid'], config['twilio']['auth_token']
puts "Creating or Getting Cache...."
- ironcache = IronCache::Client.new(:project_id => config['iron']['project_id'], :token => config['iron']['token'])
+ ironcache = IronCache::Client.new(:project_id => config_iron['project_id'], :token => config_iron['token'])
cache = ironcache.cache("insanity-#{number}")
puts "Incrementing Day Cache in cache #{cache.name}"
View
1  ruby_ng/twilio_insanity/workers/twilio_webhook.worker
@@ -5,5 +5,6 @@ name "TwilioWebhook"
gem "twilio-ruby"
gem "iron_cache"
+file "iron.json"
file "../config/config.yml"
file "../lists/shaunisms.txt"
Please sign in to comment.
Something went wrong with that request. Please try again.