rack-apimock 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1c9ed163bbb540b702ecaa683afa0511adc73b6
4
- data.tar.gz: ce815b6d9bd6cbf120bd19d5c27d5de37d8482f4
3
+ metadata.gz: 2b5e34c9b253a422bf582b6181fa3f3965c18b66
4
+ data.tar.gz: 416799541c1b566969c8416db53624348d38e699
5
5
  SHA512:
6
- metadata.gz: b7076823ef79c84558f1bd00980b15ae82102128ca195030e49731877d4162e7c7281b7f6340d19652a9260f01c14e8348e8401323e8ddd2919664e60b6d4838
7
- data.tar.gz: 596dffcd599b557500411ad972267166f6356878e6856409e1c0c34cb7d61a7f7219b4eb21c6b583128172d9a769317b1c0bd8560bae02fefd421c213791b359
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.downcase}_#{request_method}*"
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
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "rack-apimock"
7
- spec.version = "0.0.1"
7
+ spec.version = "0.0.2"
8
8
  spec.authors = ["hiro-su"]
9
9
  spec.email = ["h.sugipon@gmail.com"]
10
10
 
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.1
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-05-01 00:00:00.000000000 Z
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: