poptart 0.0.5 → 0.0.6
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/Gemfile.lock +4 -3
- data/lib/poptart/model.rb +49 -1
- data/lib/poptart/question.rb +1 -2
- data/lib/poptart/request.rb +1 -1
- data/lib/poptart/root.rb +0 -5
- data/lib/poptart/survey.rb +5 -6
- data/lib/poptart/survey_question.rb +2 -1
- data/lib/poptart/user.rb +16 -12
- data/lib/poptart.rb +2 -1
- data/lib/version.rb +1 -1
- data/poptart.gemspec +1 -0
- data/spec/requests/answering_survey_questions_spec.rb +32 -9
- data/spec/requests/root_spec.rb +6 -3
- data/spec/requests/user_management_spec.rb +8 -8
- data/spec/vcr/answering/survey_questions_answers_a_multiple_choice_question.yml +5444 -274
- data/spec/vcr/answering/survey_questions_answers_a_survey_question.yml +10066 -450
- data/spec/vcr/answering/survey_questions_creates_and_returns_a_random_question_survey.yml +883 -69
- data/spec/vcr/answering/survey_questions_creates_and_returns_an_empty_survey.yml +665 -56
- data/spec/vcr/answering/survey_questions_finds_survey_question_for_id.yml +1072 -74
- data/spec/vcr/answering/survey_questions_returns_all_answered_survey_questions_for_a_question.yml +5009 -0
- data/spec/vcr/poptart/root/builds_top_level_uri.yml +72 -0
- data/spec/vcr/poptart/root/builds_urls.yml +72 -0
- data/spec/vcr/user/management_creates_a_user.yml +63 -0
- data/spec/vcr/user/management_returns_a_user.yml +201 -14
- metadata +22 -2
@@ -1,74 +1,5 @@
|
|
1
1
|
---
|
2
2
|
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: http://localhost:3000/
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- Faraday v0.9.0
|
12
|
-
Content-Type:
|
13
|
-
- application/json
|
14
|
-
Api-Token:
|
15
|
-
- testing
|
16
|
-
Accept-Encoding:
|
17
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
-
Accept:
|
19
|
-
- "*/*"
|
20
|
-
response:
|
21
|
-
status:
|
22
|
-
code: 200
|
23
|
-
message: 'OK '
|
24
|
-
headers:
|
25
|
-
X-Frame-Options:
|
26
|
-
- SAMEORIGIN
|
27
|
-
X-Xss-Protection:
|
28
|
-
- 1; mode=block
|
29
|
-
X-Content-Type-Options:
|
30
|
-
- nosniff
|
31
|
-
X-Ua-Compatible:
|
32
|
-
- chrome=1
|
33
|
-
Content-Type:
|
34
|
-
- application/json; charset=utf-8
|
35
|
-
Etag:
|
36
|
-
- '"a723ac88b99a06c255a3384c2d01f4fb"'
|
37
|
-
Cache-Control:
|
38
|
-
- max-age=0, private, must-revalidate
|
39
|
-
X-Request-Id:
|
40
|
-
- 2a54c48c-4507-4fab-adaf-d4874860c46e
|
41
|
-
X-Runtime:
|
42
|
-
- '0.004414'
|
43
|
-
Server:
|
44
|
-
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
45
|
-
Date:
|
46
|
-
- Sat, 05 Jul 2014 21:24:17 GMT
|
47
|
-
Content-Length:
|
48
|
-
- '305'
|
49
|
-
Connection:
|
50
|
-
- Keep-Alive
|
51
|
-
body:
|
52
|
-
encoding: UTF-8
|
53
|
-
string: |-
|
54
|
-
{
|
55
|
-
"_links": {
|
56
|
-
"self": {
|
57
|
-
"href": "http://localhost:3000/api"
|
58
|
-
},
|
59
|
-
"surveys": {
|
60
|
-
"href": "http://localhost:3000/api/surveys"
|
61
|
-
},
|
62
|
-
"users": {
|
63
|
-
"href": "http://localhost:3000/api/users"
|
64
|
-
},
|
65
|
-
"questions": {
|
66
|
-
"href": "http://localhost:3000/api/questions"
|
67
|
-
}
|
68
|
-
}
|
69
|
-
}
|
70
|
-
http_version:
|
71
|
-
recorded_at: Sat, 05 Jul 2014 21:24:17 GMT
|
72
3
|
- request:
|
73
4
|
method: post
|
74
5
|
uri: http://localhost:3000/api/users
|
@@ -356,4 +287,887 @@ http_interactions:
|
|
356
287
|
}
|
357
288
|
http_version:
|
358
289
|
recorded_at: Sat, 05 Jul 2014 21:24:17 GMT
|
290
|
+
- request:
|
291
|
+
method: post
|
292
|
+
uri: http://localhost:3000/api/http:%2F%2Flocalhost:3000%2Fapi%2F%252Fusers%2F/
|
293
|
+
body:
|
294
|
+
encoding: UTF-8
|
295
|
+
string: '{"user":{"external_user_id":42}}'
|
296
|
+
headers:
|
297
|
+
User-Agent:
|
298
|
+
- Faraday v0.9.0
|
299
|
+
Content-Type:
|
300
|
+
- application/json
|
301
|
+
Api-Token:
|
302
|
+
- testing
|
303
|
+
Accept-Encoding:
|
304
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
305
|
+
Accept:
|
306
|
+
- "*/*"
|
307
|
+
response:
|
308
|
+
status:
|
309
|
+
code: 404
|
310
|
+
message: 'Not Found '
|
311
|
+
headers:
|
312
|
+
Content-Type:
|
313
|
+
- text/html; charset=utf-8
|
314
|
+
Content-Length:
|
315
|
+
- '16625'
|
316
|
+
X-Request-Id:
|
317
|
+
- d1a7f26d-2be7-4a86-b636-7f1367e42d91
|
318
|
+
X-Runtime:
|
319
|
+
- '0.021520'
|
320
|
+
Server:
|
321
|
+
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
322
|
+
Date:
|
323
|
+
- Sat, 13 Sep 2014 15:26:48 GMT
|
324
|
+
Connection:
|
325
|
+
- Keep-Alive
|
326
|
+
body:
|
327
|
+
encoding: UTF-8
|
328
|
+
string: "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\"
|
329
|
+
/>\n <title>Action Controller: Exception caught</title>\n <style>\n body
|
330
|
+
{\n background-color: #FAFAFA;\n color: #333;\n margin: 0px;\n
|
331
|
+
\ }\n\n body, p, ol, ul, td {\n font-family: helvetica, verdana,
|
332
|
+
arial, sans-serif;\n font-size: 13px;\n line-height: 18px;\n }\n\n
|
333
|
+
\ pre {\n font-size: 11px;\n white-space: pre-wrap;\n }\n\n
|
334
|
+
\ pre.box {\n border: 1px solid #EEE;\n padding: 10px;\n margin:
|
335
|
+
0px;\n width: 958px;\n }\n\n header {\n color: #F0F0F0;\n
|
336
|
+
\ background: #C52F24;\n padding: 0.5em 1.5em;\n }\n\n h1 {\n
|
337
|
+
\ margin: 0.2em 0;\n line-height: 1.1em;\n font-size: 2em;\n
|
338
|
+
\ }\n\n h2 {\n color: #C52F24;\n line-height: 25px;\n }\n\n
|
339
|
+
\ .details {\n border: 1px solid #D0D0D0;\n border-radius: 4px;\n
|
340
|
+
\ margin: 1em 0px;\n display: block;\n width: 978px;\n }\n\n
|
341
|
+
\ .summary {\n padding: 8px 15px;\n border-bottom: 1px solid #D0D0D0;\n
|
342
|
+
\ display: block;\n }\n\n .details pre {\n margin: 5px;\n border:
|
343
|
+
none;\n }\n\n #container {\n box-sizing: border-box;\n width:
|
344
|
+
100%;\n padding: 0 1.5em;\n }\n\n .source * {\n margin: 0px;\n
|
345
|
+
\ padding: 0px;\n }\n\n .source {\n border: 1px solid #D9D9D9;\n
|
346
|
+
\ background: #ECECEC;\n width: 978px;\n }\n\n .source pre
|
347
|
+
{\n padding: 10px 0px;\n border: none;\n }\n\n .source .data
|
348
|
+
{\n font-size: 80%;\n overflow: auto;\n background-color: #FFF;\n
|
349
|
+
\ }\n\n .info {\n padding: 0.5em;\n }\n\n .source .data .line_numbers
|
350
|
+
{\n background-color: #ECECEC;\n color: #AAA;\n padding: 1em
|
351
|
+
.5em;\n border-right: 1px solid #DDD;\n text-align: right;\n }\n\n
|
352
|
+
\ .line {\n padding-left: 10px;\n }\n\n .line:hover {\n background-color:
|
353
|
+
#F6F6F6;\n }\n\n .line.active {\n background-color: #FFCCCC;\n
|
354
|
+
\ }\n\n a { color: #980905; }\n a:visited { color: #666; }\n a:hover
|
355
|
+
{ color: #C52F24; }\n\n #route_table {\n margin: 0 auto 0;\n border-collapse:
|
356
|
+
collapse;\n }\n\n #route_table td {\n padding: 0 30px;\n }\n\n #route_table
|
357
|
+
tr.bottom th {\n padding-bottom: 10px;\n line-height: 15px;\n }\n\n
|
358
|
+
\ #route_table .matched_paths {\n background-color: LightGoldenRodYellow;\n
|
359
|
+
\ }\n\n #route_table .matched_paths {\n border-bottom: solid 3px SlateGrey;\n
|
360
|
+
\ }\n\n #path_search {\n width: 80%;\n font-size: inherit;\n }\n\n
|
361
|
+
\ </style>\n\n <script>\n var toggle = function(id) {\n var s = document.getElementById(id).style;\n
|
362
|
+
\ s.display = s.display == 'none' ? 'block' : 'none';\n return false;\n
|
363
|
+
\ }\n var show = function(id) {\n document.getElementById(id).style.display
|
364
|
+
= 'block';\n }\n var hide = function(id) {\n document.getElementById(id).style.display
|
365
|
+
= 'none';\n }\n var toggleTrace = function() {\n return toggle('blame_trace');\n
|
366
|
+
\ }\n var toggleSessionDump = function() {\n return toggle('session_dump');\n
|
367
|
+
\ }\n var toggleEnvDump = function() {\n return toggle('env_dump');\n
|
368
|
+
\ }\n </script>\n</head>\n<body>\n\n<header>\n <h1>Routing Error</h1>\n</header>\n<div
|
369
|
+
id=\"container\">\n <h2>No route matches [POST] "/api/http%3A%2F%2Flocalhost%3A3000%2Fapi%2F%252Fusers%2F"</h2>\n\n
|
370
|
+
\ \n<p><code>Rails.root: /Users/austenito/repos/happiness/happiness_service</code></p>\n\n<div
|
371
|
+
id=\"traces\">\n <a href=\"#\" onclick=\"hide('Framework-Trace');hide('Full-Trace');show('Application-Trace');;
|
372
|
+
return false;\">Application Trace</a> |\n <a href=\"#\" onclick=\"hide('Application-Trace');hide('Full-Trace');show('Framework-Trace');;
|
373
|
+
return false;\">Framework Trace</a> |\n <a href=\"#\" onclick=\"hide('Application-Trace');hide('Framework-Trace');show('Full-Trace');;
|
374
|
+
return false;\">Full Trace</a> \n\n <div id=\"Application-Trace\" style=\"display:
|
375
|
+
block;\">\n <pre><code></code></pre>\n </div>\n <div id=\"Framework-Trace\"
|
376
|
+
style=\"display: none;\">\n <pre><code>actionpack (4.0.4) lib/action_dispatch/middleware/debug_exceptions.rb:21:in
|
377
|
+
`call'\nactionpack (4.0.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in
|
378
|
+
`call'\nrailties (4.0.4) lib/rails/rack/logger.rb:38:in `call_app'\nrailties
|
379
|
+
(4.0.4) lib/rails/rack/logger.rb:20:in `block in call'\nactivesupport
|
380
|
+
(4.0.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'\nactivesupport
|
381
|
+
(4.0.4) lib/active_support/tagged_logging.rb:26:in `tagged'\nactivesupport
|
382
|
+
(4.0.4) lib/active_support/tagged_logging.rb:68:in `tagged'\nrailties
|
383
|
+
(4.0.4) lib/rails/rack/logger.rb:20:in `call'\nactionpack (4.0.4) lib/action_dispatch/middleware/request_id.rb:21:in
|
384
|
+
`call'\nrack (1.5.2) lib/rack/runtime.rb:17:in `call'\nactivesupport
|
385
|
+
(4.0.4) lib/active_support/cache/strategy/local_cache.rb:83:in `call'\nrack
|
386
|
+
(1.5.2) lib/rack/lock.rb:17:in `call'\nactionpack (4.0.4) lib/action_dispatch/middleware/static.rb:64:in
|
387
|
+
`call'\nrailties (4.0.4) lib/rails/engine.rb:511:in `call'\nrailties
|
388
|
+
(4.0.4) lib/rails/application.rb:97:in `call'\nrack (1.5.2) lib/rack/lock.rb:17:in
|
389
|
+
`call'\nrack (1.5.2) lib/rack/content_length.rb:14:in `call'\nrack
|
390
|
+
(1.5.2) lib/rack/handler/webrick.rb:60:in `service'\n/Users/austenito/.rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in
|
391
|
+
`service'\n/Users/austenito/.rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in
|
392
|
+
`run'\n/Users/austenito/.rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in
|
393
|
+
`block in start_thread'</code></pre>\n </div>\n <div id=\"Full-Trace\"
|
394
|
+
style=\"display: none;\">\n <pre><code>actionpack (4.0.4) lib/action_dispatch/middleware/debug_exceptions.rb:21:in
|
395
|
+
`call'\nactionpack (4.0.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in
|
396
|
+
`call'\nrailties (4.0.4) lib/rails/rack/logger.rb:38:in `call_app'\nrailties
|
397
|
+
(4.0.4) lib/rails/rack/logger.rb:20:in `block in call'\nactivesupport
|
398
|
+
(4.0.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'\nactivesupport
|
399
|
+
(4.0.4) lib/active_support/tagged_logging.rb:26:in `tagged'\nactivesupport
|
400
|
+
(4.0.4) lib/active_support/tagged_logging.rb:68:in `tagged'\nrailties
|
401
|
+
(4.0.4) lib/rails/rack/logger.rb:20:in `call'\nactionpack (4.0.4) lib/action_dispatch/middleware/request_id.rb:21:in
|
402
|
+
`call'\nrack (1.5.2) lib/rack/runtime.rb:17:in `call'\nactivesupport
|
403
|
+
(4.0.4) lib/active_support/cache/strategy/local_cache.rb:83:in `call'\nrack
|
404
|
+
(1.5.2) lib/rack/lock.rb:17:in `call'\nactionpack (4.0.4) lib/action_dispatch/middleware/static.rb:64:in
|
405
|
+
`call'\nrailties (4.0.4) lib/rails/engine.rb:511:in `call'\nrailties
|
406
|
+
(4.0.4) lib/rails/application.rb:97:in `call'\nrack (1.5.2) lib/rack/lock.rb:17:in
|
407
|
+
`call'\nrack (1.5.2) lib/rack/content_length.rb:14:in `call'\nrack
|
408
|
+
(1.5.2) lib/rack/handler/webrick.rb:60:in `service'\n/Users/austenito/.rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in
|
409
|
+
`service'\n/Users/austenito/.rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in
|
410
|
+
`run'\n/Users/austenito/.rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in
|
411
|
+
`block in start_thread'</code></pre>\n </div>\n</div>\n\n\n <h2>\n
|
412
|
+
\ Routes\n </h2>\n\n <p>\n Routes match in priority from top
|
413
|
+
to bottom\n </p>\n\n \n<table id='route_table' class='route_table'>\n
|
414
|
+
\ <thead>\n <tr>\n <th>Helper</th>\n <th>HTTP Verb</th>\n <th>Path</th>\n
|
415
|
+
\ <th>Controller#Action</th>\n </tr>\n <tr class='bottom'>\n <th>\n
|
416
|
+
\ <a data-route-helper=\"_path\" href=\"#\" title=\"Returns a relative
|
417
|
+
path (without the http or domain)\">Path</a> /\n <a data-route-helper=\"_url\"
|
418
|
+
href=\"#\" title=\"Returns an absolute url (with the http and domain)\">Url</a>\n
|
419
|
+
\ </th>\n <th>\n </th>\n <th>\n <input id=\"path_search\"
|
420
|
+
name=\"path[]\" placeholder=\"Path Match\" type=\"search\" />\n </th>\n
|
421
|
+
\ <th>\n </th>\n </tr>\n </thead>\n <tbody class='matched_paths'
|
422
|
+
id='matched_paths'>\n </tbody>\n <tbody>\n <tr class='route_row' data-helper='path'>\n
|
423
|
+
\ <td data-route-name='api_question_survey_questions'>\n api_question_survey_questions<span
|
424
|
+
class='helper'>_path</span>\n </td>\n <td data-route-verb='GET'>\n GET\n
|
425
|
+
\ </td>\n <td data-route-path='/api/questions/:question_id/survey_questions(.:format)'
|
426
|
+
data-regexp='^\\/api\\/questions\\/([^\\/.?]+)\\/survey_questions(?:\\.([^\\/.?]+))?$'>\n
|
427
|
+
\ /api/questions/:question_id/survey_questions(.:format)\n </td>\n <td
|
428
|
+
data-route-reqs='api/v1/survey_questions#index {:format=>"json"}'>\n
|
429
|
+
\ api/v1/survey_questions#index {:format=>"json"}\n </td>\n</tr>\n<tr
|
430
|
+
class='route_row' data-helper='path'>\n <td data-route-name='api_questions'>\n
|
431
|
+
\ api_questions<span class='helper'>_path</span>\n </td>\n <td data-route-verb='GET'>\n
|
432
|
+
\ GET\n </td>\n <td data-route-path='/api/questions(.:format)' data-regexp='^\\/api\\/questions(?:\\.([^\\/.?]+))?$'>\n
|
433
|
+
\ /api/questions(.:format)\n </td>\n <td data-route-reqs='api/v1/questions#index
|
434
|
+
{:format=>"json"}'>\n api/v1/questions#index {:format=>"json"}\n
|
435
|
+
\ </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n <td data-route-name='api_survey_survey_questions'>\n
|
436
|
+
\ api_survey_survey_questions<span class='helper'>_path</span>\n </td>\n
|
437
|
+
\ <td data-route-verb='POST'>\n POST\n </td>\n <td data-route-path='/api/surveys/:survey_id/survey_questions(.:format)'
|
438
|
+
data-regexp='^\\/api\\/surveys\\/([^\\/.?]+)\\/survey_questions(?:\\.([^\\/.?]+))?$'>\n
|
439
|
+
\ /api/surveys/:survey_id/survey_questions(.:format)\n </td>\n <td data-route-reqs='api/v1/survey_questions#create
|
440
|
+
{:format=>"json"}'>\n api/v1/survey_questions#create {:format=>"json"}\n
|
441
|
+
\ </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n <td data-route-name='api_survey_survey_question'>\n
|
442
|
+
\ api_survey_survey_question<span class='helper'>_path</span>\n </td>\n
|
443
|
+
\ <td data-route-verb='GET'>\n GET\n </td>\n <td data-route-path='/api/surveys/:survey_id/survey_questions/:id(.:format)'
|
444
|
+
data-regexp='^\\/api\\/surveys\\/([^\\/.?]+)\\/survey_questions\\/([^\\/.?]+)(?:\\.([^\\/.?]+))?$'>\n
|
445
|
+
\ /api/surveys/:survey_id/survey_questions/:id(.:format)\n </td>\n <td
|
446
|
+
data-route-reqs='api/v1/survey_questions#show {:format=>"json"}'>\n
|
447
|
+
\ api/v1/survey_questions#show {:format=>"json"}\n </td>\n</tr>\n<tr
|
448
|
+
class='route_row' data-helper='path'>\n <td data-route-name=''>\n </td>\n
|
449
|
+
\ <td data-route-verb='PATCH'>\n PATCH\n </td>\n <td data-route-path='/api/surveys/:survey_id/survey_questions/:id(.:format)'
|
450
|
+
data-regexp='^\\/api\\/surveys\\/([^\\/.?]+)\\/survey_questions\\/([^\\/.?]+)(?:\\.([^\\/.?]+))?$'>\n
|
451
|
+
\ /api/surveys/:survey_id/survey_questions/:id(.:format)\n </td>\n <td
|
452
|
+
data-route-reqs='api/v1/survey_questions#update {:format=>"json"}'>\n
|
453
|
+
\ api/v1/survey_questions#update {:format=>"json"}\n </td>\n</tr>\n<tr
|
454
|
+
class='route_row' data-helper='path'>\n <td data-route-name=''>\n </td>\n
|
455
|
+
\ <td data-route-verb='PUT'>\n PUT\n </td>\n <td data-route-path='/api/surveys/:survey_id/survey_questions/:id(.:format)'
|
456
|
+
data-regexp='^\\/api\\/surveys\\/([^\\/.?]+)\\/survey_questions\\/([^\\/.?]+)(?:\\.([^\\/.?]+))?$'>\n
|
457
|
+
\ /api/surveys/:survey_id/survey_questions/:id(.:format)\n </td>\n <td
|
458
|
+
data-route-reqs='api/v1/survey_questions#update {:format=>"json"}'>\n
|
459
|
+
\ api/v1/survey_questions#update {:format=>"json"}\n </td>\n</tr>\n<tr
|
460
|
+
class='route_row' data-helper='path'>\n <td data-route-name='api_surveys'>\n
|
461
|
+
\ api_surveys<span class='helper'>_path</span>\n </td>\n <td data-route-verb='GET'>\n
|
462
|
+
\ GET\n </td>\n <td data-route-path='/api/surveys(.:format)' data-regexp='^\\/api\\/surveys(?:\\.([^\\/.?]+))?$'>\n
|
463
|
+
\ /api/surveys(.:format)\n </td>\n <td data-route-reqs='api/v1/surveys#index
|
464
|
+
{:format=>"json"}'>\n api/v1/surveys#index {:format=>"json"}\n
|
465
|
+
\ </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n <td data-route-name=''>\n
|
466
|
+
\ </td>\n <td data-route-verb='POST'>\n POST\n </td>\n <td data-route-path='/api/surveys(.:format)'
|
467
|
+
data-regexp='^\\/api\\/surveys(?:\\.([^\\/.?]+))?$'>\n /api/surveys(.:format)\n
|
468
|
+
\ </td>\n <td data-route-reqs='api/v1/surveys#create {:format=>"json"}'>\n
|
469
|
+
\ api/v1/surveys#create {:format=>"json"}\n </td>\n</tr>\n<tr
|
470
|
+
class='route_row' data-helper='path'>\n <td data-route-name='api_survey'>\n
|
471
|
+
\ api_survey<span class='helper'>_path</span>\n </td>\n <td data-route-verb='GET'>\n
|
472
|
+
\ GET\n </td>\n <td data-route-path='/api/surveys/:id(.:format)' data-regexp='^\\/api\\/surveys\\/([^\\/.?]+)(?:\\.([^\\/.?]+))?$'>\n
|
473
|
+
\ /api/surveys/:id(.:format)\n </td>\n <td data-route-reqs='api/v1/surveys#show
|
474
|
+
{:format=>"json"}'>\n api/v1/surveys#show {:format=>"json"}\n
|
475
|
+
\ </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n <td data-route-name='api_users'>\n
|
476
|
+
\ api_users<span class='helper'>_path</span>\n </td>\n <td data-route-verb='POST'>\n
|
477
|
+
\ POST\n </td>\n <td data-route-path='/api/users(.:format)' data-regexp='^\\/api\\/users(?:\\.([^\\/.?]+))?$'>\n
|
478
|
+
\ /api/users(.:format)\n </td>\n <td data-route-reqs='api/v1/users#create
|
479
|
+
{:format=>"json"}'>\n api/v1/users#create {:format=>"json"}\n
|
480
|
+
\ </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n <td data-route-name='api_user'>\n
|
481
|
+
\ api_user<span class='helper'>_path</span>\n </td>\n <td data-route-verb='GET'>\n
|
482
|
+
\ GET\n </td>\n <td data-route-path='/api/users/:id(.:format)' data-regexp='^\\/api\\/users\\/([^\\/.?]+)(?:\\.([^\\/.?]+))?$'>\n
|
483
|
+
\ /api/users/:id(.:format)\n </td>\n <td data-route-reqs='api/v1/users#show
|
484
|
+
{:format=>"json"}'>\n api/v1/users#show {:format=>"json"}\n
|
485
|
+
\ </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n <td data-route-name='root'>\n
|
486
|
+
\ root<span class='helper'>_path</span>\n </td>\n <td data-route-verb='GET'>\n
|
487
|
+
\ GET\n </td>\n <td data-route-path='/' data-regexp='^\\/$'>\n /\n
|
488
|
+
\ </td>\n <td data-route-reqs='api/v1/root#index'>\n api/v1/root#index\n
|
489
|
+
\ </td>\n</tr>\n\n </tbody>\n</table>\n\n<script type='text/javascript'>\n
|
490
|
+
\ function each(elems, func) {\n if (!elems instanceof Array) { elems =
|
491
|
+
[elems]; }\n for (var i = 0, len = elems.length; i < len; i++) {\n func(elems[i]);\n
|
492
|
+
\ }\n }\n\n function setValOn(elems, val) {\n each(elems, function(elem)
|
493
|
+
{\n elem.innerHTML = val;\n });\n }\n\n function onClick(elems,
|
494
|
+
func) {\n each(elems, function(elem) {\n elem.onclick = func;\n });\n
|
495
|
+
\ }\n\n // Enables functionality to toggle between `_path` and `_url` helper
|
496
|
+
suffixes\n function setupRouteToggleHelperLinks() {\n var toggleLinks
|
497
|
+
= document.querySelectorAll('#route_table [data-route-helper]');\n onClick(toggleLinks,
|
498
|
+
function(){\n var helperTxt = this.getAttribute(\"data-route-helper\"),\n
|
499
|
+
\ helperElems = document.querySelectorAll('[data-route-name] span.helper');\n
|
500
|
+
\ setValOn(helperElems, helperTxt);\n });\n }\n\n // takes an array
|
501
|
+
of elements with a data-regexp attribute and\n // passes their their parent
|
502
|
+
<tr> into the callback function\n // if the regexp matchs a given path\n
|
503
|
+
\ function eachElemsForPath(elems, path, func) {\n each(elems, function(e){\n
|
504
|
+
\ var reg = e.getAttribute(\"data-regexp\");\n if (path.match(RegExp(reg)))
|
505
|
+
{\n func(e.parentNode.cloneNode(true));\n }\n })\n }\n\n //
|
506
|
+
Ensure path always starts with a slash \"/\" and remove params or fragments\n
|
507
|
+
\ function sanitizePath(path) {\n var path = path.charAt(0) == '/' ? path
|
508
|
+
: \"/\" + path;\n return path.replace(/\\#.*|\\?.*/, '');\n }\n\n //
|
509
|
+
Enables path search functionality\n function setupMatchPaths() {\n var
|
510
|
+
regexpElems = document.querySelectorAll('#route_table [data-regexp]'),\n
|
511
|
+
\ pathElem = document.querySelector('#path_search'),\n selectedSection
|
512
|
+
= document.querySelector('#matched_paths'),\n noMatchText = '<tr><th
|
513
|
+
colspan=\"4\">None</th></tr>';\n\n\n // Remove matches if no path is present\n
|
514
|
+
\ pathElem.onblur = function(e) {\n if (pathElem.value === \"\") selectedSection.innerHTML
|
515
|
+
= \"\";\n }\n\n // On key press perform a search for matching paths\n
|
516
|
+
\ pathElem.onkeyup = function(e){\n var path = sanitizePath(pathElem.value),\n
|
517
|
+
\ defaultText = '<tr><th colspan=\"4\">Paths Matching (' + path +
|
518
|
+
'):</th></tr>';\n\n // Clear out results section\n selectedSection.innerHTML=
|
519
|
+
defaultText;\n\n // Display matches if they exist\n eachElemsForPath(regexpElems,
|
520
|
+
path, function(e){\n selectedSection.appendChild(e);\n });\n\n
|
521
|
+
\ // If no match present, tell the user\n if (selectedSection.innerHTML
|
522
|
+
=== defaultText) {\n selectedSection.innerHTML = selectedSection.innerHTML
|
523
|
+
+ noMatchText;\n }\n }\n }\n\n setupMatchPaths();\n setupRouteToggleHelperLinks();\n</script>\n\n</div>\n\n\n</body>\n</html>\n"
|
524
|
+
http_version:
|
525
|
+
recorded_at: Sat, 13 Sep 2014 15:26:48 GMT
|
526
|
+
- request:
|
527
|
+
method: post
|
528
|
+
uri: http://localhost:3000/api/%2Fusers/
|
529
|
+
body:
|
530
|
+
encoding: UTF-8
|
531
|
+
string: '{"user":{"external_user_id":42}}'
|
532
|
+
headers:
|
533
|
+
User-Agent:
|
534
|
+
- Faraday v0.9.0
|
535
|
+
Content-Type:
|
536
|
+
- application/json
|
537
|
+
Api-Token:
|
538
|
+
- testing
|
539
|
+
Accept-Encoding:
|
540
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
541
|
+
Accept:
|
542
|
+
- "*/*"
|
543
|
+
response:
|
544
|
+
status:
|
545
|
+
code: 404
|
546
|
+
message: 'Not Found '
|
547
|
+
headers:
|
548
|
+
Content-Type:
|
549
|
+
- text/html; charset=utf-8
|
550
|
+
Content-Length:
|
551
|
+
- '16582'
|
552
|
+
X-Request-Id:
|
553
|
+
- ab1e6e30-533d-4c00-9eff-8aec5ab28b9f
|
554
|
+
X-Runtime:
|
555
|
+
- '0.023244'
|
556
|
+
Server:
|
557
|
+
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
558
|
+
Date:
|
559
|
+
- Sat, 13 Sep 2014 15:30:49 GMT
|
560
|
+
Connection:
|
561
|
+
- Keep-Alive
|
562
|
+
body:
|
563
|
+
encoding: UTF-8
|
564
|
+
string: "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\"
|
565
|
+
/>\n <title>Action Controller: Exception caught</title>\n <style>\n body
|
566
|
+
{\n background-color: #FAFAFA;\n color: #333;\n margin: 0px;\n
|
567
|
+
\ }\n\n body, p, ol, ul, td {\n font-family: helvetica, verdana,
|
568
|
+
arial, sans-serif;\n font-size: 13px;\n line-height: 18px;\n }\n\n
|
569
|
+
\ pre {\n font-size: 11px;\n white-space: pre-wrap;\n }\n\n
|
570
|
+
\ pre.box {\n border: 1px solid #EEE;\n padding: 10px;\n margin:
|
571
|
+
0px;\n width: 958px;\n }\n\n header {\n color: #F0F0F0;\n
|
572
|
+
\ background: #C52F24;\n padding: 0.5em 1.5em;\n }\n\n h1 {\n
|
573
|
+
\ margin: 0.2em 0;\n line-height: 1.1em;\n font-size: 2em;\n
|
574
|
+
\ }\n\n h2 {\n color: #C52F24;\n line-height: 25px;\n }\n\n
|
575
|
+
\ .details {\n border: 1px solid #D0D0D0;\n border-radius: 4px;\n
|
576
|
+
\ margin: 1em 0px;\n display: block;\n width: 978px;\n }\n\n
|
577
|
+
\ .summary {\n padding: 8px 15px;\n border-bottom: 1px solid #D0D0D0;\n
|
578
|
+
\ display: block;\n }\n\n .details pre {\n margin: 5px;\n border:
|
579
|
+
none;\n }\n\n #container {\n box-sizing: border-box;\n width:
|
580
|
+
100%;\n padding: 0 1.5em;\n }\n\n .source * {\n margin: 0px;\n
|
581
|
+
\ padding: 0px;\n }\n\n .source {\n border: 1px solid #D9D9D9;\n
|
582
|
+
\ background: #ECECEC;\n width: 978px;\n }\n\n .source pre
|
583
|
+
{\n padding: 10px 0px;\n border: none;\n }\n\n .source .data
|
584
|
+
{\n font-size: 80%;\n overflow: auto;\n background-color: #FFF;\n
|
585
|
+
\ }\n\n .info {\n padding: 0.5em;\n }\n\n .source .data .line_numbers
|
586
|
+
{\n background-color: #ECECEC;\n color: #AAA;\n padding: 1em
|
587
|
+
.5em;\n border-right: 1px solid #DDD;\n text-align: right;\n }\n\n
|
588
|
+
\ .line {\n padding-left: 10px;\n }\n\n .line:hover {\n background-color:
|
589
|
+
#F6F6F6;\n }\n\n .line.active {\n background-color: #FFCCCC;\n
|
590
|
+
\ }\n\n a { color: #980905; }\n a:visited { color: #666; }\n a:hover
|
591
|
+
{ color: #C52F24; }\n\n #route_table {\n margin: 0 auto 0;\n border-collapse:
|
592
|
+
collapse;\n }\n\n #route_table td {\n padding: 0 30px;\n }\n\n #route_table
|
593
|
+
tr.bottom th {\n padding-bottom: 10px;\n line-height: 15px;\n }\n\n
|
594
|
+
\ #route_table .matched_paths {\n background-color: LightGoldenRodYellow;\n
|
595
|
+
\ }\n\n #route_table .matched_paths {\n border-bottom: solid 3px SlateGrey;\n
|
596
|
+
\ }\n\n #path_search {\n width: 80%;\n font-size: inherit;\n }\n\n
|
597
|
+
\ </style>\n\n <script>\n var toggle = function(id) {\n var s = document.getElementById(id).style;\n
|
598
|
+
\ s.display = s.display == 'none' ? 'block' : 'none';\n return false;\n
|
599
|
+
\ }\n var show = function(id) {\n document.getElementById(id).style.display
|
600
|
+
= 'block';\n }\n var hide = function(id) {\n document.getElementById(id).style.display
|
601
|
+
= 'none';\n }\n var toggleTrace = function() {\n return toggle('blame_trace');\n
|
602
|
+
\ }\n var toggleSessionDump = function() {\n return toggle('session_dump');\n
|
603
|
+
\ }\n var toggleEnvDump = function() {\n return toggle('env_dump');\n
|
604
|
+
\ }\n </script>\n</head>\n<body>\n\n<header>\n <h1>Routing Error</h1>\n</header>\n<div
|
605
|
+
id=\"container\">\n <h2>No route matches [POST] "/api/%2Fusers"</h2>\n\n
|
606
|
+
\ \n<p><code>Rails.root: /Users/austenito/repos/happiness/happiness_service</code></p>\n\n<div
|
607
|
+
id=\"traces\">\n <a href=\"#\" onclick=\"hide('Framework-Trace');hide('Full-Trace');show('Application-Trace');;
|
608
|
+
return false;\">Application Trace</a> |\n <a href=\"#\" onclick=\"hide('Application-Trace');hide('Full-Trace');show('Framework-Trace');;
|
609
|
+
return false;\">Framework Trace</a> |\n <a href=\"#\" onclick=\"hide('Application-Trace');hide('Framework-Trace');show('Full-Trace');;
|
610
|
+
return false;\">Full Trace</a> \n\n <div id=\"Application-Trace\" style=\"display:
|
611
|
+
block;\">\n <pre><code></code></pre>\n </div>\n <div id=\"Framework-Trace\"
|
612
|
+
style=\"display: none;\">\n <pre><code>actionpack (4.0.4) lib/action_dispatch/middleware/debug_exceptions.rb:21:in
|
613
|
+
`call'\nactionpack (4.0.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in
|
614
|
+
`call'\nrailties (4.0.4) lib/rails/rack/logger.rb:38:in `call_app'\nrailties
|
615
|
+
(4.0.4) lib/rails/rack/logger.rb:20:in `block in call'\nactivesupport
|
616
|
+
(4.0.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'\nactivesupport
|
617
|
+
(4.0.4) lib/active_support/tagged_logging.rb:26:in `tagged'\nactivesupport
|
618
|
+
(4.0.4) lib/active_support/tagged_logging.rb:68:in `tagged'\nrailties
|
619
|
+
(4.0.4) lib/rails/rack/logger.rb:20:in `call'\nactionpack (4.0.4) lib/action_dispatch/middleware/request_id.rb:21:in
|
620
|
+
`call'\nrack (1.5.2) lib/rack/runtime.rb:17:in `call'\nactivesupport
|
621
|
+
(4.0.4) lib/active_support/cache/strategy/local_cache.rb:83:in `call'\nrack
|
622
|
+
(1.5.2) lib/rack/lock.rb:17:in `call'\nactionpack (4.0.4) lib/action_dispatch/middleware/static.rb:64:in
|
623
|
+
`call'\nrailties (4.0.4) lib/rails/engine.rb:511:in `call'\nrailties
|
624
|
+
(4.0.4) lib/rails/application.rb:97:in `call'\nrack (1.5.2) lib/rack/lock.rb:17:in
|
625
|
+
`call'\nrack (1.5.2) lib/rack/content_length.rb:14:in `call'\nrack
|
626
|
+
(1.5.2) lib/rack/handler/webrick.rb:60:in `service'\n/Users/austenito/.rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in
|
627
|
+
`service'\n/Users/austenito/.rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in
|
628
|
+
`run'\n/Users/austenito/.rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in
|
629
|
+
`block in start_thread'</code></pre>\n </div>\n <div id=\"Full-Trace\"
|
630
|
+
style=\"display: none;\">\n <pre><code>actionpack (4.0.4) lib/action_dispatch/middleware/debug_exceptions.rb:21:in
|
631
|
+
`call'\nactionpack (4.0.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in
|
632
|
+
`call'\nrailties (4.0.4) lib/rails/rack/logger.rb:38:in `call_app'\nrailties
|
633
|
+
(4.0.4) lib/rails/rack/logger.rb:20:in `block in call'\nactivesupport
|
634
|
+
(4.0.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'\nactivesupport
|
635
|
+
(4.0.4) lib/active_support/tagged_logging.rb:26:in `tagged'\nactivesupport
|
636
|
+
(4.0.4) lib/active_support/tagged_logging.rb:68:in `tagged'\nrailties
|
637
|
+
(4.0.4) lib/rails/rack/logger.rb:20:in `call'\nactionpack (4.0.4) lib/action_dispatch/middleware/request_id.rb:21:in
|
638
|
+
`call'\nrack (1.5.2) lib/rack/runtime.rb:17:in `call'\nactivesupport
|
639
|
+
(4.0.4) lib/active_support/cache/strategy/local_cache.rb:83:in `call'\nrack
|
640
|
+
(1.5.2) lib/rack/lock.rb:17:in `call'\nactionpack (4.0.4) lib/action_dispatch/middleware/static.rb:64:in
|
641
|
+
`call'\nrailties (4.0.4) lib/rails/engine.rb:511:in `call'\nrailties
|
642
|
+
(4.0.4) lib/rails/application.rb:97:in `call'\nrack (1.5.2) lib/rack/lock.rb:17:in
|
643
|
+
`call'\nrack (1.5.2) lib/rack/content_length.rb:14:in `call'\nrack
|
644
|
+
(1.5.2) lib/rack/handler/webrick.rb:60:in `service'\n/Users/austenito/.rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:138:in
|
645
|
+
`service'\n/Users/austenito/.rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/httpserver.rb:94:in
|
646
|
+
`run'\n/Users/austenito/.rubies/ruby-2.1.2/lib/ruby/2.1.0/webrick/server.rb:295:in
|
647
|
+
`block in start_thread'</code></pre>\n </div>\n</div>\n\n\n <h2>\n
|
648
|
+
\ Routes\n </h2>\n\n <p>\n Routes match in priority from top
|
649
|
+
to bottom\n </p>\n\n \n<table id='route_table' class='route_table'>\n
|
650
|
+
\ <thead>\n <tr>\n <th>Helper</th>\n <th>HTTP Verb</th>\n <th>Path</th>\n
|
651
|
+
\ <th>Controller#Action</th>\n </tr>\n <tr class='bottom'>\n <th>\n
|
652
|
+
\ <a data-route-helper=\"_path\" href=\"#\" title=\"Returns a relative
|
653
|
+
path (without the http or domain)\">Path</a> /\n <a data-route-helper=\"_url\"
|
654
|
+
href=\"#\" title=\"Returns an absolute url (with the http and domain)\">Url</a>\n
|
655
|
+
\ </th>\n <th>\n </th>\n <th>\n <input id=\"path_search\"
|
656
|
+
name=\"path[]\" placeholder=\"Path Match\" type=\"search\" />\n </th>\n
|
657
|
+
\ <th>\n </th>\n </tr>\n </thead>\n <tbody class='matched_paths'
|
658
|
+
id='matched_paths'>\n </tbody>\n <tbody>\n <tr class='route_row' data-helper='path'>\n
|
659
|
+
\ <td data-route-name='api_question_survey_questions'>\n api_question_survey_questions<span
|
660
|
+
class='helper'>_path</span>\n </td>\n <td data-route-verb='GET'>\n GET\n
|
661
|
+
\ </td>\n <td data-route-path='/api/questions/:question_id/survey_questions(.:format)'
|
662
|
+
data-regexp='^\\/api\\/questions\\/([^\\/.?]+)\\/survey_questions(?:\\.([^\\/.?]+))?$'>\n
|
663
|
+
\ /api/questions/:question_id/survey_questions(.:format)\n </td>\n <td
|
664
|
+
data-route-reqs='api/v1/survey_questions#index {:format=>"json"}'>\n
|
665
|
+
\ api/v1/survey_questions#index {:format=>"json"}\n </td>\n</tr>\n<tr
|
666
|
+
class='route_row' data-helper='path'>\n <td data-route-name='api_questions'>\n
|
667
|
+
\ api_questions<span class='helper'>_path</span>\n </td>\n <td data-route-verb='GET'>\n
|
668
|
+
\ GET\n </td>\n <td data-route-path='/api/questions(.:format)' data-regexp='^\\/api\\/questions(?:\\.([^\\/.?]+))?$'>\n
|
669
|
+
\ /api/questions(.:format)\n </td>\n <td data-route-reqs='api/v1/questions#index
|
670
|
+
{:format=>"json"}'>\n api/v1/questions#index {:format=>"json"}\n
|
671
|
+
\ </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n <td data-route-name='api_survey_survey_questions'>\n
|
672
|
+
\ api_survey_survey_questions<span class='helper'>_path</span>\n </td>\n
|
673
|
+
\ <td data-route-verb='POST'>\n POST\n </td>\n <td data-route-path='/api/surveys/:survey_id/survey_questions(.:format)'
|
674
|
+
data-regexp='^\\/api\\/surveys\\/([^\\/.?]+)\\/survey_questions(?:\\.([^\\/.?]+))?$'>\n
|
675
|
+
\ /api/surveys/:survey_id/survey_questions(.:format)\n </td>\n <td data-route-reqs='api/v1/survey_questions#create
|
676
|
+
{:format=>"json"}'>\n api/v1/survey_questions#create {:format=>"json"}\n
|
677
|
+
\ </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n <td data-route-name='api_survey_survey_question'>\n
|
678
|
+
\ api_survey_survey_question<span class='helper'>_path</span>\n </td>\n
|
679
|
+
\ <td data-route-verb='GET'>\n GET\n </td>\n <td data-route-path='/api/surveys/:survey_id/survey_questions/:id(.:format)'
|
680
|
+
data-regexp='^\\/api\\/surveys\\/([^\\/.?]+)\\/survey_questions\\/([^\\/.?]+)(?:\\.([^\\/.?]+))?$'>\n
|
681
|
+
\ /api/surveys/:survey_id/survey_questions/:id(.:format)\n </td>\n <td
|
682
|
+
data-route-reqs='api/v1/survey_questions#show {:format=>"json"}'>\n
|
683
|
+
\ api/v1/survey_questions#show {:format=>"json"}\n </td>\n</tr>\n<tr
|
684
|
+
class='route_row' data-helper='path'>\n <td data-route-name=''>\n </td>\n
|
685
|
+
\ <td data-route-verb='PATCH'>\n PATCH\n </td>\n <td data-route-path='/api/surveys/:survey_id/survey_questions/:id(.:format)'
|
686
|
+
data-regexp='^\\/api\\/surveys\\/([^\\/.?]+)\\/survey_questions\\/([^\\/.?]+)(?:\\.([^\\/.?]+))?$'>\n
|
687
|
+
\ /api/surveys/:survey_id/survey_questions/:id(.:format)\n </td>\n <td
|
688
|
+
data-route-reqs='api/v1/survey_questions#update {:format=>"json"}'>\n
|
689
|
+
\ api/v1/survey_questions#update {:format=>"json"}\n </td>\n</tr>\n<tr
|
690
|
+
class='route_row' data-helper='path'>\n <td data-route-name=''>\n </td>\n
|
691
|
+
\ <td data-route-verb='PUT'>\n PUT\n </td>\n <td data-route-path='/api/surveys/:survey_id/survey_questions/:id(.:format)'
|
692
|
+
data-regexp='^\\/api\\/surveys\\/([^\\/.?]+)\\/survey_questions\\/([^\\/.?]+)(?:\\.([^\\/.?]+))?$'>\n
|
693
|
+
\ /api/surveys/:survey_id/survey_questions/:id(.:format)\n </td>\n <td
|
694
|
+
data-route-reqs='api/v1/survey_questions#update {:format=>"json"}'>\n
|
695
|
+
\ api/v1/survey_questions#update {:format=>"json"}\n </td>\n</tr>\n<tr
|
696
|
+
class='route_row' data-helper='path'>\n <td data-route-name='api_surveys'>\n
|
697
|
+
\ api_surveys<span class='helper'>_path</span>\n </td>\n <td data-route-verb='GET'>\n
|
698
|
+
\ GET\n </td>\n <td data-route-path='/api/surveys(.:format)' data-regexp='^\\/api\\/surveys(?:\\.([^\\/.?]+))?$'>\n
|
699
|
+
\ /api/surveys(.:format)\n </td>\n <td data-route-reqs='api/v1/surveys#index
|
700
|
+
{:format=>"json"}'>\n api/v1/surveys#index {:format=>"json"}\n
|
701
|
+
\ </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n <td data-route-name=''>\n
|
702
|
+
\ </td>\n <td data-route-verb='POST'>\n POST\n </td>\n <td data-route-path='/api/surveys(.:format)'
|
703
|
+
data-regexp='^\\/api\\/surveys(?:\\.([^\\/.?]+))?$'>\n /api/surveys(.:format)\n
|
704
|
+
\ </td>\n <td data-route-reqs='api/v1/surveys#create {:format=>"json"}'>\n
|
705
|
+
\ api/v1/surveys#create {:format=>"json"}\n </td>\n</tr>\n<tr
|
706
|
+
class='route_row' data-helper='path'>\n <td data-route-name='api_survey'>\n
|
707
|
+
\ api_survey<span class='helper'>_path</span>\n </td>\n <td data-route-verb='GET'>\n
|
708
|
+
\ GET\n </td>\n <td data-route-path='/api/surveys/:id(.:format)' data-regexp='^\\/api\\/surveys\\/([^\\/.?]+)(?:\\.([^\\/.?]+))?$'>\n
|
709
|
+
\ /api/surveys/:id(.:format)\n </td>\n <td data-route-reqs='api/v1/surveys#show
|
710
|
+
{:format=>"json"}'>\n api/v1/surveys#show {:format=>"json"}\n
|
711
|
+
\ </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n <td data-route-name='api_users'>\n
|
712
|
+
\ api_users<span class='helper'>_path</span>\n </td>\n <td data-route-verb='POST'>\n
|
713
|
+
\ POST\n </td>\n <td data-route-path='/api/users(.:format)' data-regexp='^\\/api\\/users(?:\\.([^\\/.?]+))?$'>\n
|
714
|
+
\ /api/users(.:format)\n </td>\n <td data-route-reqs='api/v1/users#create
|
715
|
+
{:format=>"json"}'>\n api/v1/users#create {:format=>"json"}\n
|
716
|
+
\ </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n <td data-route-name='api_user'>\n
|
717
|
+
\ api_user<span class='helper'>_path</span>\n </td>\n <td data-route-verb='GET'>\n
|
718
|
+
\ GET\n </td>\n <td data-route-path='/api/users/:id(.:format)' data-regexp='^\\/api\\/users\\/([^\\/.?]+)(?:\\.([^\\/.?]+))?$'>\n
|
719
|
+
\ /api/users/:id(.:format)\n </td>\n <td data-route-reqs='api/v1/users#show
|
720
|
+
{:format=>"json"}'>\n api/v1/users#show {:format=>"json"}\n
|
721
|
+
\ </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n <td data-route-name='root'>\n
|
722
|
+
\ root<span class='helper'>_path</span>\n </td>\n <td data-route-verb='GET'>\n
|
723
|
+
\ GET\n </td>\n <td data-route-path='/' data-regexp='^\\/$'>\n /\n
|
724
|
+
\ </td>\n <td data-route-reqs='api/v1/root#index'>\n api/v1/root#index\n
|
725
|
+
\ </td>\n</tr>\n\n </tbody>\n</table>\n\n<script type='text/javascript'>\n
|
726
|
+
\ function each(elems, func) {\n if (!elems instanceof Array) { elems =
|
727
|
+
[elems]; }\n for (var i = 0, len = elems.length; i < len; i++) {\n func(elems[i]);\n
|
728
|
+
\ }\n }\n\n function setValOn(elems, val) {\n each(elems, function(elem)
|
729
|
+
{\n elem.innerHTML = val;\n });\n }\n\n function onClick(elems,
|
730
|
+
func) {\n each(elems, function(elem) {\n elem.onclick = func;\n });\n
|
731
|
+
\ }\n\n // Enables functionality to toggle between `_path` and `_url` helper
|
732
|
+
suffixes\n function setupRouteToggleHelperLinks() {\n var toggleLinks
|
733
|
+
= document.querySelectorAll('#route_table [data-route-helper]');\n onClick(toggleLinks,
|
734
|
+
function(){\n var helperTxt = this.getAttribute(\"data-route-helper\"),\n
|
735
|
+
\ helperElems = document.querySelectorAll('[data-route-name] span.helper');\n
|
736
|
+
\ setValOn(helperElems, helperTxt);\n });\n }\n\n // takes an array
|
737
|
+
of elements with a data-regexp attribute and\n // passes their their parent
|
738
|
+
<tr> into the callback function\n // if the regexp matchs a given path\n
|
739
|
+
\ function eachElemsForPath(elems, path, func) {\n each(elems, function(e){\n
|
740
|
+
\ var reg = e.getAttribute(\"data-regexp\");\n if (path.match(RegExp(reg)))
|
741
|
+
{\n func(e.parentNode.cloneNode(true));\n }\n })\n }\n\n //
|
742
|
+
Ensure path always starts with a slash \"/\" and remove params or fragments\n
|
743
|
+
\ function sanitizePath(path) {\n var path = path.charAt(0) == '/' ? path
|
744
|
+
: \"/\" + path;\n return path.replace(/\\#.*|\\?.*/, '');\n }\n\n //
|
745
|
+
Enables path search functionality\n function setupMatchPaths() {\n var
|
746
|
+
regexpElems = document.querySelectorAll('#route_table [data-regexp]'),\n
|
747
|
+
\ pathElem = document.querySelector('#path_search'),\n selectedSection
|
748
|
+
= document.querySelector('#matched_paths'),\n noMatchText = '<tr><th
|
749
|
+
colspan=\"4\">None</th></tr>';\n\n\n // Remove matches if no path is present\n
|
750
|
+
\ pathElem.onblur = function(e) {\n if (pathElem.value === \"\") selectedSection.innerHTML
|
751
|
+
= \"\";\n }\n\n // On key press perform a search for matching paths\n
|
752
|
+
\ pathElem.onkeyup = function(e){\n var path = sanitizePath(pathElem.value),\n
|
753
|
+
\ defaultText = '<tr><th colspan=\"4\">Paths Matching (' + path +
|
754
|
+
'):</th></tr>';\n\n // Clear out results section\n selectedSection.innerHTML=
|
755
|
+
defaultText;\n\n // Display matches if they exist\n eachElemsForPath(regexpElems,
|
756
|
+
path, function(e){\n selectedSection.appendChild(e);\n });\n\n
|
757
|
+
\ // If no match present, tell the user\n if (selectedSection.innerHTML
|
758
|
+
=== defaultText) {\n selectedSection.innerHTML = selectedSection.innerHTML
|
759
|
+
+ noMatchText;\n }\n }\n }\n\n setupMatchPaths();\n setupRouteToggleHelperLinks();\n</script>\n\n</div>\n\n\n</body>\n</html>\n"
|
760
|
+
http_version:
|
761
|
+
recorded_at: Sat, 13 Sep 2014 15:30:49 GMT
|
762
|
+
- request:
|
763
|
+
method: get
|
764
|
+
uri: http://localhost:3000/
|
765
|
+
body:
|
766
|
+
encoding: US-ASCII
|
767
|
+
string: ''
|
768
|
+
headers:
|
769
|
+
User-Agent:
|
770
|
+
- Faraday v0.9.0
|
771
|
+
Content-Type:
|
772
|
+
- application/json
|
773
|
+
Api-Token:
|
774
|
+
- testing
|
775
|
+
Accept-Encoding:
|
776
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
777
|
+
Accept:
|
778
|
+
- "*/*"
|
779
|
+
response:
|
780
|
+
status:
|
781
|
+
code: 200
|
782
|
+
message: 'OK '
|
783
|
+
headers:
|
784
|
+
X-Frame-Options:
|
785
|
+
- SAMEORIGIN
|
786
|
+
X-Xss-Protection:
|
787
|
+
- 1; mode=block
|
788
|
+
X-Content-Type-Options:
|
789
|
+
- nosniff
|
790
|
+
X-Ua-Compatible:
|
791
|
+
- chrome=1
|
792
|
+
Content-Type:
|
793
|
+
- application/json; charset=utf-8
|
794
|
+
Etag:
|
795
|
+
- '"c4942090acbc96722cba50e4cecfde73"'
|
796
|
+
Cache-Control:
|
797
|
+
- max-age=0, private, must-revalidate
|
798
|
+
X-Request-Id:
|
799
|
+
- bdb15819-7e41-48de-b4bf-9f0f1c42c087
|
800
|
+
X-Runtime:
|
801
|
+
- '0.004781'
|
802
|
+
Server:
|
803
|
+
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
804
|
+
Date:
|
805
|
+
- Sun, 14 Sep 2014 17:17:28 GMT
|
806
|
+
Content-Length:
|
807
|
+
- '236'
|
808
|
+
Connection:
|
809
|
+
- Keep-Alive
|
810
|
+
body:
|
811
|
+
encoding: UTF-8
|
812
|
+
string: |-
|
813
|
+
{
|
814
|
+
"_links": {
|
815
|
+
"self": {
|
816
|
+
"href": "http://localhost:3000/"
|
817
|
+
},
|
818
|
+
"surveys": {
|
819
|
+
"href": "api/surveys"
|
820
|
+
},
|
821
|
+
"users": {
|
822
|
+
"href": "api/users"
|
823
|
+
},
|
824
|
+
"questions": {
|
825
|
+
"href": "api/questions"
|
826
|
+
}
|
827
|
+
}
|
828
|
+
}
|
829
|
+
http_version:
|
830
|
+
recorded_at: Sun, 14 Sep 2014 17:17:28 GMT
|
831
|
+
- request:
|
832
|
+
method: get
|
833
|
+
uri: http://localhost:3000/
|
834
|
+
body:
|
835
|
+
encoding: US-ASCII
|
836
|
+
string: ''
|
837
|
+
headers:
|
838
|
+
User-Agent:
|
839
|
+
- Faraday v0.9.0
|
840
|
+
Content-Type:
|
841
|
+
- application/json
|
842
|
+
Api-Token:
|
843
|
+
- testing
|
844
|
+
Accept-Encoding:
|
845
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
846
|
+
Accept:
|
847
|
+
- "*/*"
|
848
|
+
response:
|
849
|
+
status:
|
850
|
+
code: 200
|
851
|
+
message: 'OK '
|
852
|
+
headers:
|
853
|
+
X-Frame-Options:
|
854
|
+
- SAMEORIGIN
|
855
|
+
X-Xss-Protection:
|
856
|
+
- 1; mode=block
|
857
|
+
X-Content-Type-Options:
|
858
|
+
- nosniff
|
859
|
+
X-Ua-Compatible:
|
860
|
+
- chrome=1
|
861
|
+
Content-Type:
|
862
|
+
- application/json; charset=utf-8
|
863
|
+
Etag:
|
864
|
+
- '"c4942090acbc96722cba50e4cecfde73"'
|
865
|
+
Cache-Control:
|
866
|
+
- max-age=0, private, must-revalidate
|
867
|
+
X-Request-Id:
|
868
|
+
- 157c7dc0-5147-4497-8d11-be2add982d4b
|
869
|
+
X-Runtime:
|
870
|
+
- '0.004230'
|
871
|
+
Server:
|
872
|
+
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
873
|
+
Date:
|
874
|
+
- Sun, 14 Sep 2014 17:17:28 GMT
|
875
|
+
Content-Length:
|
876
|
+
- '236'
|
877
|
+
Connection:
|
878
|
+
- Keep-Alive
|
879
|
+
body:
|
880
|
+
encoding: UTF-8
|
881
|
+
string: |-
|
882
|
+
{
|
883
|
+
"_links": {
|
884
|
+
"self": {
|
885
|
+
"href": "http://localhost:3000/"
|
886
|
+
},
|
887
|
+
"surveys": {
|
888
|
+
"href": "api/surveys"
|
889
|
+
},
|
890
|
+
"users": {
|
891
|
+
"href": "api/users"
|
892
|
+
},
|
893
|
+
"questions": {
|
894
|
+
"href": "api/questions"
|
895
|
+
}
|
896
|
+
}
|
897
|
+
}
|
898
|
+
http_version:
|
899
|
+
recorded_at: Sun, 14 Sep 2014 17:17:28 GMT
|
900
|
+
- request:
|
901
|
+
method: post
|
902
|
+
uri: http://localhost:3000/api/users/
|
903
|
+
body:
|
904
|
+
encoding: UTF-8
|
905
|
+
string: "{}"
|
906
|
+
headers:
|
907
|
+
User-Agent:
|
908
|
+
- Faraday v0.9.0
|
909
|
+
Content-Type:
|
910
|
+
- application/json
|
911
|
+
Api-Token:
|
912
|
+
- testing
|
913
|
+
Accept-Encoding:
|
914
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
915
|
+
Accept:
|
916
|
+
- "*/*"
|
917
|
+
response:
|
918
|
+
status:
|
919
|
+
code: 201
|
920
|
+
message: 'Created '
|
921
|
+
headers:
|
922
|
+
X-Frame-Options:
|
923
|
+
- SAMEORIGIN
|
924
|
+
X-Xss-Protection:
|
925
|
+
- 1; mode=block
|
926
|
+
X-Content-Type-Options:
|
927
|
+
- nosniff
|
928
|
+
X-Ua-Compatible:
|
929
|
+
- chrome=1
|
930
|
+
Content-Type:
|
931
|
+
- application/json; charset=utf-8
|
932
|
+
Etag:
|
933
|
+
- '"26b1f5f9dcb7fb595603a2bbe73f367c"'
|
934
|
+
Cache-Control:
|
935
|
+
- max-age=0, private, must-revalidate
|
936
|
+
X-Request-Id:
|
937
|
+
- 71174a13-9fb7-4965-9af7-84d548f9931c
|
938
|
+
X-Runtime:
|
939
|
+
- '0.008918'
|
940
|
+
Server:
|
941
|
+
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
942
|
+
Date:
|
943
|
+
- Sat, 20 Sep 2014 14:14:33 GMT
|
944
|
+
Content-Length:
|
945
|
+
- '270'
|
946
|
+
Connection:
|
947
|
+
- Keep-Alive
|
948
|
+
body:
|
949
|
+
encoding: UTF-8
|
950
|
+
string: |-
|
951
|
+
{
|
952
|
+
"id": 8,
|
953
|
+
"service_user_id": "9d478ee79f431c1667f39d26c8069fa197a0d914f318764ffb4bab6b6c4f135f",
|
954
|
+
"_links": {
|
955
|
+
"self": {
|
956
|
+
"href": "http://localhost:3000/api/users/8"
|
957
|
+
}
|
958
|
+
},
|
959
|
+
"token": "4543370e5117e89c5339671f6f2f5b057e1e2b40f6ec4380f5447bb99b15a922"
|
960
|
+
}
|
961
|
+
http_version:
|
962
|
+
recorded_at: Sat, 20 Sep 2014 14:14:33 GMT
|
963
|
+
- request:
|
964
|
+
method: post
|
965
|
+
uri: http://localhost:3000/api/surveys/?random=true
|
966
|
+
body:
|
967
|
+
encoding: UTF-8
|
968
|
+
string: '{"survey":{"user_id":8}}'
|
969
|
+
headers:
|
970
|
+
User-Agent:
|
971
|
+
- Faraday v0.9.0
|
972
|
+
Content-Type:
|
973
|
+
- application/json
|
974
|
+
Api-Token:
|
975
|
+
- testing
|
976
|
+
Accept-Encoding:
|
977
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
978
|
+
Accept:
|
979
|
+
- "*/*"
|
980
|
+
response:
|
981
|
+
status:
|
982
|
+
code: 201
|
983
|
+
message: 'Created '
|
984
|
+
headers:
|
985
|
+
X-Frame-Options:
|
986
|
+
- SAMEORIGIN
|
987
|
+
X-Xss-Protection:
|
988
|
+
- 1; mode=block
|
989
|
+
X-Content-Type-Options:
|
990
|
+
- nosniff
|
991
|
+
X-Ua-Compatible:
|
992
|
+
- chrome=1
|
993
|
+
Content-Type:
|
994
|
+
- application/json; charset=utf-8
|
995
|
+
Etag:
|
996
|
+
- '"43a966277a9612ebc4e3b10550750330"'
|
997
|
+
Cache-Control:
|
998
|
+
- max-age=0, private, must-revalidate
|
999
|
+
X-Request-Id:
|
1000
|
+
- 56d9be84-acc5-404f-a6d8-98fa04d3513c
|
1001
|
+
X-Runtime:
|
1002
|
+
- '0.034562'
|
1003
|
+
Server:
|
1004
|
+
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
1005
|
+
Date:
|
1006
|
+
- Sat, 20 Sep 2014 14:14:33 GMT
|
1007
|
+
Content-Length:
|
1008
|
+
- '3485'
|
1009
|
+
Connection:
|
1010
|
+
- Keep-Alive
|
1011
|
+
body:
|
1012
|
+
encoding: UTF-8
|
1013
|
+
string: |-
|
1014
|
+
{
|
1015
|
+
"id": 8,
|
1016
|
+
"user_id": 8,
|
1017
|
+
"_links": {
|
1018
|
+
"self": {
|
1019
|
+
"href": "http://localhost:3000/api/surveys/8"
|
1020
|
+
},
|
1021
|
+
"survey_questions": {
|
1022
|
+
"post": {
|
1023
|
+
"href": "/api/surveys/8/survey_questions"
|
1024
|
+
},
|
1025
|
+
"put": {
|
1026
|
+
"href": "/api/surveys/8/survey_questions"
|
1027
|
+
}
|
1028
|
+
}
|
1029
|
+
},
|
1030
|
+
"completed": false,
|
1031
|
+
"survey_questions": [
|
1032
|
+
{
|
1033
|
+
"id": 18,
|
1034
|
+
"text": "How do you feel right now?",
|
1035
|
+
"type": "range",
|
1036
|
+
"responses": [
|
1037
|
+
"0",
|
1038
|
+
"10"
|
1039
|
+
],
|
1040
|
+
"answer": null,
|
1041
|
+
"freeform": false,
|
1042
|
+
"_links": {
|
1043
|
+
"self": {
|
1044
|
+
"href": "/api/surveys/8/survey_questions/18"
|
1045
|
+
},
|
1046
|
+
"post": {
|
1047
|
+
"href": "http://localhost:3000/api/surveys/8/survey_questions"
|
1048
|
+
},
|
1049
|
+
"put": {
|
1050
|
+
"href": "/api/surveys/8/survey_questions/18"
|
1051
|
+
},
|
1052
|
+
"survey": {
|
1053
|
+
"href": "/api/surveys/8"
|
1054
|
+
}
|
1055
|
+
}
|
1056
|
+
},
|
1057
|
+
{
|
1058
|
+
"id": 19,
|
1059
|
+
"text": "Where are you?",
|
1060
|
+
"type": "multiple",
|
1061
|
+
"responses": [
|
1062
|
+
"At Home",
|
1063
|
+
"At Work",
|
1064
|
+
"In a car",
|
1065
|
+
"Other"
|
1066
|
+
],
|
1067
|
+
"answer": null,
|
1068
|
+
"freeform": true,
|
1069
|
+
"_links": {
|
1070
|
+
"self": {
|
1071
|
+
"href": "/api/surveys/8/survey_questions/19"
|
1072
|
+
},
|
1073
|
+
"post": {
|
1074
|
+
"href": "http://localhost:3000/api/surveys/8/survey_questions"
|
1075
|
+
},
|
1076
|
+
"put": {
|
1077
|
+
"href": "/api/surveys/8/survey_questions/19"
|
1078
|
+
},
|
1079
|
+
"survey": {
|
1080
|
+
"href": "/api/surveys/8"
|
1081
|
+
}
|
1082
|
+
}
|
1083
|
+
},
|
1084
|
+
{
|
1085
|
+
"id": 20,
|
1086
|
+
"text": "On average, how many hours do you work each week?",
|
1087
|
+
"type": "multiple",
|
1088
|
+
"responses": [
|
1089
|
+
"Less than 5",
|
1090
|
+
"5-10",
|
1091
|
+
"10-20",
|
1092
|
+
"20-30",
|
1093
|
+
"30-40",
|
1094
|
+
"40-50",
|
1095
|
+
"50-60",
|
1096
|
+
"60-70",
|
1097
|
+
"More than 70"
|
1098
|
+
],
|
1099
|
+
"answer": null,
|
1100
|
+
"freeform": false,
|
1101
|
+
"_links": {
|
1102
|
+
"self": {
|
1103
|
+
"href": "/api/surveys/8/survey_questions/20"
|
1104
|
+
},
|
1105
|
+
"post": {
|
1106
|
+
"href": "http://localhost:3000/api/surveys/8/survey_questions"
|
1107
|
+
},
|
1108
|
+
"put": {
|
1109
|
+
"href": "/api/surveys/8/survey_questions/20"
|
1110
|
+
},
|
1111
|
+
"survey": {
|
1112
|
+
"href": "/api/surveys/8"
|
1113
|
+
}
|
1114
|
+
}
|
1115
|
+
},
|
1116
|
+
{
|
1117
|
+
"id": 21,
|
1118
|
+
"text": "If you could, and it had no negative consequences, would you jump forward in time 24 hours?",
|
1119
|
+
"type": "boolean",
|
1120
|
+
"responses": [
|
1121
|
+
"t",
|
1122
|
+
"f"
|
1123
|
+
],
|
1124
|
+
"answer": null,
|
1125
|
+
"freeform": false,
|
1126
|
+
"_links": {
|
1127
|
+
"self": {
|
1128
|
+
"href": "/api/surveys/8/survey_questions/21"
|
1129
|
+
},
|
1130
|
+
"post": {
|
1131
|
+
"href": "http://localhost:3000/api/surveys/8/survey_questions"
|
1132
|
+
},
|
1133
|
+
"put": {
|
1134
|
+
"href": "/api/surveys/8/survey_questions/21"
|
1135
|
+
},
|
1136
|
+
"survey": {
|
1137
|
+
"href": "/api/surveys/8"
|
1138
|
+
}
|
1139
|
+
}
|
1140
|
+
},
|
1141
|
+
{
|
1142
|
+
"id": 22,
|
1143
|
+
"text": "In general, how is your health?",
|
1144
|
+
"type": "multiple",
|
1145
|
+
"responses": [
|
1146
|
+
"Excellent",
|
1147
|
+
"Very Good",
|
1148
|
+
"Good",
|
1149
|
+
"Fair",
|
1150
|
+
"Poor"
|
1151
|
+
],
|
1152
|
+
"answer": null,
|
1153
|
+
"freeform": false,
|
1154
|
+
"_links": {
|
1155
|
+
"self": {
|
1156
|
+
"href": "/api/surveys/8/survey_questions/22"
|
1157
|
+
},
|
1158
|
+
"post": {
|
1159
|
+
"href": "http://localhost:3000/api/surveys/8/survey_questions"
|
1160
|
+
},
|
1161
|
+
"put": {
|
1162
|
+
"href": "/api/surveys/8/survey_questions/22"
|
1163
|
+
},
|
1164
|
+
"survey": {
|
1165
|
+
"href": "/api/surveys/8"
|
1166
|
+
}
|
1167
|
+
}
|
1168
|
+
}
|
1169
|
+
]
|
1170
|
+
}
|
1171
|
+
http_version:
|
1172
|
+
recorded_at: Sat, 20 Sep 2014 14:14:33 GMT
|
359
1173
|
recorded_with: VCR 2.6.0
|