api_sketch 0.1.4 → 0.1.5

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: f99281e8061a73b54dd8af84f8fd076e023702e2
4
- data.tar.gz: ce73daea2b0aa4850805c6dbe639f999c77593f5
3
+ metadata.gz: 8e6352e10485a0dd6459be63fa12a04346b34098
4
+ data.tar.gz: 37407cc18194ff48ad3144ce084241fe3690e55d
5
5
  SHA512:
6
- metadata.gz: 6f46717a180c8ad6936f0aed8301244034a8244422cacfce639a51d74446669ffa40ad96aae12bae119d03317eb5e7555950b0fc80ea692eee0568f629059ad3
7
- data.tar.gz: bbc627ba68f4b96a3e12b1adaadec474d2699e35d531107c7bfd88dc071dbe9d84e5fdf61f4e29625f582763bd941a5a4f3de341ba7b246e985d34eaac509002
6
+ metadata.gz: f9a6db241e83a09c79c931298a8de9f0ac2252ac11243990f448fc88a161198c608f3f4d0ef76d2ed4a7cab0042b15cf86bc06b5b5844a03d68626f7ebe1e340
7
+ data.tar.gz: 4ed5f29efcbc4cb6e9e963fc44eaeae94ba9ddd16e654e6eb833d4eb60b77f32b8cdf7aad9e713cb93f756f5d57dac9bbc17674b75c0af5f552ab0920531c2fe
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.1.5 / 2015-06-23
2
+ - Add links to index page.
3
+ - Add sample_call keyword for CURL examples
4
+
1
5
  # 0.1.4 / 2015-06-22
2
6
  - Fix issue with excessive document brackets at examples server
3
7
 
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"><%= resource.name %></div>
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
 
@@ -1,3 +1,3 @@
1
1
  module ApiSketch
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_sketch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Suhoviy