faastruby 0.3.8 → 0.4.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/faastruby/version.rb +1 -1
- data/templates/ruby/example/handler.rb +7 -3
- data/templates/ruby/example/spec/handler_spec.rb +2 -7
- data/templates/ruby/example-blank/handler.rb +7 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 178ae19dfe92b53e2999fdc813c917d3857a1788913392399d0277f9be856ba6
|
4
|
+
data.tar.gz: 9cc19b7f28601b7ff0a9172bfd52959b41c7636b35bf7c42664c254d5c3d3aa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1efa109f73c944632dce9a603a4dabed5d4b988962adc473c93d9d23ee9a29b51f7de06a9cf791b46ca5530c55217176ce4d34d5e5a67ef9482338a436e66442
|
7
|
+
data.tar.gz: 4cd3bd725b0062e436fa76a4746aff4d23f43eb59f279f58ad2e3546eba4f51ac8b175e0f3ac63f332d02874aeb3b6b89984de75e785569cb4895f5143eca962
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/lib/faastruby/version.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
# require 'cool-gem'
|
2
|
-
require 'json'
|
3
2
|
|
4
3
|
# To deploy this function, cd into its folder and run:
|
5
4
|
# faastruby deploy-to WORKSPACE_NAME
|
6
5
|
def handler event
|
7
|
-
|
6
|
+
# The 'event' argument has the following attributes
|
7
|
+
# event.body - The request body
|
8
|
+
# event.context - The execution context
|
9
|
+
# event.headers - The request headers
|
10
|
+
# event.query_params - The query params
|
11
|
+
|
8
12
|
# FUNCTION RESPONSE
|
9
13
|
#
|
10
14
|
# You can render text, json, yaml, html or js. Example:
|
@@ -19,5 +23,5 @@ def handler event
|
|
19
23
|
# The 'Content-Type' header is automatically set when you use 'render'.
|
20
24
|
# You can set custom headers using a hash with string keys. Example:
|
21
25
|
# render text: 'It Works!', headers: {'TransactionId' => 23928}
|
22
|
-
render text: "Hello,
|
26
|
+
render text: "Hello, World!\n"
|
23
27
|
end
|
@@ -2,18 +2,13 @@ require 'spec_helper'
|
|
2
2
|
require 'handler'
|
3
3
|
|
4
4
|
describe 'handler(event)' do
|
5
|
-
let(:event) {SpecHelper::Event.new
|
5
|
+
let(:event) {SpecHelper::Event.new}
|
6
6
|
|
7
7
|
it 'should return Hash, String or Array' do
|
8
8
|
body = handler(event).call.body
|
9
9
|
expect([String, Hash, Array].include? body.class).to be true
|
10
10
|
end
|
11
|
-
it 'should
|
12
|
-
body = handler(event).call.body
|
13
|
-
expect(body).to be == "Hello, Ruby!\n"
|
14
|
-
end
|
15
|
-
it 'should say Hello, World! when name is not present' do
|
16
|
-
event = SpecHelper::Event.new(body: nil)
|
11
|
+
it 'should reply Hello, World!' do
|
17
12
|
body = handler(event).call.body
|
18
13
|
expect(body).to be == "Hello, World!\n"
|
19
14
|
end
|
@@ -1,6 +1,12 @@
|
|
1
1
|
# To deploy this function, cd into its folder and run:
|
2
2
|
# faastruby deploy-to WORKSPACE_NAME
|
3
3
|
def handler event
|
4
|
+
# The 'event' argument has the following attributes
|
5
|
+
# event.body - The request body
|
6
|
+
# event.context - The execution context
|
7
|
+
# event.headers - The request headers
|
8
|
+
# event.query_params - The query params
|
9
|
+
|
4
10
|
# FUNCTION RESPONSE
|
5
11
|
#
|
6
12
|
# You can render text, json, yaml, html or js. Example:
|
@@ -16,5 +22,5 @@ def handler event
|
|
16
22
|
# You can set custom headers using a hash with string keys. Example:
|
17
23
|
# render text: 'It Works!', headers: {'TransactionId' => 23928}
|
18
24
|
|
19
|
-
# Write code here
|
25
|
+
# TODO: Write code here
|
20
26
|
end
|