poptart 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/lib/poptart.rb +1 -4
- data/lib/poptart/link.rb +9 -0
- data/lib/poptart/model.rb +13 -29
- data/lib/poptart/question.rb +21 -17
- data/lib/poptart/root.rb +10 -1
- data/lib/poptart/survey.rb +34 -7
- data/lib/poptart/survey_question.rb +32 -12
- data/lib/poptart/user.rb +4 -21
- data/lib/version.rb +1 -1
- data/poptart.gemspec +0 -4
- data/spec/lib/poptart/model_spec.rb +95 -0
- data/spec/lib/poptart/question_spec.rb +47 -0
- data/spec/lib/poptart/root_spec.rb +50 -0
- data/spec/lib/poptart/survey_question_spec.rb +166 -0
- data/spec/lib/poptart/survey_spec.rb +105 -0
- data/spec/lib/poptart/user_spec.rb +45 -0
- data/spec/requests/questions_spec.rb +31 -0
- data/spec/requests/survey_questions_spec.rb +150 -0
- data/spec/requests/surveys_spec.rb +34 -5
- data/spec/requests/{user_management_spec.rb → users_spec.rb} +5 -5
- data/spec/spec_helper.rb +1 -4
- data/spec/vcr/answering/survey_questions_answers_a_multiple_choice_question.yml +1527 -1596
- data/spec/vcr/answering/survey_questions_answers_a_survey_question.yml +2942 -2035
- data/spec/vcr/answering/survey_questions_creates_and_returns_a_random_question_survey.yml +254 -70
- data/spec/vcr/answering/survey_questions_creates_and_returns_an_empty_survey.yml +110 -48
- data/spec/vcr/answering/survey_questions_finds_survey_question_for_id.yml +1618 -286
- data/spec/vcr/poptart/survey/adds_a_question_to_a_survey.yml +1939 -0
- data/spec/vcr/poptart/survey/creates_a_random_survey.yml +318 -0
- data/spec/vcr/poptart/survey/creates_an_empty_survey.yml +702 -0
- data/spec/vcr/poptart/survey/returns_a_survey_by_id.yml +618 -0
- data/spec/vcr/poptart/user/creates_a_user.yml +179 -0
- data/spec/vcr/{user/management_creates_a_user.yml → poptart/user/returns_a_user.yml} +72 -69
- data/spec/vcr/questions/creates_a_question.yml +186 -0
- data/spec/vcr/questions/finds_a_question_by_id.yml +326 -0
- data/spec/vcr/questions/finds_a_question_by_key.yml +144 -0
- data/spec/vcr/questions/returns_all_answered_survey_questions_for_a_question.yml +1021 -0
- data/spec/vcr/retrieving/answers_returns_all_answered_survey_questions_for_a_question.yml +533 -479
- data/spec/vcr/survey/questions_answers_a_multiple_choice_question.yml +1454 -0
- data/spec/vcr/survey/questions_answers_a_survey_question.yml +1772 -0
- data/spec/vcr/survey/questions_creates_and_returns_an_empty_survey.yml +372 -0
- data/spec/vcr/survey/questions_finds_survey_question_for_id.yml +3083 -0
- data/spec/vcr/survey/questions_returns_all_answered_survey_questions_for_a_question.yml +5756 -0
- data/spec/vcr/survey/questions_returns_all_answered_survey_questions_for_a_question_by_key.yml +973 -0
- data/spec/vcr/survey/questions_returns_all_answered_survey_questions_for_a_survey.yml +620 -0
- metadata +55 -72
- data/lib/poptart/boolean_question.rb +0 -14
- data/lib/poptart/multiple_response_question.rb +0 -9
- data/lib/poptart/range_question.rb +0 -9
- data/lib/poptart/time_question.rb +0 -9
- data/spec/requests/answering_survey_questions_spec.rb +0 -79
- data/spec/requests/answers_spec.rb +0 -45
- data/spec/requests/creating_questions_spec.rb +0 -30
@@ -0,0 +1,326 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:3000/api/questions/126
|
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
|
+
- '"9374175e9cb63c39abd0494356d2e2c2"'
|
37
|
+
Cache-Control:
|
38
|
+
- max-age=0, private, must-revalidate
|
39
|
+
X-Request-Id:
|
40
|
+
- dadbca37-4ffb-4104-8006-1eb334115508
|
41
|
+
X-Runtime:
|
42
|
+
- '0.006624'
|
43
|
+
Server:
|
44
|
+
- WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
|
45
|
+
Date:
|
46
|
+
- Sun, 25 Jan 2015 18:11:45 GMT
|
47
|
+
Content-Length:
|
48
|
+
- '271'
|
49
|
+
Connection:
|
50
|
+
- Keep-Alive
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: |-
|
54
|
+
{
|
55
|
+
"id": 126,
|
56
|
+
"question_type": "boolean",
|
57
|
+
"text": "Do you like poptarts?",
|
58
|
+
"responses": [
|
59
|
+
"t",
|
60
|
+
"f"
|
61
|
+
],
|
62
|
+
"key": "poptarts",
|
63
|
+
"_links": [
|
64
|
+
{
|
65
|
+
"rel": "self",
|
66
|
+
"href": "http://localhost:3000/api/questions/126",
|
67
|
+
"method": "GET"
|
68
|
+
}
|
69
|
+
]
|
70
|
+
}
|
71
|
+
http_version:
|
72
|
+
recorded_at: Sun, 25 Jan 2015 18:11:45 GMT
|
73
|
+
- request:
|
74
|
+
method: get
|
75
|
+
uri: http://localhost:3000/
|
76
|
+
body:
|
77
|
+
encoding: US-ASCII
|
78
|
+
string: ''
|
79
|
+
headers:
|
80
|
+
User-Agent:
|
81
|
+
- Faraday v0.9.0
|
82
|
+
Content-Type:
|
83
|
+
- application/json
|
84
|
+
Api-Token:
|
85
|
+
- testing
|
86
|
+
Accept-Encoding:
|
87
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
88
|
+
Accept:
|
89
|
+
- "*/*"
|
90
|
+
response:
|
91
|
+
status:
|
92
|
+
code: 200
|
93
|
+
message: 'OK '
|
94
|
+
headers:
|
95
|
+
X-Frame-Options:
|
96
|
+
- SAMEORIGIN
|
97
|
+
X-Xss-Protection:
|
98
|
+
- 1; mode=block
|
99
|
+
X-Content-Type-Options:
|
100
|
+
- nosniff
|
101
|
+
X-Ua-Compatible:
|
102
|
+
- chrome=1
|
103
|
+
Content-Type:
|
104
|
+
- application/json; charset=utf-8
|
105
|
+
Etag:
|
106
|
+
- '"c49fa44fac8243fd243d3e39b50c87e5"'
|
107
|
+
Cache-Control:
|
108
|
+
- max-age=0, private, must-revalidate
|
109
|
+
X-Request-Id:
|
110
|
+
- 44ec9f2d-6734-4b05-93b8-b5c3b1077f5b
|
111
|
+
X-Runtime:
|
112
|
+
- '0.012862'
|
113
|
+
Server:
|
114
|
+
- WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
|
115
|
+
Date:
|
116
|
+
- Sun, 25 Jan 2015 18:13:28 GMT
|
117
|
+
Content-Length:
|
118
|
+
- '1459'
|
119
|
+
Connection:
|
120
|
+
- Keep-Alive
|
121
|
+
body:
|
122
|
+
encoding: UTF-8
|
123
|
+
string: |-
|
124
|
+
{
|
125
|
+
"_links": [
|
126
|
+
{
|
127
|
+
"href": "http://localhost:3000/",
|
128
|
+
"rel": "self",
|
129
|
+
"method": "GET"
|
130
|
+
},
|
131
|
+
{
|
132
|
+
"href": "http://localhost:3000/api/surveys{/id}{?query*}",
|
133
|
+
"rel": "surveys",
|
134
|
+
"method": "GET"
|
135
|
+
},
|
136
|
+
{
|
137
|
+
"href": "http://localhost:3000/api/surveys",
|
138
|
+
"rel": "surveys",
|
139
|
+
"method": "POST"
|
140
|
+
},
|
141
|
+
{
|
142
|
+
"href": "http://localhost:3000/api/user{/id}{?query*}",
|
143
|
+
"rel": "users",
|
144
|
+
"method": "GET"
|
145
|
+
},
|
146
|
+
{
|
147
|
+
"href": "http://localhost:3000/api/user",
|
148
|
+
"rel": "users",
|
149
|
+
"method": "POST"
|
150
|
+
},
|
151
|
+
{
|
152
|
+
"href": "http://localhost:3000/api/questions{/id}{?query*}",
|
153
|
+
"rel": "questions",
|
154
|
+
"method": "GET"
|
155
|
+
},
|
156
|
+
{
|
157
|
+
"href": "http://localhost:3000/api/questions",
|
158
|
+
"rel": "questions",
|
159
|
+
"method": "POST"
|
160
|
+
},
|
161
|
+
{
|
162
|
+
"href": "http://localhost:3000/api/questions/surveys/{survey_id}/survey_questions{/id}{?query*}",
|
163
|
+
"rel": "survey-questions",
|
164
|
+
"method": "GET"
|
165
|
+
},
|
166
|
+
{
|
167
|
+
"href": "http://localhost:3000/api/questions/surveys/{survey_id}/survey_questions",
|
168
|
+
"rel": "survey-questions",
|
169
|
+
"method": "POST"
|
170
|
+
},
|
171
|
+
{
|
172
|
+
"href": "http://localhost:3000/api/questions/surveys/{survey_id}/survey_questions{/id}",
|
173
|
+
"rel": "survey-questions",
|
174
|
+
"method": "PUT"
|
175
|
+
},
|
176
|
+
{
|
177
|
+
"href": "http://localhost:3000/api/survey_questions{?query*}",
|
178
|
+
"rel": "survey-questions-by-query",
|
179
|
+
"method": "GET"
|
180
|
+
}
|
181
|
+
]
|
182
|
+
}
|
183
|
+
http_version:
|
184
|
+
recorded_at: Sun, 25 Jan 2015 18:13:28 GMT
|
185
|
+
- request:
|
186
|
+
method: post
|
187
|
+
uri: http://localhost:3000/api/questions
|
188
|
+
body:
|
189
|
+
encoding: UTF-8
|
190
|
+
string: '{"question":{"question_type":"boolean","responses":[true,false],"text":"Do
|
191
|
+
you like poptarts?","key":"poptarts"}}'
|
192
|
+
headers:
|
193
|
+
User-Agent:
|
194
|
+
- Faraday v0.9.0
|
195
|
+
Content-Type:
|
196
|
+
- application/json
|
197
|
+
Api-Token:
|
198
|
+
- testing
|
199
|
+
Accept-Encoding:
|
200
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
201
|
+
Accept:
|
202
|
+
- "*/*"
|
203
|
+
response:
|
204
|
+
status:
|
205
|
+
code: 201
|
206
|
+
message: 'Created '
|
207
|
+
headers:
|
208
|
+
X-Frame-Options:
|
209
|
+
- SAMEORIGIN
|
210
|
+
X-Xss-Protection:
|
211
|
+
- 1; mode=block
|
212
|
+
X-Content-Type-Options:
|
213
|
+
- nosniff
|
214
|
+
X-Ua-Compatible:
|
215
|
+
- chrome=1
|
216
|
+
Content-Type:
|
217
|
+
- application/json; charset=utf-8
|
218
|
+
Etag:
|
219
|
+
- '"05f96f770d8a46fa8ff5e0595734d3b8"'
|
220
|
+
Cache-Control:
|
221
|
+
- max-age=0, private, must-revalidate
|
222
|
+
X-Request-Id:
|
223
|
+
- c61479fe-a696-4917-b205-cb5a1ed48e19
|
224
|
+
X-Runtime:
|
225
|
+
- '0.008138'
|
226
|
+
Server:
|
227
|
+
- WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
|
228
|
+
Date:
|
229
|
+
- Sun, 25 Jan 2015 18:13:28 GMT
|
230
|
+
Content-Length:
|
231
|
+
- '274'
|
232
|
+
Connection:
|
233
|
+
- Keep-Alive
|
234
|
+
body:
|
235
|
+
encoding: UTF-8
|
236
|
+
string: |-
|
237
|
+
{
|
238
|
+
"id": 127,
|
239
|
+
"question_type": "boolean",
|
240
|
+
"text": "Do you like poptarts?",
|
241
|
+
"responses": [
|
242
|
+
true,
|
243
|
+
false
|
244
|
+
],
|
245
|
+
"key": "poptarts",
|
246
|
+
"_links": [
|
247
|
+
{
|
248
|
+
"rel": "self",
|
249
|
+
"href": "http://localhost:3000/api/questions/127",
|
250
|
+
"method": "GET"
|
251
|
+
}
|
252
|
+
]
|
253
|
+
}
|
254
|
+
http_version:
|
255
|
+
recorded_at: Sun, 25 Jan 2015 18:13:28 GMT
|
256
|
+
- request:
|
257
|
+
method: get
|
258
|
+
uri: http://localhost:3000/api/questions/127
|
259
|
+
body:
|
260
|
+
encoding: US-ASCII
|
261
|
+
string: ''
|
262
|
+
headers:
|
263
|
+
User-Agent:
|
264
|
+
- Faraday v0.9.0
|
265
|
+
Content-Type:
|
266
|
+
- application/json
|
267
|
+
Api-Token:
|
268
|
+
- testing
|
269
|
+
Accept-Encoding:
|
270
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
271
|
+
Accept:
|
272
|
+
- "*/*"
|
273
|
+
response:
|
274
|
+
status:
|
275
|
+
code: 200
|
276
|
+
message: 'OK '
|
277
|
+
headers:
|
278
|
+
X-Frame-Options:
|
279
|
+
- SAMEORIGIN
|
280
|
+
X-Xss-Protection:
|
281
|
+
- 1; mode=block
|
282
|
+
X-Content-Type-Options:
|
283
|
+
- nosniff
|
284
|
+
X-Ua-Compatible:
|
285
|
+
- chrome=1
|
286
|
+
Content-Type:
|
287
|
+
- application/json; charset=utf-8
|
288
|
+
Etag:
|
289
|
+
- '"46af1f874fe11fb77a4768fb56c15678"'
|
290
|
+
Cache-Control:
|
291
|
+
- max-age=0, private, must-revalidate
|
292
|
+
X-Request-Id:
|
293
|
+
- 470d0dcd-60d4-42dd-8e50-68ee4c53e8a6
|
294
|
+
X-Runtime:
|
295
|
+
- '0.006252'
|
296
|
+
Server:
|
297
|
+
- WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
|
298
|
+
Date:
|
299
|
+
- Sun, 25 Jan 2015 18:13:28 GMT
|
300
|
+
Content-Length:
|
301
|
+
- '271'
|
302
|
+
Connection:
|
303
|
+
- Keep-Alive
|
304
|
+
body:
|
305
|
+
encoding: UTF-8
|
306
|
+
string: |-
|
307
|
+
{
|
308
|
+
"id": 127,
|
309
|
+
"question_type": "boolean",
|
310
|
+
"text": "Do you like poptarts?",
|
311
|
+
"responses": [
|
312
|
+
"t",
|
313
|
+
"f"
|
314
|
+
],
|
315
|
+
"key": "poptarts",
|
316
|
+
"_links": [
|
317
|
+
{
|
318
|
+
"rel": "self",
|
319
|
+
"href": "http://localhost:3000/api/questions/127",
|
320
|
+
"method": "GET"
|
321
|
+
}
|
322
|
+
]
|
323
|
+
}
|
324
|
+
http_version:
|
325
|
+
recorded_at: Sun, 25 Jan 2015 18:13:28 GMT
|
326
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,144 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:3000/api/questions
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"question":{"question_type":"boolean","responses":[true,false],"text":"Do
|
9
|
+
you like poptarts?","key":"poptarts"}}'
|
10
|
+
headers:
|
11
|
+
User-Agent:
|
12
|
+
- Faraday v0.9.0
|
13
|
+
Content-Type:
|
14
|
+
- application/json
|
15
|
+
Api-Token:
|
16
|
+
- testing
|
17
|
+
Accept-Encoding:
|
18
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
19
|
+
Accept:
|
20
|
+
- "*/*"
|
21
|
+
response:
|
22
|
+
status:
|
23
|
+
code: 201
|
24
|
+
message: 'Created '
|
25
|
+
headers:
|
26
|
+
X-Frame-Options:
|
27
|
+
- SAMEORIGIN
|
28
|
+
X-Xss-Protection:
|
29
|
+
- 1; mode=block
|
30
|
+
X-Content-Type-Options:
|
31
|
+
- nosniff
|
32
|
+
X-Ua-Compatible:
|
33
|
+
- chrome=1
|
34
|
+
Content-Type:
|
35
|
+
- application/json; charset=utf-8
|
36
|
+
Etag:
|
37
|
+
- '"29a27f144cef4d18a3326c6661b1bb83"'
|
38
|
+
Cache-Control:
|
39
|
+
- max-age=0, private, must-revalidate
|
40
|
+
X-Request-Id:
|
41
|
+
- f44e45cc-c51c-402e-a22e-e1d8f684d336
|
42
|
+
X-Runtime:
|
43
|
+
- '0.009566'
|
44
|
+
Server:
|
45
|
+
- WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
|
46
|
+
Date:
|
47
|
+
- Sun, 25 Jan 2015 18:13:28 GMT
|
48
|
+
Content-Length:
|
49
|
+
- '274'
|
50
|
+
Connection:
|
51
|
+
- Keep-Alive
|
52
|
+
body:
|
53
|
+
encoding: UTF-8
|
54
|
+
string: |-
|
55
|
+
{
|
56
|
+
"id": 128,
|
57
|
+
"question_type": "boolean",
|
58
|
+
"text": "Do you like poptarts?",
|
59
|
+
"responses": [
|
60
|
+
true,
|
61
|
+
false
|
62
|
+
],
|
63
|
+
"key": "poptarts",
|
64
|
+
"_links": [
|
65
|
+
{
|
66
|
+
"rel": "self",
|
67
|
+
"href": "http://localhost:3000/api/questions/128",
|
68
|
+
"method": "GET"
|
69
|
+
}
|
70
|
+
]
|
71
|
+
}
|
72
|
+
http_version:
|
73
|
+
recorded_at: Sun, 25 Jan 2015 18:13:28 GMT
|
74
|
+
- request:
|
75
|
+
method: get
|
76
|
+
uri: http://localhost:3000/api/questions/poptarts
|
77
|
+
body:
|
78
|
+
encoding: US-ASCII
|
79
|
+
string: ''
|
80
|
+
headers:
|
81
|
+
User-Agent:
|
82
|
+
- Faraday v0.9.0
|
83
|
+
Content-Type:
|
84
|
+
- application/json
|
85
|
+
Api-Token:
|
86
|
+
- testing
|
87
|
+
Accept-Encoding:
|
88
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
89
|
+
Accept:
|
90
|
+
- "*/*"
|
91
|
+
response:
|
92
|
+
status:
|
93
|
+
code: 200
|
94
|
+
message: 'OK '
|
95
|
+
headers:
|
96
|
+
X-Frame-Options:
|
97
|
+
- SAMEORIGIN
|
98
|
+
X-Xss-Protection:
|
99
|
+
- 1; mode=block
|
100
|
+
X-Content-Type-Options:
|
101
|
+
- nosniff
|
102
|
+
X-Ua-Compatible:
|
103
|
+
- chrome=1
|
104
|
+
Content-Type:
|
105
|
+
- application/json; charset=utf-8
|
106
|
+
Etag:
|
107
|
+
- '"e18d1aa81a5e80c3c58f3a8a604024e4"'
|
108
|
+
Cache-Control:
|
109
|
+
- max-age=0, private, must-revalidate
|
110
|
+
X-Request-Id:
|
111
|
+
- 4b02cd22-c9fe-44d2-80e5-94f4f04e9e3a
|
112
|
+
X-Runtime:
|
113
|
+
- '0.006046'
|
114
|
+
Server:
|
115
|
+
- WEBrick/1.3.1 (Ruby/2.1.3/2014-09-19)
|
116
|
+
Date:
|
117
|
+
- Sun, 25 Jan 2015 18:13:28 GMT
|
118
|
+
Content-Length:
|
119
|
+
- '269'
|
120
|
+
Connection:
|
121
|
+
- Keep-Alive
|
122
|
+
body:
|
123
|
+
encoding: UTF-8
|
124
|
+
string: |-
|
125
|
+
{
|
126
|
+
"id": 33,
|
127
|
+
"question_type": "boolean",
|
128
|
+
"text": "Do you like poptarts?",
|
129
|
+
"responses": [
|
130
|
+
"t",
|
131
|
+
"f"
|
132
|
+
],
|
133
|
+
"key": "poptarts",
|
134
|
+
"_links": [
|
135
|
+
{
|
136
|
+
"rel": "self",
|
137
|
+
"href": "http://localhost:3000/api/questions/33",
|
138
|
+
"method": "GET"
|
139
|
+
}
|
140
|
+
]
|
141
|
+
}
|
142
|
+
http_version:
|
143
|
+
recorded_at: Sun, 25 Jan 2015 18:13:28 GMT
|
144
|
+
recorded_with: VCR 2.9.3
|