faastruby 0.4.1 → 0.4.2
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 -1
- data/Gemfile.lock +2 -2
- data/lib/faastruby/version.rb +1 -1
- data/templates/crystal/example/spec/handler_spec.cr +2 -7
- data/templates/crystal/example/src/handler.cr +1 -2
- data/templates/ruby/example-blank/spec/helpers/faastruby.rb +1 -1
- data/templates/ruby/example/spec/helpers/faastruby.rb +1 -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: c01308a98baef83f7584358342b5593f8017671243fccdb351bbca0501efb5e8
|
|
4
|
+
data.tar.gz: 02573d5f8483a4a0d797caac9f97659550bfbab776fbf879dfb7a67503bfd63c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 34bbb6de97544ddefdb8f8c9d233da3469b22b0145631b8dec39e31d2bfb4e1a9b4f8be53bba86a019caeb2ec0e4d46af66967a6c4f91bd50fe2da59bd98bd07
|
|
7
|
+
data.tar.gz: a74de808b41605fe03d80b1cc434c958b71b2373395e00c66ef7bd56b9ffc86a99555b28d9012130d0df6ef6382aa95e66e941cc3a526ad077fd7197346a2350
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
faastruby (0.4.
|
|
4
|
+
faastruby (0.4.1)
|
|
5
5
|
colorize (~> 0.8)
|
|
6
6
|
faastruby-rpc (~> 0.1.3)
|
|
7
7
|
oj (~> 3.6)
|
|
@@ -38,7 +38,7 @@ GEM
|
|
|
38
38
|
mustermann (1.0.3)
|
|
39
39
|
necromancer (0.4.0)
|
|
40
40
|
netrc (0.11.0)
|
|
41
|
-
oj (3.7.
|
|
41
|
+
oj (3.7.6)
|
|
42
42
|
pastel (0.7.2)
|
|
43
43
|
equatable (~> 0.5.0)
|
|
44
44
|
tty-color (~> 0.4.0)
|
data/lib/faastruby/version.rb
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
require "./spec_helper"
|
|
2
2
|
|
|
3
3
|
describe "handler(event)" do
|
|
4
|
-
body = {"name" => "Ruby"}.to_json
|
|
5
4
|
event_hash = {
|
|
6
|
-
"body" =>
|
|
5
|
+
"body" => nil,
|
|
7
6
|
"context" => nil,
|
|
8
7
|
"headers" => {"Content-Type" => "application/json"},
|
|
9
8
|
"query_params" => {} of String => String
|
|
@@ -14,11 +13,7 @@ describe "handler(event)" do
|
|
|
14
13
|
body = handler(event).body
|
|
15
14
|
body.class.should eq(String)
|
|
16
15
|
end
|
|
17
|
-
it "should
|
|
18
|
-
body = handler(event).body
|
|
19
|
-
body.should eq("Hello, Ruby!\n")
|
|
20
|
-
end
|
|
21
|
-
it "should say Hello, World! when name is not present" do
|
|
16
|
+
it "should say Hello, World!" do
|
|
22
17
|
event_hash["body"] = nil
|
|
23
18
|
event = Event.from_json(event_hash.to_json)
|
|
24
19
|
body = handler(event).body
|
|
@@ -8,7 +8,6 @@ def handler(event : FaaStRuby::Event) : FaaStRuby::Response
|
|
|
8
8
|
# event.headers : Hash(String, String)
|
|
9
9
|
# event.context : String | Nil
|
|
10
10
|
# query_params : Hash(String, String)
|
|
11
|
-
name = event.body ? JSON.parse(event.body.not_nil!)["name"] : "World"
|
|
12
11
|
# FUNCTION RESPONSE
|
|
13
12
|
#
|
|
14
13
|
# You can render text, json, yaml, html or js. Example:
|
|
@@ -23,5 +22,5 @@ def handler(event : FaaStRuby::Event) : FaaStRuby::Response
|
|
|
23
22
|
# The 'Content-Type' header is automatically set when you use 'render'.
|
|
24
23
|
# You can set custom headers using a Hash(String, String). Example:
|
|
25
24
|
# render text: "It Works!", headers: {"TransactionId" => 23928}
|
|
26
|
-
render text: "Hello,
|
|
25
|
+
render text: "Hello, World!\n"
|
|
27
26
|
end
|
|
@@ -53,7 +53,7 @@ module FaaStRuby
|
|
|
53
53
|
resp_body = text
|
|
54
54
|
when yaml
|
|
55
55
|
headers["Content-Type"] ||= "application/yaml"
|
|
56
|
-
resp_body = yaml.to_yaml
|
|
56
|
+
resp_body = yaml.is_a?(String) ? yaml : yaml.to_yaml
|
|
57
57
|
when body
|
|
58
58
|
headers["Content-Type"] ||= "application/octet-stream"
|
|
59
59
|
resp_body = raw
|
|
@@ -52,7 +52,7 @@ module FaaStRuby
|
|
|
52
52
|
resp_body = text
|
|
53
53
|
when yaml
|
|
54
54
|
headers["Content-Type"] ||= "application/yaml"
|
|
55
|
-
resp_body = yaml.to_yaml
|
|
55
|
+
resp_body = yaml.is_a?(String) ? yaml : yaml.to_yaml
|
|
56
56
|
when body
|
|
57
57
|
headers["Content-Type"] ||= "application/octet-stream"
|
|
58
58
|
resp_body = raw
|