tck-lambdas 0.3.9 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tck/lambdas/chistacojs/source/chistacojs.js +3 -2
- data/lib/tck/lambdas/chistacojs/test/failed/module_not_found.json +3 -1
- data/lib/tck/lambdas/chistacojs/test/succeeded/basic.json +3 -1
- data/lib/tck/lambdas/chistacojs/test/succeeded/chistescortos_module.json +3 -1
- data/lib/tck/lambdas/chistacojs/test/succeeded/chyton_module.json +3 -1
- data/lib/tck/lambdas/chistacojs/test/succeeded/refreshing_module.json +3 -1
- data/lib/tck/lambdas/contact_form/source/contact_form.js +13 -12
- data/lib/tck/lambdas/contact_form/test/failed/domain_empty.json +8 -5
- data/lib/tck/lambdas/contact_form/test/failed/domain_not_found.json +9 -6
- data/lib/tck/lambdas/contact_form/test/failed/email_empty.json +8 -5
- data/lib/tck/lambdas/contact_form/test/failed/email_format.json +9 -6
- data/lib/tck/lambdas/contact_form/test/failed/message_empty.json +8 -5
- data/lib/tck/lambdas/contact_form/test/succeeded/basic.json +9 -6
- data/lib/tck/lambdas/contact_form/test/succeeded/with_cc.json +10 -7
- data/lib/tck/lambdas/templates/serverless.yml.erb +6 -0
- data/lib/tck/lambdas/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07c9d67504137ca8f84bdf970116026d96943f96
|
4
|
+
data.tar.gz: dde10019ff6a1ff92fc0a5ad47e109cd268f464a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e247ade080b33125ba5b096f0cbc8fc81a8603749b18d9b993760e619ae8d08ed6b17685f1849f15b1f3cee7f47432fdab0856d705f1373e09e108bd07c2650
|
7
|
+
data.tar.gz: 0e078637b8aaa05014fbad3770b58d2ba47303f2f56a9756d311a5f1d29eefe829a5b31c291ce6e796e5e41786811c5fda1eae8d695a2f5dd5d54ad521aa67a1
|
@@ -10,13 +10,14 @@ var conf = require('./conf'),
|
|
10
10
|
exports.handler = function(event, context) {
|
11
11
|
console.log('Received event:', JSON.stringify(event, null, 2));
|
12
12
|
console.log('chistacojs lambda version', conf.lambda_version);
|
13
|
+
var data = event.body;
|
13
14
|
var chistacojs_param, chistacojs_module;
|
14
|
-
if (
|
15
|
+
if (data.module === undefined) {
|
15
16
|
console.log('Unspecified "module", choosing a random one...');
|
16
17
|
var idx = Math.floor(Math.random() * conf.modules.length);
|
17
18
|
chistacojs_param = conf.modules[idx].param;
|
18
19
|
} else {
|
19
|
-
chistacojs_param =
|
20
|
+
chistacojs_param = data.module;
|
20
21
|
};
|
21
22
|
|
22
23
|
switch(chistacojs_param) {
|
@@ -6,28 +6,29 @@ var utils = require('./utils');
|
|
6
6
|
|
7
7
|
exports.handler = function(event, context) {
|
8
8
|
console.log('Received event:', JSON.stringify(event, null, 2));
|
9
|
+
var data = event.body;
|
9
10
|
|
10
|
-
if (!
|
11
|
+
if (!data.domain) { context.fail('domain: empty'); return; }
|
11
12
|
|
12
|
-
var domain = conf.domains[
|
13
|
+
var domain = conf.domains[data.domain];
|
13
14
|
|
14
15
|
if (!domain) { context.fail('domain: not found'); return; }
|
15
16
|
|
16
17
|
console.log(domain.emailAddress);
|
17
18
|
|
18
|
-
if (!
|
19
|
-
if (!
|
19
|
+
if (!data.email) { context.fail('email: empty'); return; }
|
20
|
+
if (!data.message || data.message === '') { context.fail('message: empty'); return; }
|
20
21
|
|
21
|
-
var email = unescape(
|
22
|
+
var email = unescape(data.email);
|
22
23
|
if (!utils.validateEmail(email)) { context.fail('email: format'); return; }
|
23
24
|
|
24
25
|
var messageParts = [];
|
25
26
|
|
26
|
-
if (
|
27
|
-
if (
|
28
|
-
if (
|
29
|
-
messageParts.push("Email: " +
|
30
|
-
messageParts.push("\r\n" +
|
27
|
+
if (data.name) messageParts.push("Name: " + data.name);
|
28
|
+
if (data.company) messageParts.push("Company: " + data.company);
|
29
|
+
if (data.phone) messageParts.push("Phone: " + data.phone);
|
30
|
+
messageParts.push("Email: " + data.email);
|
31
|
+
messageParts.push("\r\n" + data.message);
|
31
32
|
|
32
33
|
var params = {
|
33
34
|
Destination: {
|
@@ -42,8 +43,8 @@ exports.handler = function(event, context) {
|
|
42
43
|
ReplyToAddresses: [ email ]
|
43
44
|
};
|
44
45
|
|
45
|
-
if ((
|
46
|
-
params.Destination.CcAddresses = [
|
46
|
+
if ((data.cc) && (data.cc == "1")) {
|
47
|
+
params.Destination.CcAddresses = [ data.email ];
|
47
48
|
}
|
48
49
|
|
49
50
|
ses.sendEmail(params, function(err, data) {
|
@@ -1,7 +1,10 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
'body': '\
|
3
|
+
{\
|
4
|
+
"name": "Probando Nueva Lambda",\
|
5
|
+
"company": "TckExperience",\
|
6
|
+
"phone": "699433244",\
|
7
|
+
"email": "fernando.gs@gmail.com",\
|
8
|
+
"message": "Disculpa las molestias"\
|
9
|
+
}'
|
7
10
|
}
|
@@ -1,8 +1,11 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
'body': '\
|
3
|
+
{\
|
4
|
+
"domain": "tck.com",\
|
5
|
+
"name": "Probando Nueva Lambda",\
|
6
|
+
"company": "TckExperience",\
|
7
|
+
"phone": "699433244",\
|
8
|
+
"email": "fernando.gs@gmail.com",\
|
9
|
+
"message": "Disculpa las molestias"\
|
10
|
+
}'
|
8
11
|
}
|
@@ -1,7 +1,10 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
'body': '\
|
3
|
+
{\
|
4
|
+
"domain": "the-cocktail.com",\
|
5
|
+
"name": "Probando Nueva Lambda",\
|
6
|
+
"company": "TckExperience",\
|
7
|
+
"phone": "699433244",\
|
8
|
+
"message": "Disculpa las molestias"\
|
9
|
+
}'
|
7
10
|
}
|
@@ -1,8 +1,11 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
'body': '\
|
3
|
+
{\
|
4
|
+
"domain": "the-cocktail.com",\
|
5
|
+
"name": "Probando Nueva Lambda",\
|
6
|
+
"company": "TckExperience",\
|
7
|
+
"phone": "699433244",\
|
8
|
+
"email": "email@the-cocktail",\
|
9
|
+
"message": "Disculpa las molestias"\
|
10
|
+
}'
|
8
11
|
}
|
@@ -1,7 +1,10 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
'body': '\
|
3
|
+
{\
|
4
|
+
"domain": "the-cocktail.com",\
|
5
|
+
"name": "Probando Nueva Lambda",\
|
6
|
+
"company": "TckExperience",\
|
7
|
+
"phone": "699433244",\
|
8
|
+
"email": "email@the-cocktail.com"\
|
9
|
+
}'
|
7
10
|
}
|
@@ -1,8 +1,11 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
'body': '\
|
3
|
+
{\
|
4
|
+
"domain": "the-cocktail.com",\
|
5
|
+
"name": "Probando Nueva Lambda",\
|
6
|
+
"company": "TckExperience",\
|
7
|
+
"phone": "600123456",\
|
8
|
+
"email": "tcklambdas@gmail.com",\
|
9
|
+
"message": "Disculpa las molestias"\
|
10
|
+
}'
|
8
11
|
}
|
@@ -1,9 +1,12 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
'body': '\
|
3
|
+
{\
|
4
|
+
"domain": "the-cocktail.com",\
|
5
|
+
"name": "Probando Nueva Lambda",\
|
6
|
+
"company": "TckExperience",\
|
7
|
+
"phone": "600123456",\
|
8
|
+
"email": "tcklambdas@gmail.com",\
|
9
|
+
"cc": "1",\
|
10
|
+
"message": "Disculpa las molestias"\
|
11
|
+
}'
|
9
12
|
}
|
data/lib/tck/lambdas/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tck-lambdas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernando Garcia Samblas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|