Skip to content

Instantly share code, notes, and snippets.

@trevordixon
Created March 7, 2014 05:06
Show Gist options
  • Save trevordixon/9405573 to your computer and use it in GitHub Desktop.
Save trevordixon/9405573 to your computer and use it in GitHub Desktop.
ruleset a2294x3 {
meta {
name "Hello World"
description <<
Hello World
>>
author ""
logging off
use module a169x701 alias CloudRain
use module a41x186 alias SquareTag
}
dispatch {
}
global {
}
rule display_checkin is active {
select when web cloudAppSelected
pre {
venue = ent:venue;
city = ent:city;
shout = ent:shout;
createdAt = ent:createdAt;
my_html = <<
<ul>
<li><strong>Venue</strong>: #{venue}</li>
<li><strong>City</strong>: #{city}</li>
<li><strong>Shout</strong>: #{shout}</li>
<li><strong>Created</strong>: #{createdAt}</li>
</ul>
>>;
}
{
SquareTag:inject_styling();
CloudRain:createLoadPanel("Latest Foursquare Checkin", {}, my_html);
}
}
rule process_fs_checkin {
select when foursquare checkin
pre {
checkin = event:attr("checkin").decode();
venue = checkin.pick("$..venue.name");
city = checkin.pick("$..location.city");
shout = checkin.pick("$..shout", true).head();
createdAt = checkin.pick("$..createdAt");
}
noop();
fired {
set ent:venue venue;
set ent:city city;
set ent:shout shout;
set ent:createdAt createdAt;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment