api_sketch 0.1.4 → 0.1.5
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/CHANGELOG.md +4 -0
- data/README.md +4 -0
- data/examples/api_project/resources/places.rb +2 -0
- data/lib/api_sketch/model/resource.rb +1 -1
- data/lib/api_sketch/templates/bootstrap/index.html.erb +3 -1
- data/lib/api_sketch/templates/bootstrap/resource.html.erb +7 -0
- data/lib/api_sketch/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e6352e10485a0dd6459be63fa12a04346b34098
|
4
|
+
data.tar.gz: 37407cc18194ff48ad3144ce084241fe3690e55d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9a6db241e83a09c79c931298a8de9f0ac2252ac11243990f448fc88a161198c608f3f4d0ef76d2ed4a7cab0042b15cf86bc06b5b5844a03d68626f7ebe1e340
|
7
|
+
data.tar.gz: 4ed5f29efcbc4cb6e9e963fc44eaeae94ba9ddd16e654e6eb833d4eb60b77f32b8cdf7aad9e713cb93f756f5d57dac9bbc17674b75c0af5f552ab0920531c2fe
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -145,6 +145,8 @@ Each `resource` could have many `responses` with different `context`. For exampl
|
|
145
145
|
|
146
146
|
Resource `parameters` section's syntax it the same as for `resource` request parameters.
|
147
147
|
|
148
|
+
Resource attribute `sample_call` is used to provide example request to this endpoint. You may put thare some CURL request commands or some any other text data.
|
149
|
+
|
148
150
|
```ruby
|
149
151
|
resource "Update user profile" do # Resource name
|
150
152
|
action "update"
|
@@ -371,6 +373,8 @@ resource "Update user profile" do # Resource name
|
|
371
373
|
end
|
372
374
|
end
|
373
375
|
end
|
376
|
+
|
377
|
+
sample_call 'curl -v -H "Authorization: Token token=CFd6Sh_dCRT1DhwQQg9N" -H "Accept: application/json" -H "Content-type: application/json" -X PUT -d \'{ "user" : { "email" : "user.test@mail.com", "password" : "test_password" } }\' http://:domain/api/users/me.json'
|
374
378
|
end
|
375
379
|
```
|
376
380
|
|
@@ -63,6 +63,8 @@ resource "Create place" do
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
sample_call 'curl -v -H "Authorization: Token token=CFd6Sh_dCRT1DhwQQg9N" -H "Accept: application/json" -H "Content-type: application/json" -X POST -d \'{ "name" : "Cafe", "area" : "123.5" }\' http://:domain/api/places.json'
|
67
|
+
|
66
68
|
end
|
67
69
|
|
68
70
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class ApiSketch::Model::Resource < ApiSketch::Model::Base
|
2
2
|
|
3
|
-
attr_accessor :namespace, :action, :path, :http_method, :format, :headers, :parameters, :responses
|
3
|
+
attr_accessor :namespace, :action, :path, :http_method, :format, :headers, :parameters, :responses, :sample_call
|
4
4
|
|
5
5
|
# TODO: update this method to provide better id that is used as part of filename
|
6
6
|
def id
|
@@ -61,7 +61,9 @@
|
|
61
61
|
<div id="endpoints">
|
62
62
|
<% @resources.sort_by { |r| r.id }.each do |resource| %>
|
63
63
|
<div class="panel panel-default">
|
64
|
-
<div class="panel-heading"
|
64
|
+
<div class="panel-heading">
|
65
|
+
<a href="<%= nesting_path_prefix %>docs/<%= @generator.filename_for(resource) %>"><%= resource.name %></a>
|
66
|
+
</div>
|
65
67
|
<div class="panel-body">
|
66
68
|
<%= "#{resource.http_method} #{resource.path}" %>
|
67
69
|
<% if !(resource.description.nil? || resource.description.empty?) %>
|
@@ -201,6 +201,13 @@
|
|
201
201
|
<% end %>
|
202
202
|
</div>
|
203
203
|
<% end %>
|
204
|
+
|
205
|
+
<% if !(@resource.sample_call.nil? || @resource.sample_call.empty?) %>
|
206
|
+
<div class="panel panel-default">
|
207
|
+
<div class="panel-heading">Sample Call</div>
|
208
|
+
<div class="panel-body"><%= @resource.sample_call %></div>
|
209
|
+
</div>
|
210
|
+
<% end %>
|
204
211
|
</div>
|
205
212
|
</div>
|
206
213
|
|
data/lib/api_sketch/version.rb
CHANGED