|
1 | 1 | require 'json'
|
2 | 2 |
|
3 | 3 |
|
4 |
| -MyApp.add_route('PUT', '/v2/pet', { |
| 4 | +MyApp.add_route('POST', '/v2/pets', { |
5 | 5 | "resourcePath" => "/Pet",
|
6 |
| - "summary" => "Update an existing pet", |
7 |
| - "nickname" => "update_pet", |
| 6 | + "summary" => "Add a new pet to the store", |
| 7 | + "nickname" => "add_pet", |
8 | 8 | "responseClass" => "void",
|
9 |
| - "endpoint" => "/pet", |
| 9 | + "endpoint" => "/pets", |
10 | 10 | "notes" => "",
|
11 | 11 | "parameters" => [
|
12 | 12 |
|
|
28 | 28 | end
|
29 | 29 |
|
30 | 30 |
|
31 |
| -MyApp.add_route('POST', '/v2/pet', { |
| 31 | +MyApp.add_route('DELETE', '/v2/pets/{petId}', { |
32 | 32 | "resourcePath" => "/Pet",
|
33 |
| - "summary" => "Add a new pet to the store", |
34 |
| - "nickname" => "add_pet", |
| 33 | + "summary" => "Deletes a pet", |
| 34 | + "nickname" => "delete_pet", |
35 | 35 | "responseClass" => "void",
|
36 |
| - "endpoint" => "/pet", |
| 36 | + "endpoint" => "/pets/{petId}", |
37 | 37 | "notes" => "",
|
38 | 38 | "parameters" => [
|
39 | 39 |
|
40 | 40 |
|
| 41 | + { |
| 42 | + "name" => "pet_id", |
| 43 | + "description" => "Pet id to delete", |
| 44 | + "dataType" => "int", |
| 45 | + "paramType" => "path", |
| 46 | + }, |
41 | 47 |
|
42 | 48 |
|
43 | 49 | {
|
44 |
| - "name" => "body", |
45 |
| - "description" => "Pet object that needs to be added to the store", |
46 |
| - "dataType" => "Pet", |
47 |
| - "paramType" => "body", |
48 |
| - } |
| 50 | + "name" => "api_key", |
| 51 | + "description" => "", |
| 52 | + "dataType" => "string", |
| 53 | + "paramType" => "header", |
| 54 | + }, |
| 55 | + |
49 | 56 |
|
50 | 57 | ]}) do
|
51 | 58 | cross_origin
|
|
55 | 62 | end
|
56 | 63 |
|
57 | 64 |
|
58 |
| -MyApp.add_route('GET', '/v2/pet/findByStatus', { |
| 65 | +MyApp.add_route('GET', '/v2/pets/findByStatus', { |
59 | 66 | "resourcePath" => "/Pet",
|
60 | 67 | "summary" => "Finds Pets by status",
|
61 | 68 | "nickname" => "find_pets_by_status",
|
62 | 69 | "responseClass" => "array[Pet]",
|
63 |
| - "endpoint" => "/pet/findByStatus", |
| 70 | + "endpoint" => "/pets/findByStatus", |
64 | 71 | "notes" => "Multiple status values can be provided with comma seperated strings",
|
65 | 72 | "parameters" => [
|
66 | 73 |
|
|
71 | 78 | "paramType" => "query",
|
72 | 79 | "collectionFormat" => "multi",
|
73 | 80 | "allowableValues" => "",
|
74 |
| - "defaultValue" => "available" |
| 81 | + |
75 | 82 | },
|
76 | 83 |
|
77 | 84 |
|
|
85 | 92 | end
|
86 | 93 |
|
87 | 94 |
|
88 |
| -MyApp.add_route('GET', '/v2/pet/findByTags', { |
| 95 | +MyApp.add_route('GET', '/v2/pets/findByTags', { |
89 | 96 | "resourcePath" => "/Pet",
|
90 | 97 | "summary" => "Finds Pets by tags",
|
91 | 98 | "nickname" => "find_pets_by_tags",
|
92 | 99 | "responseClass" => "array[Pet]",
|
93 |
| - "endpoint" => "/pet/findByTags", |
| 100 | + "endpoint" => "/pets/findByTags", |
94 | 101 | "notes" => "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.",
|
95 | 102 | "parameters" => [
|
96 | 103 |
|
|
115 | 122 | end
|
116 | 123 |
|
117 | 124 |
|
118 |
| -MyApp.add_route('GET', '/v2/pet/{petId}', { |
| 125 | +MyApp.add_route('GET', '/v2/pets/{petId}', { |
119 | 126 | "resourcePath" => "/Pet",
|
120 | 127 | "summary" => "Find pet by ID",
|
121 | 128 | "nickname" => "get_pet_by_id",
|
122 | 129 | "responseClass" => "Pet",
|
123 |
| - "endpoint" => "/pet/{petId}", |
| 130 | + "endpoint" => "/pets/{petId}", |
124 | 131 | "notes" => "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions",
|
125 | 132 | "parameters" => [
|
126 | 133 |
|
|
142 | 149 | end
|
143 | 150 |
|
144 | 151 |
|
145 |
| -MyApp.add_route('POST', '/v2/pet/{petId}', { |
| 152 | +MyApp.add_route('PUT', '/v2/pets', { |
146 | 153 | "resourcePath" => "/Pet",
|
147 |
| - "summary" => "Updates a pet in the store with form data", |
148 |
| - "nickname" => "update_pet_with_form", |
149 |
| - "responseClass" => "void", |
150 |
| - "endpoint" => "/pet/{petId}", |
151 |
| - "notes" => "", |
152 |
| - "parameters" => [ |
153 |
| - |
154 |
| - |
155 |
| - { |
156 |
| - "name" => "pet_id", |
157 |
| - "description" => "ID of pet that needs to be updated", |
158 |
| - "dataType" => "string", |
159 |
| - "paramType" => "path", |
160 |
| - }, |
161 |
| - |
162 |
| - |
163 |
| - |
164 |
| - ]}) do |
165 |
| - cross_origin |
166 |
| - # the guts live here |
167 |
| - |
168 |
| - {"message" => "yes, it worked"}.to_json |
169 |
| -end |
170 |
| - |
171 |
| - |
172 |
| -MyApp.add_route('DELETE', '/v2/pet/{petId}', { |
173 |
| - "resourcePath" => "/Pet", |
174 |
| - "summary" => "Deletes a pet", |
175 |
| - "nickname" => "delete_pet", |
| 154 | + "summary" => "Update an existing pet", |
| 155 | + "nickname" => "update_pet", |
176 | 156 | "responseClass" => "void",
|
177 |
| - "endpoint" => "/pet/{petId}", |
| 157 | + "endpoint" => "/pets", |
178 | 158 | "notes" => "",
|
179 | 159 | "parameters" => [
|
180 | 160 |
|
181 | 161 |
|
182 |
| - { |
183 |
| - "name" => "pet_id", |
184 |
| - "description" => "Pet id to delete", |
185 |
| - "dataType" => "int", |
186 |
| - "paramType" => "path", |
187 |
| - }, |
188 | 162 |
|
189 | 163 |
|
190 | 164 | {
|
191 |
| - "name" => "api_key", |
192 |
| - "description" => "", |
193 |
| - "dataType" => "string", |
194 |
| - "paramType" => "header", |
195 |
| - }, |
196 |
| - |
| 165 | + "name" => "body", |
| 166 | + "description" => "Pet object that needs to be added to the store", |
| 167 | + "dataType" => "Pet", |
| 168 | + "paramType" => "body", |
| 169 | + } |
197 | 170 |
|
198 | 171 | ]}) do
|
199 | 172 | cross_origin
|
|
203 | 176 | end
|
204 | 177 |
|
205 | 178 |
|
206 |
| -MyApp.add_route('POST', '/v2/pet/{petId}/uploadImage', { |
| 179 | +MyApp.add_route('POST', '/v2/pets/{petId}', { |
207 | 180 | "resourcePath" => "/Pet",
|
208 |
| - "summary" => "uploads an image", |
209 |
| - "nickname" => "upload_file", |
| 181 | + "summary" => "Updates a pet in the store with form data", |
| 182 | + "nickname" => "update_pet_with_form", |
210 | 183 | "responseClass" => "void",
|
211 |
| - "endpoint" => "/pet/{petId}/uploadImage", |
| 184 | + "endpoint" => "/pets/{petId}", |
212 | 185 | "notes" => "",
|
213 | 186 | "parameters" => [
|
214 | 187 |
|
215 | 188 |
|
216 | 189 | {
|
217 | 190 | "name" => "pet_id",
|
218 |
| - "description" => "ID of pet to update", |
219 |
| - "dataType" => "int", |
| 191 | + "description" => "ID of pet that needs to be updated", |
| 192 | + "dataType" => "string", |
220 | 193 | "paramType" => "path",
|
221 | 194 | },
|
222 | 195 |
|
|
0 commit comments