rack-apimock 0.0.1 → 0.0.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 +4 -4
- data/README.md +21 -1
- data/lib/rack/apimock.rb +1 -1
- data/rack-apimock.gemspec +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b5e34c9b253a422bf582b6181fa3f3965c18b66
|
4
|
+
data.tar.gz: 416799541c1b566969c8416db53624348d38e699
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec93a5d969d1db7b9205e25e97c474b450a6e3e7c8750daa9908e110eab3867a8e32ef4dc00d863c9b2648f56a1f47fe07d1d5ccddabc92a7ed4de0033d5f4e2
|
7
|
+
data.tar.gz: 14ee3d556702b802f627945ca8127f909cc6e6c65e1a6262a39d3b6c68650eb6dcb8d252770e4c3409c71638f9f3ce210471265679b80e2226b47836f6fbd2cb
|
data/README.md
CHANGED
@@ -25,7 +25,27 @@ POST /items/1 => items/1_post.json.erb
|
|
25
25
|
|
26
26
|
```
|
27
27
|
<% @status = 200 %>
|
28
|
-
<% @headers = { "Content-Type" => "application/json" }
|
28
|
+
<% @headers = { "Content-Type" => "application/json" } %>
|
29
|
+
```
|
30
|
+
|
31
|
+
## Query String
|
32
|
+
|
33
|
+
template file is items/sample_post.json.erb
|
34
|
+
|
35
|
+
```
|
36
|
+
<% @status = 201 %>
|
37
|
+
<% @headers = { "Content-Type" => "application/json" } %>
|
38
|
+
{
|
39
|
+
"method" : "post",
|
40
|
+
"status" : <%= @status %>
|
41
|
+
}
|
42
|
+
```
|
43
|
+
|
44
|
+
request & response
|
45
|
+
|
46
|
+
```
|
47
|
+
$ curl -H 'Content-Type: application/json' -X POST http://localhost:9292/items/sample?method
|
48
|
+
{"method":"post"}
|
29
49
|
```
|
30
50
|
|
31
51
|
## Contributing
|
data/lib/rack/apimock.rb
CHANGED
@@ -38,7 +38,7 @@ module Rack
|
|
38
38
|
request_path = env['REQUEST_PATH']
|
39
39
|
request_path = "index" if request_path == "/"
|
40
40
|
request_method = env['REQUEST_METHOD'].downcase
|
41
|
-
template = ::File.join @apidir, "#{request_path
|
41
|
+
template = ::File.join @apidir, "#{request_path}_#{request_method}*"
|
42
42
|
content_type = unless env['CONTENT_TYPE'].nil? || env['CONTENT_TYPE'].empty?
|
43
43
|
env['CONTENT_TYPE']
|
44
44
|
end || 'application/json'
|
data/rack-apimock.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-apimock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hiro-su
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -109,4 +109,3 @@ signing_key:
|
|
109
109
|
specification_version: 4
|
110
110
|
summary: Simple Rack Middleware for API Mock
|
111
111
|
test_files: []
|
112
|
-
has_rdoc:
|