sixarm_ruby_action_dispatch_response_json 1.0.0
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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -0
- data/.gemtest +0 -0
- data/CONTRIBUTING.md +28 -0
- data/README.md +89 -0
- data/Rakefile +8 -0
- data/VERSION +1 -0
- data/lib/sixarm_ruby_action_dispatch_response_json.rb +23 -0
- data/test/sixarm_ruby_action_dispatch_response_json_test.rb +26 -0
- metadata +78 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d3778f1bb04235e11c9354bde441af79d8834307
|
4
|
+
data.tar.gz: a94d817ee2ecb30354679d7e0450fdd625e20f41
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 60dee97688053bf1d42b286d32bea2f213f6bc92f20b3c6f06f5c0fc5c576fac6e53a40c27d0b283df7e7a7d8030db4833067d9c15cb76eaa1558f296374bd9d
|
7
|
+
data.tar.gz: 7993720cf93d1f2d1e8e1a81b5765416561cc57910d56d59e4df603dd55a422dce2c5b1b9b899f7da07c6aa9f023a26d568ac022b6905ff4cd1cb3450a0aa939
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
W��K��=�8;�^=�
|
data/.gemtest
ADDED
File without changes
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
Thank you for contributing!
|
4
|
+
|
5
|
+
If you would like to contribute a donation, an easy way is to use PayPal to sixarm@sixarm.com.
|
6
|
+
|
7
|
+
If you would like to contribute help, the next section is for you.
|
8
|
+
|
9
|
+
|
10
|
+
## Contributing to the source
|
11
|
+
|
12
|
+
We love pull requests for improvments to the source code and documentation.
|
13
|
+
|
14
|
+
There are three easy steps:
|
15
|
+
|
16
|
+
1. Fork the repo.
|
17
|
+
|
18
|
+
* Before you do any work please run our existing tests to make sure the code runs cleanly.
|
19
|
+
|
20
|
+
2. Work as you like.
|
21
|
+
|
22
|
+
* Please create tests. This helps us know that all your code runs cleanly.
|
23
|
+
|
24
|
+
3. Push to your fork and submit a pull request.
|
25
|
+
|
26
|
+
* We'll take a look as soon as we can; this is typically within a business day.
|
27
|
+
|
28
|
+
Thank you again!
|
data/README.md
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# SixArm.com » Ruby » <br> ActionPack Response#json method
|
2
|
+
|
3
|
+
[](https://codeclimate.com/github/SixArm/sixarm_ruby_action_dispatch_response_json)
|
4
|
+
[](https://travis-ci.org/SixArm/sixarm_ruby_action_dispatch_response_json)
|
5
|
+
|
6
|
+
* Doc: <http://sixarm.com/sixarm_ruby_action_dispatch_response_json/doc>
|
7
|
+
* Gem: <http://rubygems.org/gems/sixarm_ruby_action_dispatch_response_json>
|
8
|
+
* Repo: <http://github.com/sixarm/sixarm_ruby_action_dispatch_response_json>
|
9
|
+
* Email: Joel Parker Henderson, <joel@sixarm.com>
|
10
|
+
|
11
|
+
|
12
|
+
## Introduction
|
13
|
+
|
14
|
+
Add ActionPack Response#json method.
|
15
|
+
|
16
|
+
So instead of this:
|
17
|
+
|
18
|
+
JSON.parse(response.body)
|
19
|
+
|
20
|
+
You can write this:
|
21
|
+
|
22
|
+
JSON.parse(response.json)
|
23
|
+
|
24
|
+
|
25
|
+
For docs go to <http://sixarm.com/sixarm_ruby_action_dispatch_response_json/doc>
|
26
|
+
|
27
|
+
Want to help? We're happy to get pull requests.
|
28
|
+
|
29
|
+
|
30
|
+
## Install quickstart
|
31
|
+
|
32
|
+
Install:
|
33
|
+
|
34
|
+
gem install sixarm_ruby_action_dispatch_response_json
|
35
|
+
|
36
|
+
Bundler:
|
37
|
+
|
38
|
+
gem "sixarm_ruby_action_dispatch_response_json", ">=1.0.0", "<2"
|
39
|
+
|
40
|
+
Require:
|
41
|
+
|
42
|
+
require "sixarm_ruby_action_dispatch_response_json"
|
43
|
+
|
44
|
+
|
45
|
+
## Install with security (optional)
|
46
|
+
|
47
|
+
To enable high security for all our gems:
|
48
|
+
|
49
|
+
wget http://sixarm.com/sixarm.pem
|
50
|
+
gem cert --add sixarm.pem
|
51
|
+
gem sources --add http://sixarm.com
|
52
|
+
|
53
|
+
To install with high security:
|
54
|
+
|
55
|
+
gem install sixarm_ruby_action_dispatch_response_json --trust-policy HighSecurity
|
56
|
+
|
57
|
+
|
58
|
+
## Changes
|
59
|
+
|
60
|
+
* 2015-02-12 1.0.0 Create
|
61
|
+
|
62
|
+
|
63
|
+
## License
|
64
|
+
|
65
|
+
You may choose any of these open source licenses:
|
66
|
+
|
67
|
+
* Apache License
|
68
|
+
* BSD License
|
69
|
+
* CreativeCommons License, Non-commercial Share Alike
|
70
|
+
* GNU General Public License Version 2 (GPL 2)
|
71
|
+
* GNU Lesser General Public License (LGPL)
|
72
|
+
* MIT License
|
73
|
+
* Perl Artistic License
|
74
|
+
* Ruby License
|
75
|
+
|
76
|
+
The software is provided "as is", without warranty of any kind,
|
77
|
+
express or implied, including but not limited to the warranties of
|
78
|
+
merchantability, fitness for a particular purpose and noninfringement.
|
79
|
+
|
80
|
+
In no event shall the authors or copyright holders be liable for any
|
81
|
+
claim, damages or other liability, whether in an action of contract,
|
82
|
+
tort or otherwise, arising from, out of or in connection with the
|
83
|
+
software or the use or other dealings in the software.
|
84
|
+
|
85
|
+
This license is for the included software that is created by SixArm;
|
86
|
+
some of the included software may have its own licenses, copyrights,
|
87
|
+
authors, etc. and these do take precedence over the SixArm license.
|
88
|
+
|
89
|
+
Copyright (c) 2005-2015 Joel Parker Henderson
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
=begin rdoc
|
3
|
+
Please see README
|
4
|
+
=end
|
5
|
+
|
6
|
+
require 'action_dispatch'
|
7
|
+
require 'json'
|
8
|
+
|
9
|
+
module ActionDispatch
|
10
|
+
class Response
|
11
|
+
|
12
|
+
# Returns the response body as JSON.
|
13
|
+
def json
|
14
|
+
JSON.parse(body)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Allows you to manually set or override the response body as JSON.
|
18
|
+
def json=(json)
|
19
|
+
self.body=json
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'minitest/autorun'
|
3
|
+
Minitest::Test ||= MiniTest::Unit::TestCase
|
4
|
+
require 'simplecov'
|
5
|
+
SimpleCov.start
|
6
|
+
require 'sixarm_ruby_action_dispatch_response_json'
|
7
|
+
|
8
|
+
describe "ActionDispatchResponseJSONTest" do
|
9
|
+
|
10
|
+
describe "#json" do
|
11
|
+
it "gets the response body as json" do
|
12
|
+
resp = ActionDispatch::Response.new
|
13
|
+
resp.body = '{"a":"b"}'
|
14
|
+
resp.json.must_equal({"a"=>"b"})
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#json=" do
|
19
|
+
it "sets the response body from json" do
|
20
|
+
resp = ActionDispatch::Response.new
|
21
|
+
resp.json = {"a"=>"b"}.to_json
|
22
|
+
resp.body.must_equal('{"a":"b"}')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sixarm_ruby_action_dispatch_response_json
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- SixArm
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDbDC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V/sBKbTWtHe72pOWz/stQs2
|
28
|
+
xD8tQZvdAuBtRXx4ys6e3vigvYjdmTHUR9tT/NGCwmWj7KTk3mwNKBmuQGWTVWrV
|
29
|
+
h6r4cFMt3X5Zu+euYxHqDuwWyub9hp4s30/ea38CoYNdIZcSFtpGuvhwVDU0x5dg
|
30
|
+
sWRVEyjnjnNuAeLP9zv43IDXjS22L2efhap7IOinYjcecpfXJgQaU+6BFAY4sdkQ
|
31
|
+
S1STYSfs3qySBxxAeEyZTw==
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
34
|
+
dependencies: []
|
35
|
+
description: Convert response.body to response.json
|
36
|
+
email: sixarm@sixarm.com
|
37
|
+
executables: []
|
38
|
+
extensions: []
|
39
|
+
extra_rdoc_files: []
|
40
|
+
files:
|
41
|
+
- ".gemtest"
|
42
|
+
- CONTRIBUTING.md
|
43
|
+
- README.md
|
44
|
+
- Rakefile
|
45
|
+
- VERSION
|
46
|
+
- lib/sixarm_ruby_action_dispatch_response_json.rb
|
47
|
+
- test/sixarm_ruby_action_dispatch_response_json_test.rb
|
48
|
+
homepage: http://sixarm.com/
|
49
|
+
licenses:
|
50
|
+
- BSD
|
51
|
+
- GPL
|
52
|
+
- MIT
|
53
|
+
- PAL
|
54
|
+
- Various
|
55
|
+
metadata: {}
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options: []
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
requirements: []
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 2.4.5
|
73
|
+
signing_key:
|
74
|
+
specification_version: 4
|
75
|
+
summary: SixArm.com » Ruby » ActionDispatch Response#json method
|
76
|
+
test_files:
|
77
|
+
- test/sixarm_ruby_action_dispatch_response_json_test.rb
|
78
|
+
has_rdoc: true
|
metadata.gz.sig
ADDED
Binary file
|