apiculture 0.1.0 → 0.1.1

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: aa9f65f24dcec58c1fa839c4b06ad6707ff94929
4
- data.tar.gz: 972227095a632256fba17ff766701d6626135f19
3
+ metadata.gz: 79df0d596559e585252fcc1f7ae0d1e16a77fb5d
4
+ data.tar.gz: 98c6f7a14fb1578e56ac209ddf10b45b68a50902
5
5
  SHA512:
6
- metadata.gz: e4f2f860e3ede4b6969b6a42cd25157ff58ac1f9d5c9fa37d984e4e2eabe48b35c912efd358584a0392655c292e392feaed2e69fd13d992dba418419541c8139
7
- data.tar.gz: 03754e831d7b7a2e44fdb431906ffb6119d78ee1263a2978caf89e43983f216ad5f1d8ad61e331fcdedfe03f491ce9ff996cb6c39034fc78234adae370bccf91
6
+ metadata.gz: d8080b5a857dccd6e19749e631ada30e06b0c3aac6d6f93c5c8146a2a370e9f6349da49790850f0fd735b05c7bb89f4defc204617f1fe97c4bea36cbb77eba49
7
+ data.tar.gz: 0c9452c60ff24d6a56211c0efc5417d400dd88d88291b8df288e71e3bbbf3592eb2734a585aa0c2b14b886533b9a75865dbe6cebc0a911609a033f25755e86a9
@@ -70,7 +70,13 @@ class Apiculture::MethodDocumentation
70
70
  if for_response_definition.no_body?
71
71
  '(empty)'
72
72
  else
73
- JSON.pretty_generate(for_response_definition.jsonable_object_example)
73
+ begin
74
+ JSON.pretty_generate(for_response_definition.jsonable_object_example)
75
+ rescue JSON::GeneratorError
76
+ # pretty_generate refuses to generate scalars
77
+ # it wants objects or arrays. For bare JSON values .dump will do
78
+ JSON.dump(for_response_definition.jsonable_object_example)
79
+ end
74
80
  end
75
81
  end
76
82
 
@@ -1,3 +1,3 @@
1
1
  module Apiculture
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -13,6 +13,8 @@ describe Apiculture::MethodDocumentation do
13
13
  definition.route_parameters << Apiculture::RouteParameter.new(:pan_id, 'ID of the pancake frying pan')
14
14
  definition.http_verb = 'get'
15
15
  definition.path = '/pancake/:pan_id/bake'
16
+ definition.responses << Apiculture::PossibleResponse.new(200, "Pancake has been baked", {diameter: 10, unit: "cm"})
17
+ definition.responses << Apiculture::PossibleResponse.new(417, "Frying pan too cold", "ERR_NO_HEAT")
16
18
 
17
19
  documenter = described_class.new(definition)
18
20
 
@@ -27,6 +29,8 @@ describe Apiculture::MethodDocumentation do
27
29
  expect(generated_html).to include('ID of the pancake frying pan')
28
30
  expect(generated_html).to include('<h3>Request parameters</h3>')
29
31
  expect(generated_html).to include('<td>Pancake name</td>')
32
+ expect(generated_html).to include('<td>Pancake has been baked</td>')
33
+ expect(generated_html).to include('<td>Frying pan too cold</td>')
30
34
  end
31
35
 
32
36
  it 'generates HTML from an ActionDefinition without route params' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apiculture
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-05-28 00:00:00.000000000 Z
12
+ date: 2019-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mustermann
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  version: '0'
227
227
  requirements: []
228
228
  rubyforge_project:
229
- rubygems_version: 2.6.14.1
229
+ rubygems_version: 2.6.11
230
230
  signing_key:
231
231
  specification_version: 4
232
232
  summary: Sweet API sauce on top of Rack