Link | notifo |
Author | Jason Huck |
Category | Utility |
Version | 8.5.x |
License | Public Domain |
Posted | 07 Sep 2010 |
Updated | 07 Sep 2010 |
More by this author... |
A simple wrapper for the notifo API. Notifo is a free service which allows you to send push notifications to mobile devices. Requires [decode_json].
var('notifo') = notifo( -username='foo', -secret='bar'); $notifo->send_notification( -to='joeschmoe', -msg='This is a test notification message!', -label='A Test Label', -title='Test Title', -uri='http://www.foo.com/' );
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define_type( 'notifo', -prototype, -description='Wrapper for the Notifo API.' ); local( 'api_username' = string, 'api_secret' = string, 'api_root' = 'https://api.notifo.com/', 'api_version' = 'v1' ); define_tag( 'oncreate', -req='username', -req='secret' ); self->'api_username' = #username; self->'api_secret' = #secret; /define_tag; define_tag( 'send', -req='method', -req='params' ); local('response') = null; local('url') = (self->'api_root' + self->'api_version' + '/' + #method); protect; handle_error; #response = map( 'status' = 'error', 'response_code' = error_code, 'response_message' = error_msg ); /handle_error; #response = decode_json(include_url( #url, -username=self->'api_username', -password=self->'api_secret', -postparams=#params, -timeout=10, -connecttimeout=10 )); /protect; return(#response); /define_tag; define_tag('_unknowntag'); local('params') = array; iterate(params, local('i')); local('n') = string(#i->first)->removeleading('-')&; #params->insert(#n = #i->second); /iterate; return(self->send( -method=tag_name, -params=#params)); /define_tag; /define_type;
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft