poptart 0.0.13 → 0.0.14

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.
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,973 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://localhost:3000/api/surveys/111/survey_questions
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"survey_question":{"question_id":103,"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
+ - d1ccee44cd5b5b26105aa6be511290c3f7768bd001c571db872bf8ceae98764e
18
+ Service-User-Id:
19
+ - bacaf39403b5c3393163a37dcf3635daaaf90eca562f3a2f82c57af709624a0e
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
+ - '"395189a163a4a4f3a1b3bb2a3769e5d9"'
41
+ Cache-Control:
42
+ - max-age=0, private, must-revalidate
43
+ X-Request-Id:
44
+ - c29f0e4c-a78c-40bf-b99b-3a0d90fddb9e
45
+ X-Runtime:
46
+ - '0.012239'
47
+ Server:
48
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
49
+ Date:
50
+ - Sun, 25 Jan 2015 14:16:07 GMT
51
+ Content-Length:
52
+ - '623'
53
+ Connection:
54
+ - Keep-Alive
55
+ body:
56
+ encoding: UTF-8
57
+ string: |-
58
+ {
59
+ "id": 66,
60
+ "text": "Do you like poptarts?",
61
+ "question_type": "boolean",
62
+ "responses": [
63
+ "t",
64
+ "f"
65
+ ],
66
+ "answer": null,
67
+ "_links": [
68
+ {
69
+ "rel": "self",
70
+ "href": "http://localhost:3000/api/surveys/111/survey_questions/66",
71
+ "method": "GET"
72
+ },
73
+ {
74
+ "rel": "self",
75
+ "href": "http://localhost:3000/api/surveys/111/survey_questions/66",
76
+ "method": "PUT"
77
+ },
78
+ {
79
+ "rel": "survey",
80
+ "href": "http://localhost:3000/api/surveys/111",
81
+ "method": "GET"
82
+ }
83
+ ],
84
+ "created_at": "2015-01-25T14:16:07.378Z",
85
+ "key": "testingooptarts",
86
+ "question_id": 103
87
+ }
88
+ http_version:
89
+ recorded_at: Sun, 25 Jan 2015 14:16:07 GMT
90
+ - request:
91
+ method: post
92
+ uri: http://localhost:3000/api/surveys/112/survey_questions
93
+ body:
94
+ encoding: UTF-8
95
+ string: '{"survey_question":{"question_id":103,"responses":null}}'
96
+ headers:
97
+ User-Agent:
98
+ - Faraday v0.9.0
99
+ Content-Type:
100
+ - application/json
101
+ Api-Token:
102
+ - testing
103
+ User-Token:
104
+ - d1ccee44cd5b5b26105aa6be511290c3f7768bd001c571db872bf8ceae98764e
105
+ Service-User-Id:
106
+ - bacaf39403b5c3393163a37dcf3635daaaf90eca562f3a2f82c57af709624a0e
107
+ Accept-Encoding:
108
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
109
+ Accept:
110
+ - "*/*"
111
+ response:
112
+ status:
113
+ code: 201
114
+ message: 'Created '
115
+ headers:
116
+ X-Frame-Options:
117
+ - SAMEORIGIN
118
+ X-Xss-Protection:
119
+ - 1; mode=block
120
+ X-Content-Type-Options:
121
+ - nosniff
122
+ X-Ua-Compatible:
123
+ - chrome=1
124
+ Content-Type:
125
+ - application/json; charset=utf-8
126
+ Etag:
127
+ - '"4817953ffff335731bd6d0a38cdd107e"'
128
+ Cache-Control:
129
+ - max-age=0, private, must-revalidate
130
+ X-Request-Id:
131
+ - dd38a52a-136f-4fa6-9a2d-4fc5d058ea51
132
+ X-Runtime:
133
+ - '0.012308'
134
+ Server:
135
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
136
+ Date:
137
+ - Sun, 25 Jan 2015 14:16:07 GMT
138
+ Content-Length:
139
+ - '623'
140
+ Connection:
141
+ - Keep-Alive
142
+ body:
143
+ encoding: UTF-8
144
+ string: |-
145
+ {
146
+ "id": 67,
147
+ "text": "Do you like poptarts?",
148
+ "question_type": "boolean",
149
+ "responses": [
150
+ "t",
151
+ "f"
152
+ ],
153
+ "answer": null,
154
+ "_links": [
155
+ {
156
+ "rel": "self",
157
+ "href": "http://localhost:3000/api/surveys/112/survey_questions/67",
158
+ "method": "GET"
159
+ },
160
+ {
161
+ "rel": "self",
162
+ "href": "http://localhost:3000/api/surveys/112/survey_questions/67",
163
+ "method": "PUT"
164
+ },
165
+ {
166
+ "rel": "survey",
167
+ "href": "http://localhost:3000/api/surveys/112",
168
+ "method": "GET"
169
+ }
170
+ ],
171
+ "created_at": "2015-01-25T14:16:07.429Z",
172
+ "key": "testingooptarts",
173
+ "question_id": 103
174
+ }
175
+ http_version:
176
+ recorded_at: Sun, 25 Jan 2015 14:16:07 GMT
177
+ - request:
178
+ method: put
179
+ uri: http://localhost:3000/api/surveys/111/survey_questions/66
180
+ body:
181
+ encoding: UTF-8
182
+ string: '{"id":66,"survey_question":{"answer":true}}'
183
+ headers:
184
+ User-Agent:
185
+ - Faraday v0.9.0
186
+ Content-Type:
187
+ - application/json
188
+ Api-Token:
189
+ - testing
190
+ User-Token:
191
+ - d1ccee44cd5b5b26105aa6be511290c3f7768bd001c571db872bf8ceae98764e
192
+ Service-User-Id:
193
+ - bacaf39403b5c3393163a37dcf3635daaaf90eca562f3a2f82c57af709624a0e
194
+ Accept-Encoding:
195
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
196
+ Accept:
197
+ - "*/*"
198
+ response:
199
+ status:
200
+ code: 204
201
+ message: 'No Content '
202
+ headers:
203
+ X-Frame-Options:
204
+ - SAMEORIGIN
205
+ X-Xss-Protection:
206
+ - 1; mode=block
207
+ X-Content-Type-Options:
208
+ - nosniff
209
+ X-Ua-Compatible:
210
+ - chrome=1
211
+ Cache-Control:
212
+ - no-cache
213
+ X-Request-Id:
214
+ - 747df6e3-fffd-4f6b-b511-cebfd14e7602
215
+ X-Runtime:
216
+ - '0.011789'
217
+ Server:
218
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
219
+ Date:
220
+ - Sun, 25 Jan 2015 14:16:07 GMT
221
+ Connection:
222
+ - Keep-Alive
223
+ body:
224
+ encoding: UTF-8
225
+ string: ''
226
+ http_version:
227
+ recorded_at: Sun, 25 Jan 2015 14:16:07 GMT
228
+ - request:
229
+ method: put
230
+ uri: http://localhost:3000/api/surveys/112/survey_questions/67
231
+ body:
232
+ encoding: UTF-8
233
+ string: '{"id":67,"survey_question":{"answer":false}}'
234
+ headers:
235
+ User-Agent:
236
+ - Faraday v0.9.0
237
+ Content-Type:
238
+ - application/json
239
+ Api-Token:
240
+ - testing
241
+ User-Token:
242
+ - d1ccee44cd5b5b26105aa6be511290c3f7768bd001c571db872bf8ceae98764e
243
+ Service-User-Id:
244
+ - bacaf39403b5c3393163a37dcf3635daaaf90eca562f3a2f82c57af709624a0e
245
+ Accept-Encoding:
246
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
247
+ Accept:
248
+ - "*/*"
249
+ response:
250
+ status:
251
+ code: 204
252
+ message: 'No Content '
253
+ headers:
254
+ X-Frame-Options:
255
+ - SAMEORIGIN
256
+ X-Xss-Protection:
257
+ - 1; mode=block
258
+ X-Content-Type-Options:
259
+ - nosniff
260
+ X-Ua-Compatible:
261
+ - chrome=1
262
+ Cache-Control:
263
+ - no-cache
264
+ X-Request-Id:
265
+ - 65fd9d40-3314-4bbf-98a2-6a83ec227b86
266
+ X-Runtime:
267
+ - '0.011333'
268
+ Server:
269
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
270
+ Date:
271
+ - Sun, 25 Jan 2015 14:16:07 GMT
272
+ Connection:
273
+ - Keep-Alive
274
+ body:
275
+ encoding: UTF-8
276
+ string: ''
277
+ http_version:
278
+ recorded_at: Sun, 25 Jan 2015 14:16:07 GMT
279
+ - request:
280
+ method: post
281
+ uri: http://localhost:3000/api/questions
282
+ body:
283
+ encoding: UTF-8
284
+ string: '{"question":{"question_type":"boolean","responses":[true,false],"text":"Do
285
+ you like poptarts?","key":"testingooptarts"}}'
286
+ headers:
287
+ User-Agent:
288
+ - Faraday v0.9.0
289
+ Content-Type:
290
+ - application/json
291
+ Api-Token:
292
+ - testing
293
+ User-Token:
294
+ - adf09e9778d3cd37d6bd1e3c2fa5e5d37ca9363c41fb133c4dcac97c8dd86792
295
+ Service-User-Id:
296
+ - 686285afbb8c11b42ce4e788e545efe4c9595ab028c94fce6f4435d14fda4ab3
297
+ Accept-Encoding:
298
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
299
+ Accept:
300
+ - "*/*"
301
+ response:
302
+ status:
303
+ code: 201
304
+ message: 'Created '
305
+ headers:
306
+ X-Frame-Options:
307
+ - SAMEORIGIN
308
+ X-Xss-Protection:
309
+ - 1; mode=block
310
+ X-Content-Type-Options:
311
+ - nosniff
312
+ X-Ua-Compatible:
313
+ - chrome=1
314
+ Content-Type:
315
+ - application/json; charset=utf-8
316
+ Etag:
317
+ - '"66dbb2a7c7dbbafb6a51308348f47ff7"'
318
+ Cache-Control:
319
+ - max-age=0, private, must-revalidate
320
+ X-Request-Id:
321
+ - 41ba850f-20f1-4dcc-8785-9a493e644966
322
+ X-Runtime:
323
+ - '0.007598'
324
+ Server:
325
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
326
+ Date:
327
+ - Sun, 25 Jan 2015 14:16:53 GMT
328
+ Content-Length:
329
+ - '281'
330
+ Connection:
331
+ - Keep-Alive
332
+ body:
333
+ encoding: UTF-8
334
+ string: |-
335
+ {
336
+ "id": 104,
337
+ "question_type": "boolean",
338
+ "text": "Do you like poptarts?",
339
+ "responses": [
340
+ true,
341
+ false
342
+ ],
343
+ "key": "testingooptarts",
344
+ "_links": [
345
+ {
346
+ "rel": "self",
347
+ "href": "http://localhost:3000/api/questions/104",
348
+ "method": "GET"
349
+ }
350
+ ]
351
+ }
352
+ http_version:
353
+ recorded_at: Sun, 25 Jan 2015 14:16:53 GMT
354
+ - request:
355
+ method: post
356
+ uri: http://localhost:3000/api/user
357
+ body:
358
+ encoding: UTF-8
359
+ string: "{}"
360
+ headers:
361
+ User-Agent:
362
+ - Faraday v0.9.0
363
+ Content-Type:
364
+ - application/json
365
+ Api-Token:
366
+ - testing
367
+ User-Token:
368
+ - adf09e9778d3cd37d6bd1e3c2fa5e5d37ca9363c41fb133c4dcac97c8dd86792
369
+ Service-User-Id:
370
+ - 686285afbb8c11b42ce4e788e545efe4c9595ab028c94fce6f4435d14fda4ab3
371
+ Accept-Encoding:
372
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
373
+ Accept:
374
+ - "*/*"
375
+ response:
376
+ status:
377
+ code: 201
378
+ message: 'Created '
379
+ headers:
380
+ X-Frame-Options:
381
+ - SAMEORIGIN
382
+ X-Xss-Protection:
383
+ - 1; mode=block
384
+ X-Content-Type-Options:
385
+ - nosniff
386
+ X-Ua-Compatible:
387
+ - chrome=1
388
+ Content-Type:
389
+ - application/json; charset=utf-8
390
+ Etag:
391
+ - '"8097307f8ea0337cbe3639788483d229"'
392
+ Cache-Control:
393
+ - max-age=0, private, must-revalidate
394
+ X-Request-Id:
395
+ - 2ff894f9-5ef8-47c4-ba0d-9f26ef36dc37
396
+ X-Runtime:
397
+ - '0.007212'
398
+ Server:
399
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
400
+ Date:
401
+ - Sun, 25 Jan 2015 14:16:53 GMT
402
+ Content-Length:
403
+ - '292'
404
+ Connection:
405
+ - Keep-Alive
406
+ body:
407
+ encoding: UTF-8
408
+ string: |-
409
+ {
410
+ "service_user_id": "a1bedf5085a725862ea8ba37f16edc291f742239bd92b23aae90aaa278a1b7b7",
411
+ "_links": [
412
+ {
413
+ "href": "http://localhost:3000/api/user",
414
+ "rel": "self",
415
+ "method": "GET"
416
+ }
417
+ ],
418
+ "token": "57a8137c20771c1e4a800403e745abdfce7ec325af8a59d2934f58508ed5193b"
419
+ }
420
+ http_version:
421
+ recorded_at: Sun, 25 Jan 2015 14:16:53 GMT
422
+ - request:
423
+ method: post
424
+ uri: http://localhost:3000/api/surveys
425
+ body:
426
+ encoding: UTF-8
427
+ string: "{}"
428
+ headers:
429
+ User-Agent:
430
+ - Faraday v0.9.0
431
+ Content-Type:
432
+ - application/json
433
+ Api-Token:
434
+ - testing
435
+ User-Token:
436
+ - 57a8137c20771c1e4a800403e745abdfce7ec325af8a59d2934f58508ed5193b
437
+ Service-User-Id:
438
+ - a1bedf5085a725862ea8ba37f16edc291f742239bd92b23aae90aaa278a1b7b7
439
+ Accept-Encoding:
440
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
441
+ Accept:
442
+ - "*/*"
443
+ response:
444
+ status:
445
+ code: 201
446
+ message: 'Created '
447
+ headers:
448
+ X-Frame-Options:
449
+ - SAMEORIGIN
450
+ X-Xss-Protection:
451
+ - 1; mode=block
452
+ X-Content-Type-Options:
453
+ - nosniff
454
+ X-Ua-Compatible:
455
+ - chrome=1
456
+ Content-Type:
457
+ - application/json; charset=utf-8
458
+ Etag:
459
+ - '"c0d24c35e288eeb5efa27976efa56189"'
460
+ Cache-Control:
461
+ - max-age=0, private, must-revalidate
462
+ X-Request-Id:
463
+ - 5dac4d82-08f0-4aea-86f9-f7284e066875
464
+ X-Runtime:
465
+ - '0.012204'
466
+ Server:
467
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
468
+ Date:
469
+ - Sun, 25 Jan 2015 14:16:53 GMT
470
+ Content-Length:
471
+ - '425'
472
+ Connection:
473
+ - Keep-Alive
474
+ body:
475
+ encoding: UTF-8
476
+ string: |-
477
+ {
478
+ "id": 113,
479
+ "service_user_id": "a1bedf5085a725862ea8ba37f16edc291f742239bd92b23aae90aaa278a1b7b7",
480
+ "_links": [
481
+ {
482
+ "href": "http://localhost:3000/api/surveys/113",
483
+ "rel": "self",
484
+ "method": "GET"
485
+ },
486
+ {
487
+ "href": "http://localhost:3000/api/surveys/113/survey_questions",
488
+ "rel": "survey-questions",
489
+ "method": "POST"
490
+ }
491
+ ],
492
+ "completed": true,
493
+ "survey_questions": [
494
+
495
+ ]
496
+ }
497
+ http_version:
498
+ recorded_at: Sun, 25 Jan 2015 14:16:53 GMT
499
+ - request:
500
+ method: post
501
+ uri: http://localhost:3000/api/surveys/113/survey_questions
502
+ body:
503
+ encoding: UTF-8
504
+ string: '{"survey_question":{"question_id":104,"responses":null}}'
505
+ headers:
506
+ User-Agent:
507
+ - Faraday v0.9.0
508
+ Content-Type:
509
+ - application/json
510
+ Api-Token:
511
+ - testing
512
+ User-Token:
513
+ - 57a8137c20771c1e4a800403e745abdfce7ec325af8a59d2934f58508ed5193b
514
+ Service-User-Id:
515
+ - a1bedf5085a725862ea8ba37f16edc291f742239bd92b23aae90aaa278a1b7b7
516
+ Accept-Encoding:
517
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
518
+ Accept:
519
+ - "*/*"
520
+ response:
521
+ status:
522
+ code: 201
523
+ message: 'Created '
524
+ headers:
525
+ X-Frame-Options:
526
+ - SAMEORIGIN
527
+ X-Xss-Protection:
528
+ - 1; mode=block
529
+ X-Content-Type-Options:
530
+ - nosniff
531
+ X-Ua-Compatible:
532
+ - chrome=1
533
+ Content-Type:
534
+ - application/json; charset=utf-8
535
+ Etag:
536
+ - '"5a83cc99a5f45faed21360bedc33c723"'
537
+ Cache-Control:
538
+ - max-age=0, private, must-revalidate
539
+ X-Request-Id:
540
+ - c0ec3393-922f-4ea9-b6b4-a93b5a0e0181
541
+ X-Runtime:
542
+ - '0.018167'
543
+ Server:
544
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
545
+ Date:
546
+ - Sun, 25 Jan 2015 14:16:53 GMT
547
+ Content-Length:
548
+ - '623'
549
+ Connection:
550
+ - Keep-Alive
551
+ body:
552
+ encoding: UTF-8
553
+ string: |-
554
+ {
555
+ "id": 68,
556
+ "text": "Do you like poptarts?",
557
+ "question_type": "boolean",
558
+ "responses": [
559
+ "t",
560
+ "f"
561
+ ],
562
+ "answer": null,
563
+ "_links": [
564
+ {
565
+ "rel": "self",
566
+ "href": "http://localhost:3000/api/surveys/113/survey_questions/68",
567
+ "method": "GET"
568
+ },
569
+ {
570
+ "rel": "self",
571
+ "href": "http://localhost:3000/api/surveys/113/survey_questions/68",
572
+ "method": "PUT"
573
+ },
574
+ {
575
+ "rel": "survey",
576
+ "href": "http://localhost:3000/api/surveys/113",
577
+ "method": "GET"
578
+ }
579
+ ],
580
+ "created_at": "2015-01-25T14:16:53.617Z",
581
+ "key": "testingooptarts",
582
+ "question_id": 104
583
+ }
584
+ http_version:
585
+ recorded_at: Sun, 25 Jan 2015 14:16:53 GMT
586
+ - request:
587
+ method: post
588
+ uri: http://localhost:3000/api/surveys
589
+ body:
590
+ encoding: UTF-8
591
+ string: "{}"
592
+ headers:
593
+ User-Agent:
594
+ - Faraday v0.9.0
595
+ Content-Type:
596
+ - application/json
597
+ Api-Token:
598
+ - testing
599
+ User-Token:
600
+ - 57a8137c20771c1e4a800403e745abdfce7ec325af8a59d2934f58508ed5193b
601
+ Service-User-Id:
602
+ - a1bedf5085a725862ea8ba37f16edc291f742239bd92b23aae90aaa278a1b7b7
603
+ Accept-Encoding:
604
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
605
+ Accept:
606
+ - "*/*"
607
+ response:
608
+ status:
609
+ code: 201
610
+ message: 'Created '
611
+ headers:
612
+ X-Frame-Options:
613
+ - SAMEORIGIN
614
+ X-Xss-Protection:
615
+ - 1; mode=block
616
+ X-Content-Type-Options:
617
+ - nosniff
618
+ X-Ua-Compatible:
619
+ - chrome=1
620
+ Content-Type:
621
+ - application/json; charset=utf-8
622
+ Etag:
623
+ - '"6e7536d0aca84b2156856acf55d99bc7"'
624
+ Cache-Control:
625
+ - max-age=0, private, must-revalidate
626
+ X-Request-Id:
627
+ - 44fb76ca-cae8-485d-9b66-ece87effc27c
628
+ X-Runtime:
629
+ - '0.011317'
630
+ Server:
631
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
632
+ Date:
633
+ - Sun, 25 Jan 2015 14:16:53 GMT
634
+ Content-Length:
635
+ - '425'
636
+ Connection:
637
+ - Keep-Alive
638
+ body:
639
+ encoding: UTF-8
640
+ string: |-
641
+ {
642
+ "id": 114,
643
+ "service_user_id": "a1bedf5085a725862ea8ba37f16edc291f742239bd92b23aae90aaa278a1b7b7",
644
+ "_links": [
645
+ {
646
+ "href": "http://localhost:3000/api/surveys/114",
647
+ "rel": "self",
648
+ "method": "GET"
649
+ },
650
+ {
651
+ "href": "http://localhost:3000/api/surveys/114/survey_questions",
652
+ "rel": "survey-questions",
653
+ "method": "POST"
654
+ }
655
+ ],
656
+ "completed": true,
657
+ "survey_questions": [
658
+
659
+ ]
660
+ }
661
+ http_version:
662
+ recorded_at: Sun, 25 Jan 2015 14:16:53 GMT
663
+ - request:
664
+ method: post
665
+ uri: http://localhost:3000/api/surveys/114/survey_questions
666
+ body:
667
+ encoding: UTF-8
668
+ string: '{"survey_question":{"question_id":104,"responses":null}}'
669
+ headers:
670
+ User-Agent:
671
+ - Faraday v0.9.0
672
+ Content-Type:
673
+ - application/json
674
+ Api-Token:
675
+ - testing
676
+ User-Token:
677
+ - 57a8137c20771c1e4a800403e745abdfce7ec325af8a59d2934f58508ed5193b
678
+ Service-User-Id:
679
+ - a1bedf5085a725862ea8ba37f16edc291f742239bd92b23aae90aaa278a1b7b7
680
+ Accept-Encoding:
681
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
682
+ Accept:
683
+ - "*/*"
684
+ response:
685
+ status:
686
+ code: 201
687
+ message: 'Created '
688
+ headers:
689
+ X-Frame-Options:
690
+ - SAMEORIGIN
691
+ X-Xss-Protection:
692
+ - 1; mode=block
693
+ X-Content-Type-Options:
694
+ - nosniff
695
+ X-Ua-Compatible:
696
+ - chrome=1
697
+ Content-Type:
698
+ - application/json; charset=utf-8
699
+ Etag:
700
+ - '"ad8073ecdfa0d8af737f684933dca49e"'
701
+ Cache-Control:
702
+ - max-age=0, private, must-revalidate
703
+ X-Request-Id:
704
+ - e5cf5dc0-f062-4e5f-aa92-01ac3f04c70b
705
+ X-Runtime:
706
+ - '0.012292'
707
+ Server:
708
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
709
+ Date:
710
+ - Sun, 25 Jan 2015 14:16:53 GMT
711
+ Content-Length:
712
+ - '623'
713
+ Connection:
714
+ - Keep-Alive
715
+ body:
716
+ encoding: UTF-8
717
+ string: |-
718
+ {
719
+ "id": 69,
720
+ "text": "Do you like poptarts?",
721
+ "question_type": "boolean",
722
+ "responses": [
723
+ "t",
724
+ "f"
725
+ ],
726
+ "answer": null,
727
+ "_links": [
728
+ {
729
+ "rel": "self",
730
+ "href": "http://localhost:3000/api/surveys/114/survey_questions/69",
731
+ "method": "GET"
732
+ },
733
+ {
734
+ "rel": "self",
735
+ "href": "http://localhost:3000/api/surveys/114/survey_questions/69",
736
+ "method": "PUT"
737
+ },
738
+ {
739
+ "rel": "survey",
740
+ "href": "http://localhost:3000/api/surveys/114",
741
+ "method": "GET"
742
+ }
743
+ ],
744
+ "created_at": "2015-01-25T14:16:53.658Z",
745
+ "key": "testingooptarts",
746
+ "question_id": 104
747
+ }
748
+ http_version:
749
+ recorded_at: Sun, 25 Jan 2015 14:16:53 GMT
750
+ - request:
751
+ method: put
752
+ uri: http://localhost:3000/api/surveys/113/survey_questions/68
753
+ body:
754
+ encoding: UTF-8
755
+ string: '{"id":68,"survey_question":{"answer":true}}'
756
+ headers:
757
+ User-Agent:
758
+ - Faraday v0.9.0
759
+ Content-Type:
760
+ - application/json
761
+ Api-Token:
762
+ - testing
763
+ User-Token:
764
+ - 57a8137c20771c1e4a800403e745abdfce7ec325af8a59d2934f58508ed5193b
765
+ Service-User-Id:
766
+ - a1bedf5085a725862ea8ba37f16edc291f742239bd92b23aae90aaa278a1b7b7
767
+ Accept-Encoding:
768
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
769
+ Accept:
770
+ - "*/*"
771
+ response:
772
+ status:
773
+ code: 204
774
+ message: 'No Content '
775
+ headers:
776
+ X-Frame-Options:
777
+ - SAMEORIGIN
778
+ X-Xss-Protection:
779
+ - 1; mode=block
780
+ X-Content-Type-Options:
781
+ - nosniff
782
+ X-Ua-Compatible:
783
+ - chrome=1
784
+ Cache-Control:
785
+ - no-cache
786
+ X-Request-Id:
787
+ - 3ff4cad0-9c83-4845-9e48-c1b3f38982a7
788
+ X-Runtime:
789
+ - '0.027202'
790
+ Server:
791
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
792
+ Date:
793
+ - Sun, 25 Jan 2015 14:16:53 GMT
794
+ Connection:
795
+ - Keep-Alive
796
+ body:
797
+ encoding: UTF-8
798
+ string: ''
799
+ http_version:
800
+ recorded_at: Sun, 25 Jan 2015 14:16:53 GMT
801
+ - request:
802
+ method: put
803
+ uri: http://localhost:3000/api/surveys/114/survey_questions/69
804
+ body:
805
+ encoding: UTF-8
806
+ string: '{"id":69,"survey_question":{"answer":false}}'
807
+ headers:
808
+ User-Agent:
809
+ - Faraday v0.9.0
810
+ Content-Type:
811
+ - application/json
812
+ Api-Token:
813
+ - testing
814
+ User-Token:
815
+ - 57a8137c20771c1e4a800403e745abdfce7ec325af8a59d2934f58508ed5193b
816
+ Service-User-Id:
817
+ - a1bedf5085a725862ea8ba37f16edc291f742239bd92b23aae90aaa278a1b7b7
818
+ Accept-Encoding:
819
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
820
+ Accept:
821
+ - "*/*"
822
+ response:
823
+ status:
824
+ code: 204
825
+ message: 'No Content '
826
+ headers:
827
+ X-Frame-Options:
828
+ - SAMEORIGIN
829
+ X-Xss-Protection:
830
+ - 1; mode=block
831
+ X-Content-Type-Options:
832
+ - nosniff
833
+ X-Ua-Compatible:
834
+ - chrome=1
835
+ Cache-Control:
836
+ - no-cache
837
+ X-Request-Id:
838
+ - 76ae67b2-cd98-4670-bb35-b12920079d9c
839
+ X-Runtime:
840
+ - '0.011478'
841
+ Server:
842
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
843
+ Date:
844
+ - Sun, 25 Jan 2015 14:16:53 GMT
845
+ Connection:
846
+ - Keep-Alive
847
+ body:
848
+ encoding: UTF-8
849
+ string: ''
850
+ http_version:
851
+ recorded_at: Sun, 25 Jan 2015 14:16:53 GMT
852
+ - request:
853
+ method: get
854
+ uri: http://localhost:3000/api/survey_questions?key=testingooptarts
855
+ body:
856
+ encoding: US-ASCII
857
+ string: ''
858
+ headers:
859
+ User-Agent:
860
+ - Faraday v0.9.0
861
+ Content-Type:
862
+ - application/json
863
+ Api-Token:
864
+ - testing
865
+ User-Token:
866
+ - 57a8137c20771c1e4a800403e745abdfce7ec325af8a59d2934f58508ed5193b
867
+ Service-User-Id:
868
+ - a1bedf5085a725862ea8ba37f16edc291f742239bd92b23aae90aaa278a1b7b7
869
+ Accept-Encoding:
870
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
871
+ Accept:
872
+ - "*/*"
873
+ response:
874
+ status:
875
+ code: 200
876
+ message: 'OK '
877
+ headers:
878
+ X-Frame-Options:
879
+ - SAMEORIGIN
880
+ X-Xss-Protection:
881
+ - 1; mode=block
882
+ X-Content-Type-Options:
883
+ - nosniff
884
+ X-Ua-Compatible:
885
+ - chrome=1
886
+ Content-Type:
887
+ - application/json; charset=utf-8
888
+ Etag:
889
+ - '"cbf9609946e47dcb0863919e6fe43a61"'
890
+ Cache-Control:
891
+ - max-age=0, private, must-revalidate
892
+ X-Request-Id:
893
+ - 5dd48155-7ad7-49ce-9203-2c7bcaf0a6cf
894
+ X-Runtime:
895
+ - '0.021791'
896
+ Server:
897
+ - WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
898
+ Date:
899
+ - Sun, 25 Jan 2015 14:16:53 GMT
900
+ Content-Length:
901
+ - '1518'
902
+ Connection:
903
+ - Keep-Alive
904
+ body:
905
+ encoding: UTF-8
906
+ string: |-
907
+ {
908
+ "survey_questions": [
909
+ {
910
+ "id": 68,
911
+ "text": "Do you like poptarts?",
912
+ "question_type": "boolean",
913
+ "responses": [
914
+ "t",
915
+ "f"
916
+ ],
917
+ "answer": "t",
918
+ "_links": [
919
+ {
920
+ "rel": "self",
921
+ "href": "http://localhost:3000/api/surveys/113/survey_questions/68",
922
+ "method": "GET"
923
+ },
924
+ {
925
+ "rel": "self",
926
+ "href": "http://localhost:3000/api/surveys/113/survey_questions/68",
927
+ "method": "PUT"
928
+ },
929
+ {
930
+ "rel": "survey",
931
+ "href": "http://localhost:3000/api/surveys/113",
932
+ "method": "GET"
933
+ }
934
+ ],
935
+ "created_at": "2015-01-25T14:16:53.617Z",
936
+ "key": "testingooptarts",
937
+ "question_id": 104
938
+ },
939
+ {
940
+ "id": 69,
941
+ "text": "Do you like poptarts?",
942
+ "question_type": "boolean",
943
+ "responses": [
944
+ "t",
945
+ "f"
946
+ ],
947
+ "answer": "f",
948
+ "_links": [
949
+ {
950
+ "rel": "self",
951
+ "href": "http://localhost:3000/api/surveys/114/survey_questions/69",
952
+ "method": "GET"
953
+ },
954
+ {
955
+ "rel": "self",
956
+ "href": "http://localhost:3000/api/surveys/114/survey_questions/69",
957
+ "method": "PUT"
958
+ },
959
+ {
960
+ "rel": "survey",
961
+ "href": "http://localhost:3000/api/surveys/114",
962
+ "method": "GET"
963
+ }
964
+ ],
965
+ "created_at": "2015-01-25T14:16:53.658Z",
966
+ "key": "testingooptarts",
967
+ "question_id": 104
968
+ }
969
+ ]
970
+ }
971
+ http_version:
972
+ recorded_at: Sun, 25 Jan 2015 14:16:53 GMT
973
+ recorded_with: VCR 2.9.3