sink-base 0.2.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbb64d562b66412279353b394efc804951e18dd5431d924de4251609597ce669
4
- data.tar.gz: 450e32b7d63f77c03b8768224ff13ae9a9e68eba2d994f7032586d8023c12585
3
+ metadata.gz: 3ab98031fd707921a81ce9b01cf710a99a52a768c541b115741334473595e269
4
+ data.tar.gz: 63dc96d4a2f001147b63e42da6d6048ffc47a6b34ac68d5ea5d20799eeff9501
5
5
  SHA512:
6
- metadata.gz: fc7654c665b2aedb77f80c9c9e6fcf06b7505fd537b6d86076fd71095fe9a6a33a06dd4054412f7d88b81ecd0a5f65a16e45a023e4a1a1591dabbd1daf5f4830
7
- data.tar.gz: f8553e85576645039190c2f462bf3a9f5dca945545fe37da7f8c63f78b3752f9019c09f00fdb8ffe39c97500e52ea3f57cf8a936a276a91d2416862915441f4e
6
+ metadata.gz: 24f8830efb40200433e57f439352c6f57d533d58c61f59f5d4901fde04814631ed49f55179ddd12aecd1be176deec8606ef4b8e924b77175743006e8e3387860
7
+ data.tar.gz: 29f43f0dc7edfc84a4b48f980e237c2c3951341b1e1ca88e1eb38f4297d35211699b5f5623da9ce738e740cae7f8e185254d1a6d7cfaffdfaa9a199049c99222
@@ -1,5 +1,5 @@
1
1
  module Sink
2
2
  module Base
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
@@ -0,0 +1,29 @@
1
+ module Sink
2
+ module Base
3
+ module View
4
+ class JsonRender
5
+ def bad_request(message)
6
+ render(400, message)
7
+ end
8
+
9
+ def not_found(message)
10
+ render(404, message)
11
+ end
12
+
13
+ private
14
+
15
+ def render(status_code, message)
16
+ {
17
+ statusCode: status_code,
18
+ headers: {
19
+ 'Content-Type' => 'application/json'
20
+ },
21
+ body: {
22
+ message: message,
23
+ }.to_json
24
+ }
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sink-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xu Yunlong
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-08 00:00:00.000000000 Z
11
+ date: 2021-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-dynamodb
@@ -43,6 +43,7 @@ files:
43
43
  - lib/sink/base.rb
44
44
  - lib/sink/base/dao/qa_dao.rb
45
45
  - lib/sink/base/version.rb
46
+ - lib/sink/base/view/json_render.rb
46
47
  - sink-base.gemspec
47
48
  homepage: https://github.com/talexu/sink-base
48
49
  licenses: []