yake 0.5.2 → 0.5.3
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/README.md +13 -8
- data/lib/yake/support.rb +1 -0
- data/lib/yake/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2cf5c971016a9089087501bca0a31862c9f2f9ffdd586e2dfb965a190a664da
|
4
|
+
data.tar.gz: 8eaab803ca82cb0610f8775753e3cc2f1c472833417ff7db3940f0813a3561d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecafe24268afd558fcd5bbf388d03f334112d8c272a1f49688121a70662186ccfbb706a2d96407b8bbc13870515e5f7907a2b267432387e71070aa9bd6d2da29
|
7
|
+
data.tar.gz: ae003774e4626ee4afc13fef2f0a480813fa91a4a03ba3d1a1480e5c5770a748d2c629949fdb07d6e3941cecfb2eb963276613082fbb7a1866105f4f4a831fd6
|
data/README.md
CHANGED
@@ -67,11 +67,11 @@ gem install yake
|
|
67
67
|
|
68
68
|
So why use `yake` for your Lambda functions?
|
69
69
|
|
70
|
-
|
70
|
+
### Event Logging
|
71
71
|
|
72
72
|
By default, the `handler` function wraps its block in log lines formatted to match the style of Amazon's native Lambda logs sent to CloudWatch. Each invocation of the handler will log both the _input event_ and the _returned value_, prefixed with the ID of the request:
|
73
73
|
|
74
|
-
```
|
74
|
+
```plaintext
|
75
75
|
START RequestId: 149c500f-028a-4b57-8977-0ef568cf8caf Version: $LATEST
|
76
76
|
INFO RequestId: 149c500f-028a-4b57-8977-0ef568cf8caf EVENT { … }
|
77
77
|
…
|
@@ -101,7 +101,7 @@ Fizz.new.logger == Yake.logger
|
|
101
101
|
# => true
|
102
102
|
```
|
103
103
|
|
104
|
-
|
104
|
+
### API Routes
|
105
105
|
|
106
106
|
A common use of Lambda functions is as a proxy for API Gateway. Oftentimes users will deploy a single Lambda function to handle all requests coming from API Gateway.
|
107
107
|
|
@@ -168,14 +168,14 @@ Route an event to one of the declared routes:
|
|
168
168
|
```ruby
|
169
169
|
handler :lambda_handler do |event|
|
170
170
|
route event
|
171
|
-
rescue Yake::UndeclaredRoute => err
|
171
|
+
rescue Yake::Errors::UndeclaredRoute => err
|
172
172
|
respond 404, { message: err.message }.to_json
|
173
173
|
rescue => err
|
174
174
|
respond 500, { message: err.message }.to_json
|
175
175
|
end
|
176
176
|
```
|
177
177
|
|
178
|
-
|
178
|
+
### Zero Dependencies
|
179
179
|
|
180
180
|
Finally, `yake` does not depend on any other gems, using the Ruby stdlib only. This helps keep your Lambda packages slim & speedy.
|
181
181
|
|
@@ -227,8 +227,13 @@ require 'yake/support'
|
|
227
227
|
`String` transformations:
|
228
228
|
|
229
229
|
```ruby
|
230
|
+
host = 'https://example.com/'
|
231
|
+
path = '/path/to/resource'
|
232
|
+
host / path
|
233
|
+
# => "https://example.com/path/to/resource"
|
234
|
+
|
230
235
|
'snake_case_string'.camel_case
|
231
|
-
# => SnakeCaseString
|
236
|
+
# => "SnakeCaseString"
|
232
237
|
|
233
238
|
"Zml6eg==\n".decode64
|
234
239
|
# => "fizz"
|
@@ -237,7 +242,7 @@ require 'yake/support'
|
|
237
242
|
# => "Zml6eg==\n"
|
238
243
|
|
239
244
|
'CamelCaseString'.snake_case
|
240
|
-
# =>
|
245
|
+
# => "camel_case_string"
|
241
246
|
|
242
247
|
'Zml6eg=='.strict_decode64
|
243
248
|
# => "fizz"
|
@@ -259,7 +264,7 @@ require 'yake/support'
|
|
259
264
|
# => :SnakeCaseSymbol
|
260
265
|
|
261
266
|
:CamelCaseSymbol.snake_case
|
262
|
-
# =>
|
267
|
+
# => :camel_case_symbol
|
263
268
|
```
|
264
269
|
|
265
270
|
`UTC` Time helper
|
data/lib/yake/support.rb
CHANGED
@@ -5,6 +5,7 @@ require 'time'
|
|
5
5
|
class Hash
|
6
6
|
def encode64() to_json.encode64 end
|
7
7
|
def strict_encode64() to_json.strict_encode64 end
|
8
|
+
def stringify_names() JSON.parse(to_json) end
|
8
9
|
def symbolize_names() JSON.parse(to_json, symbolize_names: true) end
|
9
10
|
def to_form() URI.encode_www_form(self) end
|
10
11
|
end
|
data/lib/yake/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Mancevice
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|