poptart 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/lib/poptart.rb +1 -4
  4. data/lib/poptart/link.rb +9 -0
  5. data/lib/poptart/model.rb +13 -29
  6. data/lib/poptart/question.rb +21 -17
  7. data/lib/poptart/root.rb +10 -1
  8. data/lib/poptart/survey.rb +34 -7
  9. data/lib/poptart/survey_question.rb +32 -12
  10. data/lib/poptart/user.rb +4 -21
  11. data/lib/version.rb +1 -1
  12. data/poptart.gemspec +0 -4
  13. data/spec/lib/poptart/model_spec.rb +95 -0
  14. data/spec/lib/poptart/question_spec.rb +47 -0
  15. data/spec/lib/poptart/root_spec.rb +50 -0
  16. data/spec/lib/poptart/survey_question_spec.rb +166 -0
  17. data/spec/lib/poptart/survey_spec.rb +105 -0
  18. data/spec/lib/poptart/user_spec.rb +45 -0
  19. data/spec/requests/questions_spec.rb +31 -0
  20. data/spec/requests/survey_questions_spec.rb +150 -0
  21. data/spec/requests/surveys_spec.rb +34 -5
  22. data/spec/requests/{user_management_spec.rb → users_spec.rb} +5 -5
  23. data/spec/spec_helper.rb +1 -4
  24. data/spec/vcr/answering/survey_questions_answers_a_multiple_choice_question.yml +1527 -1596
  25. data/spec/vcr/answering/survey_questions_answers_a_survey_question.yml +2942 -2035
  26. data/spec/vcr/answering/survey_questions_creates_and_returns_a_random_question_survey.yml +254 -70
  27. data/spec/vcr/answering/survey_questions_creates_and_returns_an_empty_survey.yml +110 -48
  28. data/spec/vcr/answering/survey_questions_finds_survey_question_for_id.yml +1618 -286
  29. data/spec/vcr/poptart/survey/adds_a_question_to_a_survey.yml +1939 -0
  30. data/spec/vcr/poptart/survey/creates_a_random_survey.yml +318 -0
  31. data/spec/vcr/poptart/survey/creates_an_empty_survey.yml +702 -0
  32. data/spec/vcr/poptart/survey/returns_a_survey_by_id.yml +618 -0
  33. data/spec/vcr/poptart/user/creates_a_user.yml +179 -0
  34. data/spec/vcr/{user/management_creates_a_user.yml → poptart/user/returns_a_user.yml} +72 -69
  35. data/spec/vcr/questions/creates_a_question.yml +186 -0
  36. data/spec/vcr/questions/finds_a_question_by_id.yml +326 -0
  37. data/spec/vcr/questions/finds_a_question_by_key.yml +144 -0
  38. data/spec/vcr/questions/returns_all_answered_survey_questions_for_a_question.yml +1021 -0
  39. data/spec/vcr/retrieving/answers_returns_all_answered_survey_questions_for_a_question.yml +533 -479
  40. data/spec/vcr/survey/questions_answers_a_multiple_choice_question.yml +1454 -0
  41. data/spec/vcr/survey/questions_answers_a_survey_question.yml +1772 -0
  42. data/spec/vcr/survey/questions_creates_and_returns_an_empty_survey.yml +372 -0
  43. data/spec/vcr/survey/questions_finds_survey_question_for_id.yml +3083 -0
  44. data/spec/vcr/survey/questions_returns_all_answered_survey_questions_for_a_question.yml +5756 -0
  45. data/spec/vcr/survey/questions_returns_all_answered_survey_questions_for_a_question_by_key.yml +973 -0
  46. data/spec/vcr/survey/questions_returns_all_answered_survey_questions_for_a_survey.yml +620 -0
  47. metadata +55 -72
  48. data/lib/poptart/boolean_question.rb +0 -14
  49. data/lib/poptart/multiple_response_question.rb +0 -9
  50. data/lib/poptart/range_question.rb +0 -9
  51. data/lib/poptart/time_question.rb +0 -9
  52. data/spec/requests/answering_survey_questions_spec.rb +0 -79
  53. data/spec/requests/answers_spec.rb +0 -45
  54. data/spec/requests/creating_questions_spec.rb +0 -30
