rack-goggles 1.0.0 → 1.1.0

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.
@@ -1,3 +1,7 @@
1
+ === 1.1.0 / 2010-09-18
2
+
3
+ * Pretty-print query params.
4
+
1
5
  === 1.0.0 / 2010-09-17
2
6
 
3
7
  * Birthday!
@@ -7,8 +7,9 @@
7
7
  See a "pretty" version of your API.
8
8
 
9
9
  Goggles installs a little tiny Sinatra app on a URL prefix and serves
10
- any JSON responses that come back as a prettyprinted HTML
11
- page.
10
+ any JSON responses that come back as a prettyprinted HTML page. There
11
+ are browser add-ons that do a great job with this sort of thing, but I
12
+ wanted something I could live-link from API docs.
12
13
 
13
14
  This could be a lot fancier and prettier, I just extracted the bare
14
15
  minimum from a production app. Patches welcome.
@@ -4,7 +4,7 @@ module Rack
4
4
  class Goggles < Sinatra::Base
5
5
 
6
6
  # Duh.
7
- VERSION = "1.0.0"
7
+ VERSION = "1.1.0"
8
8
 
9
9
  set :static, false
10
10
  set :public, ::File.expand_path("../goggles/public", __FILE__)
@@ -31,7 +31,10 @@ module Rack
31
31
  @json = result.last.first
32
32
  @json = "null" if @json.empty?
33
33
  @status = result.first
34
- @uri = env["REQUEST_URI"]
34
+ @path = env["PATH_INFO"]
35
+
36
+ params.delete "splat"
37
+ params.delete "token"
35
38
 
36
39
  erb :goggles
37
40
  end
@@ -3,3 +3,37 @@ body {
3
3
  margin: 0 5%;
4
4
  padding-bottom: 2em;
5
5
  }
6
+
7
+ h1 {
8
+ margin-bottom: 0;
9
+ }
10
+
11
+ dl {
12
+ float: left;
13
+ font-size: 80%;
14
+ margin: .5em 0 2em 0;
15
+ }
16
+
17
+ dt, dd {
18
+ background-color: #ddd;
19
+ float: left;
20
+ padding: 3px 4px;
21
+ }
22
+
23
+ dt {
24
+ font-weight: bolder;
25
+ }
26
+
27
+ dt:after {
28
+ content: ":";
29
+ }
30
+
31
+ dd {
32
+ margin: 0;
33
+ margin-right: .5em;
34
+ }
35
+
36
+ #json {
37
+ clear: left;
38
+ }
39
+
@@ -3,7 +3,7 @@
3
3
  <html>
4
4
  <head>
5
5
  <link href="/__goggles__/style.css" rel="stylesheet" type="text/css">
6
- <title>Goggles for <%= @uri %></title>
6
+ <title>Goggles for <%= @path %></title>
7
7
 
8
8
  <script type="text/javascript"
9
9
  src="/__goggles__/jquery.js"></script>
@@ -13,9 +13,16 @@
13
13
  </head>
14
14
 
15
15
  <body>
16
- <div id="header">
17
- <h1><%= "#@status: " if @status > 200%> <%= @uri %></h1>
18
- </div>
16
+ <h1>
17
+ <%= "#@status: " if @status != 200 %> <%= @path %>
18
+ </h1>
19
+
20
+ <dl>
21
+ <% params.each do |name, value| %>
22
+ <dt><%= name %></dt>
23
+ <dd><%= value %></dd>
24
+ <% end %>
25
+ </dl>
19
26
 
20
27
  <div id="json">
21
28
  </div>
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
+ - 1
7
8
  - 0
8
- - 0
9
- version: 1.0.0
9
+ version: 1.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - John Barnette
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-17 00:00:00 -07:00
17
+ date: 2010-09-18 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -50,8 +50,9 @@ description: |-
50
50
  See a "pretty" version of your API.
51
51
 
52
52
  Goggles installs a little tiny Sinatra app on a URL prefix and serves
53
- any JSON responses that come back as a prettyprinted HTML
54
- page.
53
+ any JSON responses that come back as a prettyprinted HTML page. There
54
+ are browser add-ons that do a great job with this sort of thing, but I
55
+ wanted something I could live-link from API docs.
55
56
 
56
57
  This could be a lot fancier and prettier, I just extracted the bare
57
58
  minimum from a production app. Patches welcome.