API docs and default radius changes plus merging of feature_lock on FE

pull/336/head
Rick Carlino 2017-06-29 13:45:36 -05:00
parent 87e79310a7
commit 17317e2465
3 changed files with 36 additions and 4 deletions

View File

@ -1,15 +1,15 @@
<% if (response.success? || note.present?) %>
# <%= response.success? ? "" : "(NOT OK)" %> <%= request.method %> <%= request.path.first(45) %>
# <%= response.success? ? "" : "(NOT OK)" %> <%= request.pretty_url %>
<% if note.present? %>
**Notes:** <%= note %>
<% end %>
<% if request.params.except(:controller, :action, :format, :id).keys.length > 0 %>
<% if request.has_params? %>
### Request
```
<%=
JSON.pretty_generate(request.params.except(:controller, :action, :format, :id, :user_id, :device_id))
request.display_body
%>
```
<% end %>

View File

@ -0,0 +1,5 @@
class ChangeDefaultRadius < ActiveRecord::Migration[5.1]
def change
change_column :points, :radius, :float, default: 25
end
end

View File

@ -37,7 +37,7 @@ RSpec.configure do |config|
if ENV['DOCS']
config.after(:each, type: :controller) do
SmarfDoc.run!(request, response)
SmarfDoc.run!(NiceResponse.new(request), response)
end
config.after(:suite) do
@ -52,3 +52,30 @@ def const_reassign(target, const, value)
target.send(:remove_const, const)
target.const_set(const, value)
end
class NiceResponse
attr_reader :r
def initialize(r)
@r = r
end
def path
r.path
end
def pretty_url
r.method + " " + r.path.first(45)
end
def has_params?
r.params.except(:controller, :action, :format, :id).keys.length > 0
end
def display_body
p = r
.params
.except(:controller, :action, :format, :id, :user_id, :device_id)
JSON.pretty_generate(p)
end
end