From b8c683d290cb12f523c806b288363254f67484b1 Mon Sep 17 00:00:00 2001
From: MrBrdo <mrbrdo@gmail.com>
Date: Tue, 19 Mar 2013 23:45:39 +0100
Subject: [PATCH] write http_method and route in custom json format, fixes #59

---
 features/combined_json.feature             |  4 ++++
 lib/rspec_api_documentation/json_writer.rb | 10 ++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/features/combined_json.feature b/features/combined_json.feature
index 94da4f48..3e8b2662 100644
--- a/features/combined_json.feature
+++ b/features/combined_json.feature
@@ -68,6 +68,8 @@ Feature: Combined text
     [
       {
         "resource": "Greetings",
+        "http_method": "GET",
+        "route": "/greetings",
         "description": "Greeting your favorite gem",
         "explanation": null,
         "parameters": [
@@ -103,6 +105,8 @@ Feature: Combined text
       },
       {
         "resource": "Greetings",
+        "http_method": "GET",
+        "route": "/greetings",
         "description": "Greeting your favorite developers of your favorite gem",
         "explanation": null,
         "parameters": [
diff --git a/lib/rspec_api_documentation/json_writer.rb b/lib/rspec_api_documentation/json_writer.rb
index ffa3fe3e..10c395cb 100644
--- a/lib/rspec_api_documentation/json_writer.rb
+++ b/lib/rspec_api_documentation/json_writer.rb
@@ -81,14 +81,20 @@ def filename
       "#{basename}.json"
     end
 
-    def to_json
+    def as_json
       {
         :resource => resource_name,
+        :http_method => http_method,
+        :route => route,
         :description => description,
         :explanation => explanation,
         :parameters => respond_to?(:parameters) ? parameters : [],
         :requests => requests
-      }.to_json
+      }
+    end
+
+    def to_json
+      as_json.to_json
     end
 
     def requests