Permalink
Browse files

remove Weather, Location, Facebook, Google modules and dependencies; …

…fix tests that don't work
  • Loading branch information...
1 parent 7f14087 commit cecd04f09233581e27bae1f3abc6aa09c5fb5364 PJW committed Aug 17, 2015
Showing with 564 additions and 8,001 deletions.
  1. +0 −42 Kynetx/Console.pm
  2. +0 −1 Kynetx/Directives.pm
  3. +1 −1 Kynetx/Expressions.pm
  4. +0 −64 Kynetx/Modules.pm
  5. +0 −42 Kynetx/Modules/Random.pm
  6. +2 −2 Kynetx/Modules/Twilio.pm
  7. +1 −1 Kynetx/Persistence.pm
  8. +0 −227 Kynetx/Predicates/Demographics.pm
  9. +0 −1,196 Kynetx/Predicates/Facebook.pm
  10. +0 −639 Kynetx/Predicates/Google.pm
  11. +0 −255 Kynetx/Predicates/Google/Calendar.pm
  12. +0 −853 Kynetx/Predicates/Google/OAuthHelper.pm
  13. +0 −117 Kynetx/Predicates/Location.pm
  14. +0 −158 Kynetx/Predicates/Markets.pm
  15. +0 −152 Kynetx/Predicates/MediaMarkets.pm
  16. +11 −98 Kynetx/Predicates/Time.pm
  17. +0 −367 Kynetx/Predicates/Weather.pm
  18. +1 −1 Kynetx/Response.pm
  19. +1 −1 Kynetx/RuleManager.pm
  20. BIN etc/db/demographics.dbx
  21. BIN etc/db/dma.dbx
  22. +1 −2 startup.pl
  23. +5 −161 t/ExprTests.pm
  24. +0 −92 t/Expressions.t
  25. +0 −250 t/Expressions/eXDI.t
  26. +0 −4 t/JavaScript.t
  27. +293 −597 t/Modules/HTTP.t
  28. +6 −14 t/Modules/OAuthModule.t
  29. +0 −77 t/Modules/Random.t
  30. +1 −1 t/Modules/Twilio.t
  31. +9 −4 t/Operators/Query.t
  32. +0 −307 t/Persistence/KXDI.t
  33. +12 −1 t/Postlude.t
  34. +0 −101 t/Predicates/Demographics.t
  35. +0 −870 t/Predicates/Facebook.t
  36. +0 −486 t/Predicates/Google.t
  37. +0 −110 t/Predicates/KPDS.wades3rdnipple
  38. +0 −94 t/Predicates/Location.t
  39. +0 −134 t/Predicates/Markets.skip
  40. +0 −103 t/Predicates/MediaMarkets.t
  41. +8 −28 t/Predicates/Time.t
  42. +0 −115 t/Predicates/Weather.t
  43. +3 −0 t/Request.t
  44. +4 −4 t/RuleManager.t
  45. +5 −7 t/Rules.t
  46. +5 −11 t/composableActions.t
  47. +195 −0 t/use_module.t
  48. +0 −211 widgets/weather.pl