@@ -0,0 +1,1021 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://localhost:3000/api/surveys/57/survey_questions
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"survey_question":{"question_id":64,"responses":null}}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.0
12
+ Content-Type:
13
+ - application/json
14
+ Api-Token:
15
+ - testing
16
+ User-Token:
17
+ - 4f7e98b50afc901a1dca5e068180011ad9afebe0eae9aa64e55062ec878b51ec
18
+ Service-User-Id:
19
+ - b36d5e9a3f4ecd53e66ac269f9a52958aaa0cc0b52721073c59a836a495b7644
20
+ Accept-Encoding:
21
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
22
+ Accept:
23
+ - "*/*"
24
+ response:
25
+ status:
26
+ code: 201
27
+ message: 'Created '
28
+ headers:
29
+ X-Frame-Options:
30
+ - SAMEORIGIN
31
+ X-Xss-Protection:
32
+ - 1; mode=block
33
+ X-Content-Type-Options:
34
+ - nosniff
35
+ X-Ua-Compatible:
36
+ - chrome=1
37
+ Content-Type:
38
+ - application/json; charset=utf-8
39
+ Etag:
40
+ - '"e944992298d445febf07d8058e04f0ea"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ X-Request-Id:
44
+ - 7bf7ff9c-b826-4e9b-914a-df6588844c72
45
+ X-Runtime:
46
+ - '0.016119'
47
+ Server:
48
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
49
+ Date:
50
+ - Sat, 17 Jan 2015 14:16:06 GMT
51
+ Content-Length:
52
+ - '497'
53
+ Connection:
54
+ - Keep-Alive
55
+ body:
56
+ encoding: UTF-8
57
+ string: |-
58
+ {
59
+ "id": 18,
60
+ "text": "Do you like poptarts?",
61
+ "question_type": "boolean",
62
+ "responses": [
63
+ "t",
64
+ "f"
65
+ ],
66
+ "answer": null,
67
+ "_links": {
68
+ "self": {
69
+ "href": "http://localhost:3000/api/surveys/57/survey_questions/18"
70
+ },
71
+ "put": {
72
+ "href": "http://localhost:3000/api/surveys/57/survey_questions/18"
73
+ },
74
+ "survey": {
75
+ "href": "http://localhost:3000/api/surveys/57"
76
+ }
77
+ },
78
+ "created_at": "2015-01-17T14:16:06.164Z",
79
+ "key": null,
80
+ "question_id": 64
81
+ }
82
+ http_version:
83
+ recorded_at: Sat, 17 Jan 2015 14:16:06 GMT
84
+ - request:
85
+ method: post
86
+ uri: http://localhost:3000/api/surveys/58/survey_questions
87
+ body:
88
+ encoding: UTF-8
89
+ string: '{"survey_question":{"question_id":65,"responses":null}}'
90
+ headers:
91
+ User-Agent:
92
+ - Faraday v0.9.0
93
+ Content-Type:
94
+ - application/json
95
+ Api-Token:
96
+ - testing
97
+ User-Token:
98
+ - 3d7ad0891a66251f20b0e14fc92e3f29de77b4a59cd316ff89228574c2d2e999
99
+ Service-User-Id:
100
+ - c6b3ac637c4991b70fed869aff86b4ba81ca7ea9115a410ba012ca35e2cd1159
101
+ Accept-Encoding:
102
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
103
+ Accept:
104
+ - "*/*"
105
+ response:
106
+ status:
107
+ code: 201
108
+ message: 'Created '
109
+ headers:
110
+ X-Frame-Options:
111
+ - SAMEORIGIN
112
+ X-Xss-Protection:
113
+ - 1; mode=block
114
+ X-Content-Type-Options:
115
+ - nosniff
116
+ X-Ua-Compatible:
117
+ - chrome=1
118
+ Content-Type:
119
+ - application/json; charset=utf-8
120
+ Etag:
121
+ - '"f9b651ffe9bce5227c19048d5be9ee8e"'
122
+ Cache-Control:
123
+ - max-age=0, private, must-revalidate
124
+ X-Request-Id:
125
+ - c55b356e-d738-4519-ac7c-4119a5cc4f7d
126
+ X-Runtime:
127
+ - '0.018197'
128
+ Server:
129
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
130
+ Date:
131
+ - Sat, 17 Jan 2015 14:16:27 GMT
132
+ Content-Length:
133
+ - '497'
134
+ Connection:
135
+ - Keep-Alive
136
+ body:
137
+ encoding: UTF-8
138
+ string: |-
139
+ {
140
+ "id": 19,
141
+ "text": "Do you like poptarts?",
142
+ "question_type": "boolean",
143
+ "responses": [
144
+ "t",
145
+ "f"
146
+ ],
147
+ "answer": null,
148
+ "_links": {
149
+ "self": {
150
+ "href": "http://localhost:3000/api/surveys/58/survey_questions/19"
151
+ },
152
+ "put": {
153
+ "href": "http://localhost:3000/api/surveys/58/survey_questions/19"
154
+ },
155
+ "survey": {
156
+ "href": "http://localhost:3000/api/surveys/58"
157
+ }
158
+ },
159
+ "created_at": "2015-01-17T14:16:27.757Z",
160
+ "key": null,
161
+ "question_id": 65
162
+ }
163
+ http_version:
164
+ recorded_at: Sat, 17 Jan 2015 14:16:27 GMT
165
+ - request:
166
+ method: post
167
+ uri: http://localhost:3000/api/surveys/59/survey_questions
168
+ body:
169
+ encoding: UTF-8
170
+ string: '{"survey_question":{"question_id":65,"responses":["t","f"]}}'
171
+ headers:
172
+ User-Agent:
173
+ - Faraday v0.9.0
174
+ Content-Type:
175
+ - application/json
176
+ Api-Token:
177
+ - testing
178
+ User-Token:
179
+ - 3d7ad0891a66251f20b0e14fc92e3f29de77b4a59cd316ff89228574c2d2e999
180
+ Service-User-Id:
181
+ - c6b3ac637c4991b70fed869aff86b4ba81ca7ea9115a410ba012ca35e2cd1159
182
+ Accept-Encoding:
183
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
184
+ Accept:
185
+ - "*/*"
186
+ response:
187
+ status:
188
+ code: 201
189
+ message: 'Created '
190
+ headers:
191
+ X-Frame-Options:
192
+ - SAMEORIGIN
193
+ X-Xss-Protection:
194
+ - 1; mode=block
195
+ X-Content-Type-Options:
196
+ - nosniff
197
+ X-Ua-Compatible:
198
+ - chrome=1
199
+ Content-Type:
200
+ - application/json; charset=utf-8
201
+ Etag:
202
+ - '"4cb59ae8066bccac14560c1edfc47421"'
203
+ Cache-Control:
204
+ - max-age=0, private, must-revalidate
205
+ X-Request-Id:
206
+ - 4dd81594-d63b-480f-b2c4-e2cb16bac636
207
+ X-Runtime:
208
+ - '0.018194'
209
+ Server:
210
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
211
+ Date:
212
+ - Sat, 17 Jan 2015 14:16:27 GMT
213
+ Content-Length:
214
+ - '497'
215
+ Connection:
216
+ - Keep-Alive
217
+ body:
218
+ encoding: UTF-8
219
+ string: |-
220
+ {
221
+ "id": 20,
222
+ "text": "Do you like poptarts?",
223
+ "question_type": "boolean",
224
+ "responses": [
225
+ "t",
226
+ "f"
227
+ ],
228
+ "answer": null,
229
+ "_links": {
230
+ "self": {
231
+ "href": "http://localhost:3000/api/surveys/59/survey_questions/20"
232
+ },
233
+ "put": {
234
+ "href": "http://localhost:3000/api/surveys/59/survey_questions/20"
235
+ },
236
+ "survey": {
237
+ "href": "http://localhost:3000/api/surveys/59"
238
+ }
239
+ },
240
+ "created_at": "2015-01-17T14:16:27.823Z",
241
+ "key": null,
242
+ "question_id": 65
243
+ }
244
+ http_version:
245
+ recorded_at: Sat, 17 Jan 2015 14:16:27 GMT
246
+ - request:
247
+ method: post
248
+ uri: http://localhost:3000/api/questions
249
+ body:
250
+ encoding: UTF-8
251
+ string: '{"question":{"question_type":"boolean","responses":[true,false],"text":"Do
252
+ you like poptarts?","key":null}}'
253
+ headers:
254
+ User-Agent:
255
+ - Faraday v0.9.0
256
+ Content-Type:
257
+ - application/json
258
+ Api-Token:
259
+ - testing
260
+ Accept-Encoding:
261
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
262
+ Accept:
263
+ - "*/*"
264
+ response:
265
+ status:
266
+ code: 201
267
+ message: 'Created '
268
+ headers:
269
+ X-Frame-Options:
270
+ - SAMEORIGIN
271
+ X-Xss-Protection:
272
+ - 1; mode=block
273
+ X-Content-Type-Options:
274
+ - nosniff
275
+ X-Ua-Compatible:
276
+ - chrome=1
277
+ Content-Type:
278
+ - application/json; charset=utf-8
279
+ Etag:
280
+ - '"1a5b3280b89610ea370d7bf9a0f0e953"'
281
+ Cache-Control:
282
+ - max-age=0, private, must-revalidate
283
+ X-Request-Id:
284
+ - b10f88d6-6950-400d-a5f6-1a4a1731cc81
285
+ X-Runtime:
286
+ - '0.012344'
287
+ Server:
288
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
289
+ Date:
290
+ - Sat, 17 Jan 2015 14:16:34 GMT
291
+ Content-Length:
292
+ - '230'
293
+ Connection:
294
+ - Keep-Alive
295
+ body:
296
+ encoding: UTF-8
297
+ string: |-
298
+ {
299
+ "id": 66,
300
+ "question_type": "boolean",
301
+ "text": "Do you like poptarts?",
302
+ "responses": [
303
+ true,
304
+ false
305
+ ],
306
+ "key": null,
307
+ "_links": {
308
+ "self": {
309
+ "href": "http://localhost:3000/api/questions/66"
310
+ }
311
+ }
312
+ }
313
+ http_version:
314
+ recorded_at: Sat, 17 Jan 2015 14:16:34 GMT
315
+ - request:
316
+ method: get
317
+ uri: http://localhost:3000/
318
+ body:
319
+ encoding: US-ASCII
320
+ string: ''
321
+ headers:
322
+ User-Agent:
323
+ - Faraday v0.9.0
324
+ Content-Type:
325
+ - application/json
326
+ Api-Token:
327
+ - testing
328
+ Accept-Encoding:
329
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
330
+ Accept:
331
+ - "*/*"
332
+ response:
333
+ status:
334
+ code: 200
335
+ message: 'OK '
336
+ headers:
337
+ X-Frame-Options:
338
+ - SAMEORIGIN
339
+ X-Xss-Protection:
340
+ - 1; mode=block
341
+ X-Content-Type-Options:
342
+ - nosniff
343
+ X-Ua-Compatible:
344
+ - chrome=1
345
+ Content-Type:
346
+ - application/json; charset=utf-8
347
+ Etag:
348
+ - '"cd727c0ba392005a102fbf8dc32be000"'
349
+ Cache-Control:
350
+ - max-age=0, private, must-revalidate
351
+ X-Request-Id:
352
+ - 926b0dbb-4996-4576-8243-4db3617ebb92
353
+ X-Runtime:
354
+ - '0.009094'
355
+ Server:
356
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
357
+ Date:
358
+ - Sat, 17 Jan 2015 14:16:34 GMT
359
+ Content-Length:
360
+ - '479'
361
+ Connection:
362
+ - Keep-Alive
363
+ body:
364
+ encoding: UTF-8
365
+ string: |-
366
+ {
367
+ "_links": {
368
+ "self": {
369
+ "href": "http://localhost:3000/"
370
+ },
371
+ "surveys": {
372
+ "href": "http://localhost:3000/api/surveys{/id}{?query*}"
373
+ },
374
+ "users": {
375
+ "href": "http://localhost:3000/api/user{/id}{?query*}"
376
+ },
377
+ "questions": {
378
+ "href": "http://localhost:3000/api/questions{/id}{?query*}"
379
+ },
380
+ "survey_questions": {
381
+ "href": "http://localhost:3000/api/questions/surveys/{survey_id}/survey_questions{/id}{?query*}"
382
+ }
383
+ }
384
+ }
385
+ http_version:
386
+ recorded_at: Sat, 17 Jan 2015 14:16:34 GMT
387
+ - request:
388
+ method: post
389
+ uri: http://localhost:3000/api/user
390
+ body:
391
+ encoding: UTF-8
392
+ string: "{}"
393
+ headers:
394
+ User-Agent:
395
+ - Faraday v0.9.0
396
+ Content-Type:
397
+ - application/json
398
+ Api-Token:
399
+ - testing
400
+ Accept-Encoding:
401
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
402
+ Accept:
403
+ - "*/*"
404
+ response:
405
+ status:
406
+ code: 201
407
+ message: 'Created '
408
+ headers:
409
+ X-Frame-Options:
410
+ - SAMEORIGIN
411
+ X-Xss-Protection:
412
+ - 1; mode=block
413
+ X-Content-Type-Options:
414
+ - nosniff
415
+ X-Ua-Compatible:
416
+ - chrome=1
417
+ Content-Type:
418
+ - application/json; charset=utf-8
419
+ Etag:
420
+ - '"222247bf31ffa5fbbe91b87c089442d6"'
421
+ Cache-Control:
422
+ - max-age=0, private, must-revalidate
423
+ X-Request-Id:
424
+ - 724c8786-9c1f-4506-b8ed-42de0a5d1007
425
+ X-Runtime:
426
+ - '0.009874'
427
+ Server:
428
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
429
+ Date:
430
+ - Sat, 17 Jan 2015 14:16:34 GMT
431
+ Content-Length:
432
+ - '256'
433
+ Connection:
434
+ - Keep-Alive
435
+ body:
436
+ encoding: UTF-8
437
+ string: |-
438
+ {
439
+ "service_user_id": "2c7751fe8260cb792c53cd281b6889c2e464256dfe64e55db62b16f703726b12",
440
+ "_links": {
441
+ "self": {
442
+ "href": "http://localhost:3000/api/user"
443
+ }
444
+ },
445
+ "token": "ccf383df139c9e919db560bdbddf684af1d7d8b69783da94b19acb5340375626"
446
+ }
447
+ http_version:
448
+ recorded_at: Sat, 17 Jan 2015 14:16:34 GMT
449
+ - request:
450
+ method: get
451
+ uri: http://localhost:3000/
452
+ body:
453
+ encoding: US-ASCII
454
+ string: ''
455
+ headers:
456
+ User-Agent:
457
+ - Faraday v0.9.0
458
+ Content-Type:
459
+ - application/json
460
+ Api-Token:
461
+ - testing
462
+ User-Token:
463
+ - ccf383df139c9e919db560bdbddf684af1d7d8b69783da94b19acb5340375626
464
+ Service-User-Id:
465
+ - 2c7751fe8260cb792c53cd281b6889c2e464256dfe64e55db62b16f703726b12
466
+ Accept-Encoding:
467
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
468
+ Accept:
469
+ - "*/*"
470
+ response:
471
+ status:
472
+ code: 200
473
+ message: 'OK '
474
+ headers:
475
+ X-Frame-Options:
476
+ - SAMEORIGIN
477
+ X-Xss-Protection:
478
+ - 1; mode=block
479
+ X-Content-Type-Options:
480
+ - nosniff
481
+ X-Ua-Compatible:
482
+ - chrome=1
483
+ Content-Type:
484
+ - application/json; charset=utf-8
485
+ Etag:
486
+ - '"cd727c0ba392005a102fbf8dc32be000"'
487
+ Cache-Control:
488
+ - max-age=0, private, must-revalidate
489
+ X-Request-Id:
490
+ - 3051b407-1b31-4a53-a7a9-6e6b11c5efda
491
+ X-Runtime:
492
+ - '0.007585'
493
+ Server:
494
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
495
+ Date:
496
+ - Sat, 17 Jan 2015 14:16:35 GMT
497
+ Content-Length:
498
+ - '479'
499
+ Connection:
500
+ - Keep-Alive
501
+ body:
502
+ encoding: UTF-8
503
+ string: |-
504
+ {
505
+ "_links": {
506
+ "self": {
507
+ "href": "http://localhost:3000/"
508
+ },
509
+ "surveys": {
510
+ "href": "http://localhost:3000/api/surveys{/id}{?query*}"
511
+ },
512
+ "users": {
513
+ "href": "http://localhost:3000/api/user{/id}{?query*}"
514
+ },
515
+ "questions": {
516
+ "href": "http://localhost:3000/api/questions{/id}{?query*}"
517
+ },
518
+ "survey_questions": {
519
+ "href": "http://localhost:3000/api/questions/surveys/{survey_id}/survey_questions{/id}{?query*}"
520
+ }
521
+ }
522
+ }
523
+ http_version:
524
+ recorded_at: Sat, 17 Jan 2015 14:16:35 GMT
525
+ - request:
526
+ method: post
527
+ uri: http://localhost:3000/api/surveys
528
+ body:
529
+ encoding: UTF-8
530
+ string: "{}"
531
+ headers:
532
+ User-Agent:
533
+ - Faraday v0.9.0
534
+ Content-Type:
535
+ - application/json
536
+ Api-Token:
537
+ - testing
538
+ User-Token:
539
+ - ccf383df139c9e919db560bdbddf684af1d7d8b69783da94b19acb5340375626
540
+ Service-User-Id:
541
+ - 2c7751fe8260cb792c53cd281b6889c2e464256dfe64e55db62b16f703726b12
542
+ Accept-Encoding:
543
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
544
+ Accept:
545
+ - "*/*"
546
+ response:
547
+ status:
548
+ code: 201
549
+ message: 'Created '
550
+ headers:
551
+ X-Frame-Options:
552
+ - SAMEORIGIN
553
+ X-Xss-Protection:
554
+ - 1; mode=block
555
+ X-Content-Type-Options:
556
+ - nosniff
557
+ X-Ua-Compatible:
558
+ - chrome=1
559
+ Content-Type:
560
+ - application/json; charset=utf-8
561
+ Etag:
562
+ - '"91e83087b10391ceae434572a84adbd0"'
563
+ Cache-Control:
564
+ - max-age=0, private, must-revalidate
565
+ X-Request-Id:
566
+ - b4fe539a-f867-4796-ad3e-5403b5b604df
567
+ X-Runtime:
568
+ - '0.025151'
569
+ Server:
570
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
571
+ Date:
572
+ - Sat, 17 Jan 2015 14:16:35 GMT
573
+ Content-Length:
574
+ - '471'
575
+ Connection:
576
+ - Keep-Alive
577
+ body:
578
+ encoding: UTF-8
579
+ string: |-
580
+ {
581
+ "id": 60,
582
+ "service_user_id": "2c7751fe8260cb792c53cd281b6889c2e464256dfe64e55db62b16f703726b12",
583
+ "_links": {
584
+ "self": {
585
+ "href": "http://localhost:3000/api/surveys/60"
586
+ },
587
+ "survey_questions": {
588
+ "post": {
589
+ "href": "http://localhost:3000/api/surveys/60/survey_questions"
590
+ },
591
+ "put": {
592
+ "href": "http://localhost:3000/api/surveys/60/survey_questions"
593
+ }
594
+ }
595
+ },
596
+ "completed": true,
597
+ "survey_questions": [
598
+
599
+ ]
600
+ }
601
+ http_version:
602
+ recorded_at: Sat, 17 Jan 2015 14:16:35 GMT
603
+ - request:
604
+ method: post
605
+ uri: http://localhost:3000/api/surveys/60/survey_questions
606
+ body:
607
+ encoding: UTF-8
608
+ string: '{"survey_question":{"question_id":66,"responses":null}}'
609
+ headers:
610
+ User-Agent:
611
+ - Faraday v0.9.0
612
+ Content-Type:
613
+ - application/json
614
+ Api-Token:
615
+ - testing
616
+ User-Token:
617
+ - ccf383df139c9e919db560bdbddf684af1d7d8b69783da94b19acb5340375626
618
+ Service-User-Id:
619
+ - 2c7751fe8260cb792c53cd281b6889c2e464256dfe64e55db62b16f703726b12
620
+ Accept-Encoding:
621
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
622
+ Accept:
623
+ - "*/*"
624
+ response:
625
+ status:
626
+ code: 201
627
+ message: 'Created '
628
+ headers:
629
+ X-Frame-Options:
630
+ - SAMEORIGIN
631
+ X-Xss-Protection:
632
+ - 1; mode=block
633
+ X-Content-Type-Options:
634
+ - nosniff
635
+ X-Ua-Compatible:
636
+ - chrome=1
637
+ Content-Type:
638
+ - application/json; charset=utf-8
639
+ Etag:
640
+ - '"086a997a8fede6832108378f8e58d598"'
641
+ Cache-Control:
642
+ - max-age=0, private, must-revalidate
643
+ X-Request-Id:
644
+ - 298b19a0-be2e-4b29-ad22-b1fb6a59456e
645
+ X-Runtime:
646
+ - '0.018484'
647
+ Server:
648
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
649
+ Date:
650
+ - Sat, 17 Jan 2015 14:16:35 GMT
651
+ Content-Length:
652
+ - '497'
653
+ Connection:
654
+ - Keep-Alive
655
+ body:
656
+ encoding: UTF-8
657
+ string: |-
658
+ {
659
+ "id": 21,
660
+ "text": "Do you like poptarts?",
661
+ "question_type": "boolean",
662
+ "responses": [
663
+ "t",
664
+ "f"
665
+ ],
666
+ "answer": null,
667
+ "_links": {
668
+ "self": {
669
+ "href": "http://localhost:3000/api/surveys/60/survey_questions/21"
670
+ },
671
+ "put": {
672
+ "href": "http://localhost:3000/api/surveys/60/survey_questions/21"
673
+ },
674
+ "survey": {
675
+ "href": "http://localhost:3000/api/surveys/60"
676
+ }
677
+ },
678
+ "created_at": "2015-01-17T14:16:35.056Z",
679
+ "key": null,
680
+ "question_id": 66
681
+ }
682
+ http_version:
683
+ recorded_at: Sat, 17 Jan 2015 14:16:35 GMT
684
+ - request:
685
+ method: post
686
+ uri: http://localhost:3000/api/surveys
687
+ body:
688
+ encoding: UTF-8
689
+ string: "{}"
690
+ headers:
691
+ User-Agent:
692
+ - Faraday v0.9.0
693
+ Content-Type:
694
+ - application/json
695
+ Api-Token:
696
+ - testing
697
+ User-Token:
698
+ - ccf383df139c9e919db560bdbddf684af1d7d8b69783da94b19acb5340375626
699
+ Service-User-Id:
700
+ - 2c7751fe8260cb792c53cd281b6889c2e464256dfe64e55db62b16f703726b12
701
+ Accept-Encoding:
702
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
703
+ Accept:
704
+ - "*/*"
705
+ response:
706
+ status:
707
+ code: 201
708
+ message: 'Created '
709
+ headers:
710
+ X-Frame-Options:
711
+ - SAMEORIGIN
712
+ X-Xss-Protection:
713
+ - 1; mode=block
714
+ X-Content-Type-Options:
715
+ - nosniff
716
+ X-Ua-Compatible:
717
+ - chrome=1
718
+ Content-Type:
719
+ - application/json; charset=utf-8
720
+ Etag:
721
+ - '"bf50d5d3566659eeae4223c008da9449"'
722
+ Cache-Control:
723
+ - max-age=0, private, must-revalidate
724
+ X-Request-Id:
725
+ - 2b110788-6e5a-4624-a17d-55edd8626937
726
+ X-Runtime:
727
+ - '0.017946'
728
+ Server:
729
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
730
+ Date:
731
+ - Sat, 17 Jan 2015 14:16:35 GMT
732
+ Content-Length:
733
+ - '471'
734
+ Connection:
735
+ - Keep-Alive
736
+ body:
737
+ encoding: UTF-8
738
+ string: |-
739
+ {
740
+ "id": 61,
741
+ "service_user_id": "2c7751fe8260cb792c53cd281b6889c2e464256dfe64e55db62b16f703726b12",
742
+ "_links": {
743
+ "self": {
744
+ "href": "http://localhost:3000/api/surveys/61"
745
+ },
746
+ "survey_questions": {
747
+ "post": {
748
+ "href": "http://localhost:3000/api/surveys/61/survey_questions"
749
+ },
750
+ "put": {
751
+ "href": "http://localhost:3000/api/surveys/61/survey_questions"
752
+ }
753
+ }
754
+ },
755
+ "completed": true,
756
+ "survey_questions": [
757
+
758
+ ]
759
+ }
760
+ http_version:
761
+ recorded_at: Sat, 17 Jan 2015 14:16:35 GMT
762
+ - request:
763
+ method: post
764
+ uri: http://localhost:3000/api/surveys/61/survey_questions
765
+ body:
766
+ encoding: UTF-8
767
+ string: '{"survey_question":{"question_id":66,"responses":null}}'
768
+ headers:
769
+ User-Agent:
770
+ - Faraday v0.9.0
771
+ Content-Type:
772
+ - application/json
773
+ Api-Token:
774
+ - testing
775
+ User-Token:
776
+ - ccf383df139c9e919db560bdbddf684af1d7d8b69783da94b19acb5340375626
777
+ Service-User-Id:
778
+ - 2c7751fe8260cb792c53cd281b6889c2e464256dfe64e55db62b16f703726b12
779
+ Accept-Encoding:
780
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
781
+ Accept:
782
+ - "*/*"
783
+ response:
784
+ status:
785
+ code: 201
786
+ message: 'Created '
787
+ headers:
788
+ X-Frame-Options:
789
+ - SAMEORIGIN
790
+ X-Xss-Protection:
791
+ - 1; mode=block
792
+ X-Content-Type-Options:
793
+ - nosniff
794
+ X-Ua-Compatible:
795
+ - chrome=1
796
+ Content-Type:
797
+ - application/json; charset=utf-8
798
+ Etag:
799
+ - '"2562b419f23e8bf5c9f4f6d2ac55f558"'
800
+ Cache-Control:
801
+ - max-age=0, private, must-revalidate
802
+ X-Request-Id:
803
+ - 26fb82c0-e8f6-4e4f-8ffc-50d94d032877
804
+ X-Runtime:
805
+ - '0.015904'
806
+ Server:
807
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
808
+ Date:
809
+ - Sat, 17 Jan 2015 14:16:35 GMT
810
+ Content-Length:
811
+ - '497'
812
+ Connection:
813
+ - Keep-Alive
814
+ body:
815
+ encoding: UTF-8
816
+ string: |-
817
+ {
818
+ "id": 22,
819
+ "text": "Do you like poptarts?",
820
+ "question_type": "boolean",
821
+ "responses": [
822
+ "t",
823
+ "f"
824
+ ],
825
+ "answer": null,
826
+ "_links": {
827
+ "self": {
828
+ "href": "http://localhost:3000/api/surveys/61/survey_questions/22"
829
+ },
830
+ "put": {
831
+ "href": "http://localhost:3000/api/surveys/61/survey_questions/22"
832
+ },
833
+ "survey": {
834
+ "href": "http://localhost:3000/api/surveys/61"
835
+ }
836
+ },
837
+ "created_at": "2015-01-17T14:16:35.111Z",
838
+ "key": null,
839
+ "question_id": 66
840
+ }
841
+ http_version:
842
+ recorded_at: Sat, 17 Jan 2015 14:16:35 GMT
843
+ - request:
844
+ method: put
845
+ uri: http://localhost:3000/api/surveys/60/survey_questions/21
846
+ body:
847
+ encoding: UTF-8
848
+ string: '{"id":21,"survey_question":{"answer":true}}'
849
+ headers:
850
+ User-Agent:
851
+ - Faraday v0.9.0
852
+ Content-Type:
853
+ - application/json
854
+ Api-Token:
855
+ - testing
856
+ User-Token:
857
+ - ccf383df139c9e919db560bdbddf684af1d7d8b69783da94b19acb5340375626
858
+ Service-User-Id:
859
+ - 2c7751fe8260cb792c53cd281b6889c2e464256dfe64e55db62b16f703726b12
860
+ Accept-Encoding:
861
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
862
+ Accept:
863
+ - "*/*"
864
+ response:
865
+ status:
866
+ code: 204
867
+ message: 'No Content '
868
+ headers:
869
+ X-Frame-Options:
870
+ - SAMEORIGIN
871
+ X-Xss-Protection:
872
+ - 1; mode=block
873
+ X-Content-Type-Options:
874
+ - nosniff
875
+ X-Ua-Compatible:
876
+ - chrome=1
877
+ Cache-Control:
878
+ - no-cache
879
+ X-Request-Id:
880
+ - 7e4fe6cb-289d-4504-b5b5-231d402bbd0d
881
+ X-Runtime:
882
+ - '0.012497'
883
+ Server:
884
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
885
+ Date:
886
+ - Sat, 17 Jan 2015 14:16:35 GMT
887
+ Connection:
888
+ - Keep-Alive
889
+ body:
890
+ encoding: UTF-8
891
+ string: ''
892
+ http_version:
893
+ recorded_at: Sat, 17 Jan 2015 14:16:35 GMT
894
+ - request:
895
+ method: put
896
+ uri: http://localhost:3000/api/surveys/61/survey_questions/22
897
+ body:
898
+ encoding: UTF-8
899
+ string: '{"id":22,"survey_question":{"answer":false}}'
900
+ headers:
901
+ User-Agent:
902
+ - Faraday v0.9.0
903
+ Content-Type:
904
+ - application/json
905
+ Api-Token:
906
+ - testing
907
+ User-Token:
908
+ - ccf383df139c9e919db560bdbddf684af1d7d8b69783da94b19acb5340375626
909
+ Service-User-Id:
910
+ - 2c7751fe8260cb792c53cd281b6889c2e464256dfe64e55db62b16f703726b12
911
+ Accept-Encoding:
912
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
913
+ Accept:
914
+ - "*/*"
915
+ response:
916
+ status:
917
+ code: 204
918
+ message: 'No Content '
919
+ headers:
920
+ X-Frame-Options:
921
+ - SAMEORIGIN
922
+ X-Xss-Protection:
923
+ - 1; mode=block
924
+ X-Content-Type-Options:
925
+ - nosniff
926
+ X-Ua-Compatible:
927
+ - chrome=1
928
+ Cache-Control:
929
+ - no-cache
930
+ X-Request-Id:
931
+ - 89009939-983c-4c51-af8e-25ff0abc4acc
932
+ X-Runtime:
933
+ - '0.012771'
934
+ Server:
935
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
936
+ Date:
937
+ - Sat, 17 Jan 2015 14:16:35 GMT
938
+ Connection:
939
+ - Keep-Alive
940
+ body:
941
+ encoding: UTF-8
942
+ string: ''
943
+ http_version:
944
+ recorded_at: Sat, 17 Jan 2015 14:16:35 GMT
945
+ - request:
946
+ method: get
947
+ uri: http://localhost:3000/
948
+ body:
949
+ encoding: US-ASCII
950
+ string: ''
951
+ headers:
952
+ User-Agent:
953
+ - Faraday v0.9.0
954
+ Content-Type:
955
+ - application/json
956
+ Api-Token:
957
+ - testing
958
+ User-Token:
959
+ - ccf383df139c9e919db560bdbddf684af1d7d8b69783da94b19acb5340375626
960
+ Service-User-Id:
961
+ - 2c7751fe8260cb792c53cd281b6889c2e464256dfe64e55db62b16f703726b12
962
+ Accept-Encoding:
963
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
964
+ Accept:
965
+ - "*/*"
966
+ response:
967
+ status:
968
+ code: 200
969
+ message: 'OK '
970
+ headers:
971
+ X-Frame-Options:
972
+ - SAMEORIGIN
973
+ X-Xss-Protection:
974
+ - 1; mode=block
975
+ X-Content-Type-Options:
976
+ - nosniff
977
+ X-Ua-Compatible:
978
+ - chrome=1
979
+ Content-Type:
980
+ - application/json; charset=utf-8
981
+ Etag:
982
+ - '"cd727c0ba392005a102fbf8dc32be000"'
983
+ Cache-Control:
984
+ - max-age=0, private, must-revalidate
985
+ X-Request-Id:
986
+ - a9cd1d7c-832d-4ebd-a77c-fe6c2dc10197
987
+ X-Runtime:
988
+ - '0.005833'
989
+ Server:
990
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
991
+ Date:
992
+ - Sat, 17 Jan 2015 14:16:35 GMT
993
+ Content-Length:
994
+ - '479'
995
+ Connection:
996
+ - Keep-Alive
997
+ body:
998
+ encoding: UTF-8
999
+ string: |-
1000
+ {
1001
+ "_links": {
1002
+ "self": {
1003
+ "href": "http://localhost:3000/"
1004
+ },
1005
+ "surveys": {
1006
+ "href": "http://localhost:3000/api/surveys{/id}{?query*}"
1007
+ },
1008
+ "users": {
1009
+ "href": "http://localhost:3000/api/user{/id}{?query*}"
1010
+ },
1011
+ "questions": {
1012
+ "href": "http://localhost:3000/api/questions{/id}{?query*}"
1013
+ },
1014
+ "survey_questions": {
1015
+ "href": "http://localhost:3000/api/questions/surveys/{survey_id}/survey_questions{/id}{?query*}"
1016
+ }
1017
+ }
1018
+ }
1019
+ http_version:
1020
+ recorded_at: Sat, 17 Jan 2015 14:16:35 GMT
1021
+ recorded_with: VCR 2.9.3