yake 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: e7f5484562df0ab45af1304729d8f5c6edc2a66082ba4bcd4ca718bcfdba1d96
4
- data.tar.gz: c63cb492e9a31e9cd29a06c93493bb28f7f1823eae6eb8f06a4d889b204048bc
3
+ metadata.gz: 117ea613cf7d5a703aba3702eb6ab076fa77490c7e7a901b1e00c22db5c55675
4
+ data.tar.gz: 8a9a8efba6b480218c2adf79990f567ed2d5a01756e98f4aa4e1d2ee7a6734fa
5
5
  SHA512:
6
- metadata.gz: fec877aefb902caa3b64562c255ac9d8f33dbbe878de88af3bfc985dacac7f4e7f2ad8c02dbc873987defb1c64f85695d2d6da035596ad5e3ee1c168a5303f27
7
- data.tar.gz: 5641f87b78f5fce7c1eec4cfd8c422afa56247ad27ab936587840563998feb98f1198e291c2b9c508f30414cf282a6f988ed0d79db18c639b21e6560266deba6
6
+ metadata.gz: 9c543d7f07274ba4b6fb707fcd2326dfc33a10e027723d39a78eaf0bf5937209968759b1caa497d1a024911d70d76221da449346da67defd8d0c2ee1a9a8dfad
7
+ data.tar.gz: 64f6319d4ad3578aa7920caba1315995b05df6790862bf0256a4b5019cf3e64c64b7861b4eec25acf4a4e729bfb44bc0e68b06863bcf7918a0980c2921a52fc5
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # λake
2
2
 
3
+ ![gem](https://img.shields.io/gem/v/yake?color=crimson&logo=rubygems&logoColor=eee&style=flat-square)
4
+ [![rspec](https://img.shields.io/github/workflow/status/amancevice/yake/RSpec?logo=github&style=flat-square)](https://github.com/amancevice/yake/actions)
5
+ [![coverage](https://img.shields.io/codeclimate/coverage/amancevice/yake?logo=code-climate&style=flat-square)](https://codeclimate.com/github/amancevice/yake/test_coverage)
6
+ [![maintainability](https://img.shields.io/codeclimate/maintainability/amancevice/yake?logo=code-climate&style=flat-square)](https://codeclimate.com/github/amancevice/yake/maintainability)
7
+
3
8
  Write your AWS Lambda function handlers using a Rake-like declarative syntax:
4
9
 
5
10
  ```ruby
@@ -94,41 +99,33 @@ Requiring the `yake/api` module will add the API-specific DSL into your handler.
94
99
  Define API routes using Sinatra-like syntax
95
100
 
96
101
  ```ruby
97
- # Declare 'DELETE /…' route key
98
102
  delete "/…" do |event|
99
- #
103
+ # Handle 'DELETE /…' route key events
100
104
  end
101
105
 
102
- # Declare 'GET /…' route key
103
106
  get "/…" do |event|
104
- #
107
+ # Handle 'GET /…' route key events
105
108
  end
106
109
 
107
- # Declare 'HEAD /…' route key
108
110
  head "/…" do |event|
109
- #
111
+ # Handle 'HEAD /…' route key events
110
112
  end
111
113
 
112
- # Declare 'OPTIONS /…' route key
113
114
  options "/…" do |event|
114
- #
115
+ # Handle 'OPTIONS /…' route key events
115
116
  end
116
117
 
117
- # Declare 'PATCH /…' route key
118
118
  patch "/…" do |event|
119
- #
119
+ # Handle 'PATCH /…' route key events
120
120
  end
121
121
 
122
- # Declare 'POST /…' route key
123
122
  post "/…" do |event|
124
- #
123
+ # Handle 'POST /…' route key events
125
124
  end
126
125
 
127
- # Declare 'PUT /…' route key
128
126
  put "/…" do |event|
129
- #
127
+ # Handle 'PUT /…' route key events
130
128
  end
131
-
132
129
  ```
133
130
 
134
131
  Helper methods are also made available to help produce a response for API Gateway:
@@ -137,12 +134,13 @@ Set a default header for ALL responses:
137
134
 
138
135
  ```ruby
139
136
  header "content-type" => "application/json; charset=utf-8"
137
+ header "x-custom-header" => "fizz"
140
138
  ```
141
139
 
142
140
  Produce an API Gateway-style response object:
143
141
 
144
142
  ```ruby
145
- respond 200, { ok: true }.to_json, "x-extra-header" => "fizz"
143
+ respond 200, { ok: true }.to_json, "x-extra-header" => "buzz"
146
144
  # {
147
145
  # "statusCode" => 200,
148
146
  # "body" => '{"ok":true}',
@@ -153,7 +151,7 @@ respond 200, { ok: true }.to_json, "x-extra-header" => "fizz"
153
151
  Route an event to one of the declared routes:
154
152
 
155
153
  ```ruby
156
- begin
154
+ handler :lambda_handler do |event|
157
155
  route event
158
156
  rescue Yake::UndeclaredRoute => err
159
157
  respond 404, { message: err.message }.to_json
@@ -175,7 +173,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/amance
175
173
  ## License
176
174
 
177
175
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
178
-
179
- ```
180
-
181
- ```
data/lib/yake/api.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "base64"
3
4
  require "json"
4
5
 
5
6
  require "yake"
data/lib/yake/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Yake
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Mancevice