View
@@ -37,10 +37,7 @@ use Kynetx::Rules qw(:all);
use Kynetx::Rids qw(:all);
use Kynetx::Modules qw(:all);
use Kynetx::Expressions qw(:all);
-use Kynetx::Predicates::Location qw(:all);
use Kynetx::Predicates::Time qw(:all);
-use Kynetx::Predicates::Weather qw(:all);
-use Kynetx::Predicates::Demographics qw(:all);
use Kynetx::Configure qw(:all);
@@ -191,47 +188,8 @@ sub show_context {
$context_template->param(client_info => \@client_info);
- my $demo_preds = Kynetx::Predicates::Demographics::get_predicates();
-
my @user_info = (
- { name => 'User IP Address',
- value => $req_info->{'ip'}},
-
- { name => 'City',
- value => get_geoip($req_info,'city')},
- { name => 'Region',
- value => get_geoip($req_info,'region')},
- { name => 'Zip Code',
- value => get_geoip($req_info,'postal_code')},
- { name => 'Country',
- value => get_geoip($req_info,'country_name')},
-
- { name => 'Local time',
- value => get_local_time($req_info)},
- { name => 'Local time zone',
- value => get_local_time($req_info)->time_zone->name},
-
-
- { name => 'Current temperature',
- value => get_weather($req_info,'curr_temp') . ' F'},
- { name => 'Current conditions',
- value => get_weather($req_info,'curr_cond') . ' '},
- { name => 'Tomorrow high',
- value => get_weather($req_info,'tomorrow_high') . ' F'},
- { name => 'Tomorrow low',
- value => get_weather($req_info,'tomorrow_low') . ' F'},
- { name => 'Tomorrow forecast',
- value => get_weather($req_info,'tomorrow_cond') . ' '},
-
-
- { name => 'Median income',
- value => '$'.get_demographics($req_info, 'median_income')},
- { name => 'Urban',
- value => &{$demo_preds->{'urban'}}($req_info) ? 'yes' : 'no'},
- { name => 'Rural',
- value => &{$demo_preds->{'rural'}}($req_info) ? 'yes' : 'no'},
-
);
$context_template->param(user_info => \@user_info);
@@ -88,7 +88,6 @@ sub send_directive {
my $direct = Kynetx::Directives->new($name);
$direct->set_options($opts);
$dir_doc->add($direct);
-# push @{$req_info->{'directives'}}, $direct;
}
sub emit_js {
@@ -500,7 +500,7 @@ sub eval_prim {
my $val0 = den_to_exp($vals->[0]);
my $val1 = den_to_exp($vals->[1]);
- if ($val0 eq "__undef__" || $val1 eq "__undef__") {
+ if (! defined $val0 || $val0 eq "__undef__" || $val1 eq "__undef__") {
return mk_expr_node('null','__undef__');
}
View
@@ -54,22 +54,16 @@ lookup_module_env
);
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
-use Kynetx::Predicates::Demographics;
-use Kynetx::Predicates::Location;
-use Kynetx::Predicates::Weather;
use Kynetx::Predicates::Time;
-use Kynetx::Predicates::Markets;
use Kynetx::Predicates::Referers;
use Kynetx::Predicates::Mobile;
use Kynetx::Predicates::Useragent;
use Kynetx::Predicates::KPDS;
use Kynetx::Predicates::Page;
use Kynetx::Predicates::Math;
use Kynetx::Predicates::Amazon;
-use Kynetx::Predicates::Google;
use Kynetx::Predicates::OData;
use Kynetx::Predicates::RSS;
-use Kynetx::Predicates::Facebook;
use Kynetx::Modules::Twitter;
use Kynetx::Modules::Email;
use Kynetx::Modules::Event;
@@ -266,44 +260,6 @@ sub eval_module {
$val =
Kynetx::Predicates::Math::do_math( $req_info, $function, $args );
}
- } elsif ( $source eq 'weather' ) {
- $preds = Kynetx::Predicates::Weather::get_predicates();
- if ( defined $preds->{$function} ) {
- $val = $preds->{$function}->( $req_info, $rule_env, $args );
- $val = Kynetx::Expressions::boolify($val || 0);
- } else {
- $val =
- Kynetx::Predicates::Weather::get_weather( $req_info, $function );
- }
- } elsif ( $source eq 'demographics' ) {
- $preds = Kynetx::Predicates::Demographics::get_predicates();
- if ( defined $preds->{$function} ) {
- $val = $preds->{$function}->( $req_info, $rule_env, $args );
- $val = Kynetx::Expressions::boolify($val || 0);
- } else {
- $val =
- Kynetx::Predicates::Demographics::get_demographics( $req_info,
- $function );
- }
- } elsif ( $source eq 'geoip' || $source eq 'location' ) {
- $preds = Kynetx::Predicates::Location::get_predicates();
- if ( defined $preds->{$function} ) {
- $val = $preds->{$function}->( $req_info, $rule_env, $args );
- $val = Kynetx::Expressions::boolify($val || 0);
- } else {
- $val =
- Kynetx::Predicates::Location::get_geoip( $req_info, $function );
- }
- } elsif ( $source eq 'stocks' || $source eq 'markets' ) {
- $preds = Kynetx::Predicates::Markets::get_predicates();
- if ( defined $preds->{$function} ) {
- $val = $preds->{$function}->( $req_info, $rule_env, $args );
- $val = Kynetx::Expressions::boolify($val || 0);
- } else {
- $val =
- Kynetx::Predicates::Markets::get_stocks( $req_info, $args->[0],
- $function );
- }
} elsif ( $source eq 'referer' ) {
$preds = Kynetx::Predicates::Referers::get_predicates();
@@ -404,26 +360,6 @@ sub eval_module {
} else {
$val = Kynetx::Predicates::RSS::eval_rss($req_info,$rule_env,$session,$rule_name,$function,$args);
}
- } elsif ($source eq 'google') {
- $preds = Kynetx::Predicates::Google::get_predicates();
- if (defined $preds->{$function}) {
- $val = $preds->{$function}->($req_info,$rule_env,$args);
- $val = Kynetx::Expressions::boolify($val || 0);
- } else {
- $val = Kynetx::Predicates::Google::eval_google($req_info,$rule_env,$session,$rule_name,$function,$args);
- }
- } elsif ($source eq 'facebook') {
- $preds = Kynetx::Predicates::Facebook::get_predicates();
- if (defined $preds->{$function}) {
- $val = $preds->{$function}->($req_info,$rule_env,$args);
- $val = Kynetx::Expressions::boolify($val || 0);
- } else {
- $val = Kynetx::Predicates::Facebook::eval_facebook($req_info,$rule_env,$session,$rule_name,$function,$args);
- }
- # } elsif ( $source eq 'snow' ) {
- # $preds = Kynetx::Actions::LetItSnow::get_predicates();
- # $val = $preds->{$function}->( $req_info, $rule_env, $args );
- # $val = Kynetx::Expressions::boolify($val || 0);
} elsif ( $source eq 'jquery_ui' ) {
$preds = Kynetx::Actions::JQueryUI::get_predicates();
$val = $preds->{$function}->( $req_info, $rule_env, $args );
@@ -105,48 +105,6 @@ sub rword {
}
$funcs->{'word'} = \&rword;
-sub rquote {
- my ($req_info, $function, $args) = @_;
- my $logger = get_logger();
- my $qurl = "http://www.iheartquotes.com/api/v1/random";
- my $opts = {};
- if (ref $args->[0] eq "HASH") {
- foreach my $key (keys %{$args->[0]}) {
- $logger->debug("Key: ", $key);
- $opts->{$key} = $args->[0]->{$key};
- }
- }
- $opts->{'format'} = 'json';
- my $response = Kynetx::Modules::HTTP::mk_http_request('GET',undef,$qurl,$opts,undef);
- my $struct= Kynetx::Json::jsonToAst_w($response->{'_content'});
- return $struct;
-
-}
-$funcs->{'quote'} = \&rquote;
-$funcs->{'fortune'} = \&rquote;
-
-sub rphoto {
- my ($req_info, $function, $args) = @_;
- my $logger = get_logger();
- my $purl = "http://picasaweb.google.com/data/feed/api/all";
- my $max = 1000;
- my $opts = {};
- $opts->{'alt'} = 'json';
- $opts->{'kind'} = 'photo';
- $opts->{'max-results'} = 1;
- if (ref $args->[0] eq "HASH") {
- foreach my $key (keys %{$args->[0]}) {
- $logger->debug("Key: ", $key);
- $opts->{$key} = $args->[0]->{$key};
- }
- }
- $opts->{'q'} = 'kitten' unless (defined $opts->{'q'});
- $opts->{'start-index'} = int(rand($max)) +1 unless (defined $opts->{'start-index'});
- my $response = Kynetx::Modules::HTTP::mk_http_request('GET',undef,$purl,$opts,undef);
- my $struct = Kynetx::Json::jsonToAst_w($response->{'_content'});
- return $struct->{'feed'}->{'entry'}->[0]->{'media$group'};
-}
-$funcs->{'photo'} = \&rphoto;
sub _uuid {
my ($req_info, $function, $args) = @_;
@@ -30,7 +30,7 @@ use Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
use Kynetx::Environments qw/:all/;
-use Kynetx::Predicates::Google::OAuthHelper qw(
+use Kynetx::OAuth::OAuthHelper qw(
get_consumer_tokens
);
use Kynetx::Directives qw/:all/;
@@ -272,7 +272,7 @@ sub do_place_call {
'Url' => $args->[2],
};
my $twilio_tokens =
- Kynetx::Predicates::Google::OAuthHelper::get_consumer_tokens(
+ Kynetx::OAuth::OAuthHelper::get_consumer_tokens(
$req_info,
$rule_env,
$session,
@@ -329,7 +329,7 @@ sub contains_trail_element {
if (defined $res) {
return $res->[0];
} else {
- return undef;
+ return 0;
}
}
Oops, something went wrong.

0 comments on commit cecd04f

Please sign in to comment.