hobby-json 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +3 -0
- data/hobby-json.gemspec +3 -1
- data/lib/hobby/json.rb +6 -1
- data/spec/helper.rb +3 -0
- data/spec/http/bad_request.yml +6 -0
- data/spec/http/echo.yml +13 -0
- data/spec/http_spec.rb +12 -0
- metadata +23 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b84e5a7d8db34627e1f5bec5d24c64627e102cb
|
4
|
+
data.tar.gz: df2792d1288bc19f6883fd7f15d7db0c6d628a16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7505c89b687929c3428a71234428cb100341482ceff937db8df559b1c8ae74e95a6258eceb1484f4a700423c11d1907e47f5259ea0f5477dc3fed437b4a829b
|
7
|
+
data.tar.gz: 853a766ea9250ae063acfb4434dd2865613cd415ea9ac2fb042fa7b8186efd048b92ba5f3832d4d82661b0fee8cdbc1ace4740ab403c067667136870a86546b5
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile.lock
|
data/Gemfile
ADDED
data/hobby-json.gemspec
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |g|
|
2
2
|
g.name = 'hobby-json'
|
3
3
|
g.files = `git ls-files`.split($/)
|
4
|
-
g.version = '0.0.
|
4
|
+
g.version = '0.0.3'
|
5
5
|
g.summary = 'A way to work with JSON in Hobby without too much verbosity.'
|
6
6
|
g.authors = ['Anatoly Chernow']
|
7
|
+
|
8
|
+
g.add_dependency 'rack'
|
7
9
|
end
|
data/lib/hobby/json.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'json'
|
2
|
+
require 'rack'
|
2
3
|
|
3
4
|
module Hobby
|
4
5
|
module JSON
|
@@ -14,7 +15,11 @@ module Hobby
|
|
14
15
|
end
|
15
16
|
|
16
17
|
def json
|
17
|
-
@json ||=
|
18
|
+
@json ||= begin
|
19
|
+
::JSON.parse request.body.read
|
20
|
+
rescue
|
21
|
+
response.status = 400
|
22
|
+
end
|
18
23
|
end
|
19
24
|
end
|
20
25
|
end
|
data/spec/helper.rb
ADDED
data/spec/http/echo.yml
ADDED
data/spec/http_spec.rb
ADDED
metadata
CHANGED
@@ -1,23 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hobby-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anatoly Chernow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
12
|
-
dependencies:
|
11
|
+
date: 2016-12-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rack
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
description:
|
14
28
|
email:
|
15
29
|
executables: []
|
16
30
|
extensions: []
|
17
31
|
extra_rdoc_files: []
|
18
32
|
files:
|
33
|
+
- ".gitignore"
|
34
|
+
- Gemfile
|
19
35
|
- hobby-json.gemspec
|
20
36
|
- lib/hobby/json.rb
|
37
|
+
- spec/helper.rb
|
38
|
+
- spec/http/bad_request.yml
|
39
|
+
- spec/http/echo.yml
|
40
|
+
- spec/http_spec.rb
|
21
41
|
homepage:
|
22
42
|
licenses: []
|
23
43
|
metadata: {}
|