tck-lambdas 0.3.9 → 0.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 264c0df104ee343bd27dfde538318a7160fe35b4
4
- data.tar.gz: da2906b63d61bbceba82627f6f9eb788f5d63f4d
3
+ metadata.gz: 07c9d67504137ca8f84bdf970116026d96943f96
4
+ data.tar.gz: dde10019ff6a1ff92fc0a5ad47e109cd268f464a
5
5
  SHA512:
6
- metadata.gz: 2a28180b58d3d6aca1906c441a6bf2e5e29dfff96b1b0e0f84d1e1d4caba32d9d2a22ee8565b172ea50186d784cc7e77ebb0d0fcf760c7010c8184c8c586759a
7
- data.tar.gz: 6b5efc28c0fec85716936829ad42ca10bdb7010586024105b2cd5513983d456553dacd6187b0d6ab0b65b42bfcb19baef0022d40bd19f8b55d3015383c26f283
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 (event.module === undefined) {
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 = event.module;
20
+ chistacojs_param = data.module;
20
21
  };
21
22
 
22
23
  switch(chistacojs_param) {
@@ -1 +1,3 @@
1
- { "module": "i_do_not_exist" }
1
+ {
2
+ 'body': '{ "module": "i_do_not_exist" }'
3
+ }
@@ -1 +1,3 @@
1
- {}
1
+ {
2
+ 'body': '{}'
3
+ }
@@ -1 +1,3 @@
1
- { "module": "chistescortos" }
1
+ {
2
+ 'body': '{ "module": "chistescortos" }'
3
+ }
@@ -1 +1,3 @@
1
- { "module": "chyton" }
1
+ {
2
+ 'body': '{ "module": "chyton" }'
3
+ }
@@ -1 +1,3 @@
1
- { "module": "refreshing" }
1
+ {
2
+ 'body': '{ "module": "refreshing" }'
3
+ }
@@ -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 (!event.domain) { context.fail('domain: empty'); return; }
11
+ if (!data.domain) { context.fail('domain: empty'); return; }
11
12
 
12
- var domain = conf.domains[event.domain];
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 (!event.email) { context.fail('email: empty'); return; }
19
- if (!event.message || event.message === '') { context.fail('message: empty'); return; }
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(event.email);
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 (event.name) messageParts.push("Name: " + event.name);
27
- if (event.company) messageParts.push("Company: " + event.company);
28
- if (event.phone) messageParts.push("Phone: " + event.phone);
29
- messageParts.push("Email: " + event.email);
30
- messageParts.push("\r\n" + event.message);
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 ((event.cc) && (event.cc == "1")) {
46
- params.Destination.CcAddresses = [ event.email ];
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
- "name": "Probando Nueva Lambda",
3
- "company": "TckExperience",
4
- "phone": "699433244",
5
- "email": "fernando.gs@gmail.com",
6
- "message": "Disculpa las molestias"
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
- "domain": "tck.com",
3
- "name": "Probando Nueva Lambda",
4
- "company": "TckExperience",
5
- "phone": "699433244",
6
- "email": "fernando.gs@gmail.com",
7
- "message": "Disculpa las molestias"
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
- "domain": "the-cocktail.com",
3
- "name": "Probando Nueva Lambda",
4
- "company": "TckExperience",
5
- "phone": "699433244",
6
- "message": "Disculpa las molestias"
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
- "domain": "the-cocktail.com",
3
- "name": "Probando Nueva Lambda",
4
- "company": "TckExperience",
5
- "phone": "699433244",
6
- "email": "email@the-cocktail",
7
- "message": "Disculpa las molestias"
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
- "domain": "the-cocktail.com",
3
- "name": "Probando Nueva Lambda",
4
- "company": "TckExperience",
5
- "phone": "699433244",
6
- "email": "fernando.gs@gmail.com"
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
- "domain": "the-cocktail.com",
3
- "name": "Probando Nueva Lambda",
4
- "company": "TckExperience",
5
- "phone": "600123456",
6
- "email": "tcklambdas@gmail.com",
7
- "message": "Disculpa las molestias"
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
- "domain": "the-cocktail.com",
3
- "name": "Probando Nueva Lambda",
4
- "company": "TckExperience",
5
- "phone": "6123456789",
6
- "email": "tcklambdas@gmail.com",
7
- "cc": "1",
8
- "message": "Disculpa las molestias"
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
  }
@@ -5,6 +5,12 @@ provider:
5
5
  runtime: nodejs4.3
6
6
  stage: dev
7
7
  # region: eu-west-1
8
+ iamRoleStatements:
9
+ - Effect: "Allow"
10
+ Action:
11
+ - "ses:SendEmail"
12
+ - "ses:SendRawEmail"
13
+ Resource : "*"
8
14
 
9
15
  functions:
10
16
  <%= @lambda.name %>:
@@ -1,5 +1,5 @@
1
1
  module Tck
2
2
  module Lambdas
3
- VERSION = "0.3.9"
3
+ VERSION = "0.3.10"
4
4
  end
5
5
  end
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.9
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-13 00:00:00.000000000 Z
11
+ date: 2016-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor