-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sets the new user up with an example set of agents
- gives them a place to start from - leverages existing code to import scenarios
- Loading branch information
Showing
4 changed files
with
167 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController | ||
# You should configure your model like this: | ||
# devise :omniauthable, omniauth_providers: [:twitter] | ||
|
||
# You should also create an action method in this controller like this: | ||
# def twitter | ||
# end | ||
|
||
# More info at: | ||
# https://github.com/plataformatec/devise#omniauth | ||
|
||
# GET|POST /resource/auth/twitter | ||
# def passthru | ||
# super | ||
# end | ||
|
||
# GET|POST /users/auth/twitter/callback | ||
# def failure | ||
# super | ||
# end | ||
|
||
# protected | ||
|
||
# The path used when OmniAuth fails | ||
# def after_omniauth_failure_path_for(scope) | ||
# super(scope) | ||
# end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class Users::RegistrationsController < Devise::RegistrationsController | ||
after_action :create_default_scenario, only: :create | ||
|
||
private | ||
|
||
def create_default_scenario | ||
scenario_import = ScenarioImport.new() | ||
scenario_import.set_user(@user) | ||
scenario_import.file = File.open(File.join(Rails.root, "data", "default_scenario.json"), "r") | ||
raise "Not vaild" unless scenario_import.valid? | ||
scenario_import.import | ||
end | ||
end |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
{ | ||
"schema_version": 1, | ||
"name": "Default Scenario", | ||
"description": "This scenario has a few agents to get you started. Feel free to change them or delete them as you see fit!", | ||
"source_url": false, | ||
"guid": "ebc484c8df1c34b676e57167fbbce2c9", | ||
"tag_fg_color": "#ffffff", | ||
"tag_bg_color": "#5bc0de", | ||
"exported_at": "2016-04-02T23:27:09Z", | ||
"agents": [ | ||
{ | ||
"type": "Agents::EmailDigestAgent", | ||
"name": "Morning Digest", | ||
"disabled": false, | ||
"guid": "09cc84cfdd3f37651c5fe251674cef8f", | ||
"options": { | ||
"subject": "Your Morning Digest", | ||
"expected_receive_period_in_days": "30" | ||
}, | ||
"schedule": "6am", | ||
"propagate_immediately": false | ||
}, | ||
{ | ||
"type": "Agents::WeatherAgent", | ||
"name": "SF Weather Agent", | ||
"disabled": false, | ||
"guid": "4a8f43d4946c5de02a4cd808b6c1066b", | ||
"options": { | ||
"location": "94103", | ||
"api_key": "PUT YOUR API KEY HERE", | ||
"service": "wunderground" | ||
}, | ||
"schedule": "10pm", | ||
"keep_events_for": 0 | ||
}, | ||
{ | ||
"type": "Agents::TriggerAgent", | ||
"name": "Rain Notifier", | ||
"disabled": false, | ||
"guid": "82cef3953daac06905d3a065df444bd1", | ||
"options": { | ||
"expected_receive_period_in_days": "2", | ||
"rules": [ | ||
{ | ||
"type": "regex", | ||
"value": "rain|storm", | ||
"path": "conditions" | ||
} | ||
], | ||
"message": "Just so you know, it looks like '{{conditions}}' tomorrow in {{location}}" | ||
}, | ||
"keep_events_for": 0, | ||
"propagate_immediately": false | ||
}, | ||
{ | ||
"type": "Agents::WebsiteAgent", | ||
"name": "XKCD Source", | ||
"disabled": false, | ||
"guid": "a3504e6827d008e9cc7cb682229585e4", | ||
"options": { | ||
"url": "http://xkcd.com", | ||
"mode": "on_change", | ||
"expected_update_period_in_days": 5, | ||
"extract": { | ||
"url": { | ||
"css": "#comic img", | ||
"value": "@src" | ||
}, | ||
"title": { | ||
"css": "#comic img", | ||
"value": "@alt" | ||
}, | ||
"hovertext": { | ||
"css": "#comic img", | ||
"value": "@title" | ||
} | ||
} | ||
}, | ||
"schedule": "every_1d", | ||
"keep_events_for": 0, | ||
"propagate_immediately": false | ||
}, | ||
{ | ||
"type": "Agents::EventFormattingAgent", | ||
"name": "Comic Formatter", | ||
"disabled": false, | ||
"guid": "d86b069650edadfc61db9df767c8b65c", | ||
"options": { | ||
"instructions": { | ||
"message": "<h2>{{title}}</h2><img src=\"{{url}}\"/> <p>{{hovertext}}</p>" | ||
}, | ||
"matchers": [ | ||
|
||
], | ||
"mode": "clean" | ||
}, | ||
"keep_events_for": 2592000, | ||
"propagate_immediately": false | ||
} | ||
], | ||
"links": [ | ||
{ | ||
"source": 1, | ||
"receiver": 2 | ||
}, | ||
{ | ||
"source": 2, | ||
"receiver": 0 | ||
}, | ||
{ | ||
"source": 3, | ||
"receiver": 4 | ||
}, | ||
{ | ||
"source": 4, | ||
"receiver": 0 | ||
} | ||
], | ||
"control_links": [ | ||
|
||
] | ||
} |