[notifo]

Description

Link: [notifo]
Author: Jason Huck
Category: Utility
Version: 8.5.x
License: Public Domain
Posted: Sep. 07, 2010
Updated: Jan. 01, 0001
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].

Parameters

none


Sample Usage

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/'
);
						

Source Code

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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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;

 

Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net