apipony 0.0.8 → 0.0.9
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/README.md +15 -17
- data/app/assets/stylesheets/apipony/styles.scss +13 -6
- data/lib/apipony/endpoint.rb +1 -1
- data/lib/apipony/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7456f0b6bcd79edd941bfba6e1db27e3c0b94f00
|
4
|
+
data.tar.gz: 08f3bb7e4dfdb5a590a78f8ed2be46b5a475e873
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8a9c0b84b6da18245b2dc3187a63ee8ad30de426d45a4fd47f2ee7e384405dd1e4a2665358f0df09b214804157afaa09d0a5c6c2c2410120782c281bfdb79ff
|
7
|
+
data.tar.gz: 4d7d48df1304b3e316adc35e410ae44f040195127e9dfcd4dca971c6c2dcd806d737ee0ceb31a68c1fd3173b1884333da21b02989c97a252f8390ce8fc45c2c1
|
data/README.md
CHANGED
@@ -25,7 +25,7 @@ Apipony::Documentation.define do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
section 'Ponies' do
|
28
|
-
endpoint
|
28
|
+
endpoint :get, '/ponies' do |e|
|
29
29
|
e.description = 'Find ponies'
|
30
30
|
|
31
31
|
request_with do
|
@@ -33,12 +33,10 @@ Apipony::Documentation.define do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
response_with 200 do
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
:occupation => :farmer
|
41
|
-
}
|
36
|
+
attribute :name, type: :string, example: 'applejack'
|
37
|
+
attribute :kind, type: :string, example: 'earth'
|
38
|
+
attribute :sex, type: :string, example: 'female'
|
39
|
+
attribute :occupation, type: :string, example: 'farmer'
|
42
40
|
end
|
43
41
|
end
|
44
42
|
end
|
@@ -50,8 +48,8 @@ end
|
|
50
48
|
|
51
49
|
### Response Attribute Documentation
|
52
50
|
Apipony lets you provide further documentation about the attributes in your
|
53
|
-
API's responses. Simply create a new `attribute` inside a `
|
54
|
-
These attributes can even have nested sub-attributes, for documentation of
|
51
|
+
API's responses. Simply create a new `attribute` inside a `response_with` block.
|
52
|
+
These attributes can even have nested sub-attributes, for documentation of
|
55
53
|
more complex object graphs.
|
56
54
|
|
57
55
|
```ruby
|
@@ -59,8 +57,8 @@ Apipony::Documentation.define do
|
|
59
57
|
section "Species" do
|
60
58
|
endpoint 'get', '/species/:id' do |e|
|
61
59
|
e.description = "Get information about a species"
|
62
|
-
|
63
|
-
example do
|
60
|
+
response_with 200 do
|
61
|
+
example do
|
64
62
|
set :body, {
|
65
63
|
name: "Unicorn",
|
66
64
|
is_pony: true,
|
@@ -92,7 +90,7 @@ Apipony::Documentation.define do
|
|
92
90
|
section "Ponies" do
|
93
91
|
endpoint "get", "/ponies/:id" do |e|
|
94
92
|
e.description = "Information about a pony"
|
95
|
-
example do
|
93
|
+
example do
|
96
94
|
set :body, {
|
97
95
|
name: "Applejack",
|
98
96
|
sex: "female",
|
@@ -115,14 +113,14 @@ end
|
|
115
113
|
|
116
114
|
### Example Generation
|
117
115
|
When describing attributes, you can provide an optional `example:` parameter.
|
118
|
-
If included, this will be used to generate the example response in the
|
119
|
-
documentation.
|
116
|
+
If included, this will be used to generate the example response in the
|
117
|
+
documentation.
|
120
118
|
|
121
119
|
```ruby
|
122
120
|
Apipony::Documentation.define do
|
123
121
|
section "Ponies" do
|
124
122
|
endpoint "get", "/ponies/:id" do |e|
|
125
|
-
|
123
|
+
response_with 200 do
|
126
124
|
attribute :name, type: :string, example: "Applejack"
|
127
125
|
# Enum members automatically select the first choice
|
128
126
|
attribute :kind, type: :enum do
|
@@ -136,7 +134,7 @@ Apipony::Documentation.define do
|
|
136
134
|
|
137
135
|
endpoint "get", "/ponies/" do |e|
|
138
136
|
# Automatic serialization of arrays is supported
|
139
|
-
|
137
|
+
response_with 200, array: true do
|
140
138
|
attribute :name, type: :string, example: "Applejack"
|
141
139
|
attribute :id, type: :integer, example: 10
|
142
140
|
end
|
@@ -171,7 +169,7 @@ format. Apipony lets you define this common format once, then use it multiple
|
|
171
169
|
times. Check it out:
|
172
170
|
|
173
171
|
```ruby
|
174
|
-
Apipony::Documentation.define do
|
172
|
+
Apipony::Documentation.define do
|
175
173
|
subtype :pony_stub do
|
176
174
|
attribute :name, type: :string
|
177
175
|
attribute :id, type: :integer
|
@@ -102,12 +102,19 @@ ul {
|
|
102
102
|
}
|
103
103
|
|
104
104
|
.sidebar {
|
105
|
-
flex: 1
|
105
|
+
flex: 1 80px;
|
106
|
+
margin-right: 40px;
|
106
107
|
|
107
108
|
@media all and (max-width: $mobile-width) {
|
108
109
|
flex: 1 100%;
|
109
110
|
margin-bottom: 30px;
|
110
111
|
}
|
112
|
+
|
113
|
+
h5 {
|
114
|
+
text-overflow: ellipsis;
|
115
|
+
white-space: nowrap;
|
116
|
+
overflow: auto;
|
117
|
+
}
|
111
118
|
}
|
112
119
|
|
113
120
|
.main-col {
|
@@ -233,7 +240,7 @@ footer {
|
|
233
240
|
&.put {
|
234
241
|
background-color: $put-color;
|
235
242
|
}
|
236
|
-
|
243
|
+
|
237
244
|
&.delete {
|
238
245
|
background-color: $delete-color;
|
239
246
|
}
|
@@ -254,7 +261,7 @@ footer {
|
|
254
261
|
|
255
262
|
.required {
|
256
263
|
text-align: center;
|
257
|
-
|
264
|
+
|
258
265
|
.fa {
|
259
266
|
color: $medium_color;
|
260
267
|
}
|
@@ -263,7 +270,7 @@ footer {
|
|
263
270
|
|
264
271
|
.table {
|
265
272
|
padding: 8px 0;
|
266
|
-
|
273
|
+
|
267
274
|
tr {
|
268
275
|
td {
|
269
276
|
padding: 4px 10px;
|
@@ -274,13 +281,13 @@ footer {
|
|
274
281
|
.attribute-container {
|
275
282
|
display: flex;
|
276
283
|
flex-flow: column nowrap;
|
277
|
-
|
284
|
+
|
278
285
|
.attribute {
|
279
286
|
display: flex;
|
280
287
|
flex-flow: row nowrap;
|
281
288
|
align-items: inherit;
|
282
289
|
justify-content: flex-start;
|
283
|
-
|
290
|
+
|
284
291
|
> div {
|
285
292
|
padding: 4px 10px;
|
286
293
|
}
|
data/lib/apipony/endpoint.rb
CHANGED
data/lib/apipony/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apipony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Novikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|