poptart 0.0.8 → 0.0.9
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 +1 -1
- data/lib/poptart/model.rb +11 -13
- data/lib/poptart/range_question.rb +1 -1
- data/lib/poptart/survey.rb +1 -2
- data/lib/poptart/survey_question.rb +8 -3
- data/lib/poptart/time_question.rb +9 -0
- data/lib/poptart/user.rb +3 -1
- data/lib/poptart.rb +1 -0
- data/lib/version.rb +1 -1
- data/spec/requests/answering_survey_questions_spec.rb +3 -27
- data/spec/requests/answers_spec.rb +11 -13
- data/spec/requests/user_management_spec.rb +0 -2
- data/spec/vcr/answering/survey_questions_answers_a_multiple_choice_question.yml +6606 -3251
- data/spec/vcr/answering/survey_questions_answers_a_survey_question.yml +18354 -6356
- data/spec/vcr/answering/survey_questions_creates_and_returns_a_random_question_survey.yml +1223 -387
- data/spec/vcr/answering/survey_questions_creates_and_returns_an_empty_survey.yml +331 -183
- data/spec/vcr/answering/survey_questions_finds_survey_question_for_id.yml +1475 -403
- data/spec/vcr/creating/quesitons_returns_boolean_question.yml +66 -0
- data/spec/vcr/creating/quesitons_returns_multiple_question.yml +90 -21
- data/spec/vcr/creating/quesitons_returns_range_question.yml +92 -23
- data/spec/vcr/retrieving/answers_returns_all_answered_survey_questions_for_a_question.yml +7543 -0
- data/spec/vcr/retrieving/answers_returns_answers.yml +1956 -84
- data/spec/vcr/user/management_creates_a_user.yml +26 -27
- data/spec/vcr/user/management_returns_a_user.yml +186 -63
- metadata +5 -4
- data/spec/requests/root_spec.rb +0 -11
@@ -204,4 +204,70 @@ http_interactions:
|
|
204
204
|
}
|
205
205
|
http_version:
|
206
206
|
recorded_at: Sun, 28 Sep 2014 14:43:00 GMT
|
207
|
+
- request:
|
208
|
+
method: post
|
209
|
+
uri: http://localhost:3000/api/questions
|
210
|
+
body:
|
211
|
+
encoding: UTF-8
|
212
|
+
string: '{"question":{"question_type":"boolean","responses":[true,false],"text":"Do
|
213
|
+
you like poptarts?","freeform":true,"absolute_index":10,"parent_question_id":42}}'
|
214
|
+
headers:
|
215
|
+
User-Agent:
|
216
|
+
- Faraday v0.9.0
|
217
|
+
Content-Type:
|
218
|
+
- application/json
|
219
|
+
Api-Token:
|
220
|
+
- testing
|
221
|
+
Accept-Encoding:
|
222
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
223
|
+
Accept:
|
224
|
+
- "*/*"
|
225
|
+
response:
|
226
|
+
status:
|
227
|
+
code: 201
|
228
|
+
message: 'Created '
|
229
|
+
headers:
|
230
|
+
X-Frame-Options:
|
231
|
+
- SAMEORIGIN
|
232
|
+
X-Xss-Protection:
|
233
|
+
- 1; mode=block
|
234
|
+
X-Content-Type-Options:
|
235
|
+
- nosniff
|
236
|
+
X-Ua-Compatible:
|
237
|
+
- chrome=1
|
238
|
+
Content-Type:
|
239
|
+
- application/json; charset=utf-8
|
240
|
+
Etag:
|
241
|
+
- '"3130a99e318b2e14b38856d2053fffc7"'
|
242
|
+
Cache-Control:
|
243
|
+
- max-age=0, private, must-revalidate
|
244
|
+
X-Request-Id:
|
245
|
+
- 021a1834-9370-4af6-bf2e-80cf242e039f
|
246
|
+
X-Runtime:
|
247
|
+
- '0.009701'
|
248
|
+
Server:
|
249
|
+
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
250
|
+
Date:
|
251
|
+
- Sun, 05 Oct 2014 12:55:10 GMT
|
252
|
+
Content-Length:
|
253
|
+
- '194'
|
254
|
+
Connection:
|
255
|
+
- Keep-Alive
|
256
|
+
body:
|
257
|
+
encoding: UTF-8
|
258
|
+
string: |-
|
259
|
+
{
|
260
|
+
"id": 110,
|
261
|
+
"question_type": "boolean",
|
262
|
+
"text": "Do you like poptarts?",
|
263
|
+
"responses": [
|
264
|
+
true,
|
265
|
+
false
|
266
|
+
],
|
267
|
+
"freeform": true,
|
268
|
+
"absolute_index": 10,
|
269
|
+
"parent_question_id": 42
|
270
|
+
}
|
271
|
+
http_version:
|
272
|
+
recorded_at: Sun, 05 Oct 2014 12:55:10 GMT
|
207
273
|
recorded_with: VCR 2.6.0
|
@@ -37,13 +37,13 @@ http_interactions:
|
|
37
37
|
Cache-Control:
|
38
38
|
- max-age=0, private, must-revalidate
|
39
39
|
X-Request-Id:
|
40
|
-
-
|
40
|
+
- b2e0b3de-668e-4651-9171-f789217b0f5a
|
41
41
|
X-Runtime:
|
42
|
-
- '0.
|
42
|
+
- '0.003826'
|
43
43
|
Server:
|
44
44
|
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
45
45
|
Date:
|
46
|
-
- Sun, 28 Sep 2014 14:
|
46
|
+
- Sun, 28 Sep 2014 14:43:00 GMT
|
47
47
|
Content-Length:
|
48
48
|
- '236'
|
49
49
|
Connection:
|
@@ -68,7 +68,73 @@ http_interactions:
|
|
68
68
|
}
|
69
69
|
}
|
70
70
|
http_version:
|
71
|
-
recorded_at: Sun, 28 Sep 2014 14:
|
71
|
+
recorded_at: Sun, 28 Sep 2014 14:43:00 GMT
|
72
|
+
- request:
|
73
|
+
method: post
|
74
|
+
uri: http://localhost:3000/api/questions/
|
75
|
+
body:
|
76
|
+
encoding: UTF-8
|
77
|
+
string: '{"question":{"question_type":"multiple","responses":["Yes","No"],"text":"Do
|
78
|
+
you like poptarts?","freeform":false,"absolute_index":null,"parent_question_id":null}}'
|
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: 201
|
93
|
+
message: 'Created '
|
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
|
+
- '"f6e5852ba4f14e962fb6195400ec85d2"'
|
107
|
+
Cache-Control:
|
108
|
+
- max-age=0, private, must-revalidate
|
109
|
+
X-Request-Id:
|
110
|
+
- 5a358303-e7ac-4e00-88b7-6bbcab11a400
|
111
|
+
X-Runtime:
|
112
|
+
- '0.008645'
|
113
|
+
Server:
|
114
|
+
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
115
|
+
Date:
|
116
|
+
- Sun, 28 Sep 2014 14:43:00 GMT
|
117
|
+
Content-Length:
|
118
|
+
- '199'
|
119
|
+
Connection:
|
120
|
+
- Keep-Alive
|
121
|
+
body:
|
122
|
+
encoding: UTF-8
|
123
|
+
string: |-
|
124
|
+
{
|
125
|
+
"id": 83,
|
126
|
+
"question_type": "multiple",
|
127
|
+
"text": "Do you like poptarts?",
|
128
|
+
"responses": [
|
129
|
+
"Yes",
|
130
|
+
"No"
|
131
|
+
],
|
132
|
+
"freeform": false,
|
133
|
+
"absolute_index": null,
|
134
|
+
"parent_question_id": null
|
135
|
+
}
|
136
|
+
http_version:
|
137
|
+
recorded_at: Sun, 28 Sep 2014 14:43:00 GMT
|
72
138
|
- request:
|
73
139
|
method: get
|
74
140
|
uri: http://localhost:3000/
|
@@ -102,19 +168,19 @@ http_interactions:
|
|
102
168
|
Content-Type:
|
103
169
|
- application/json; charset=utf-8
|
104
170
|
Etag:
|
105
|
-
- '"
|
171
|
+
- '"2aa11a1ab77b139e58f765299f923a01"'
|
106
172
|
Cache-Control:
|
107
173
|
- max-age=0, private, must-revalidate
|
108
174
|
X-Request-Id:
|
109
|
-
-
|
175
|
+
- 4c1c3e3a-66f0-49dd-980b-f806ee7cc808
|
110
176
|
X-Runtime:
|
111
|
-
- '0.
|
177
|
+
- '0.004584'
|
112
178
|
Server:
|
113
179
|
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
114
180
|
Date:
|
115
|
-
- Sun,
|
181
|
+
- Sun, 05 Oct 2014 12:55:10 GMT
|
116
182
|
Content-Length:
|
117
|
-
- '
|
183
|
+
- '469'
|
118
184
|
Connection:
|
119
185
|
- Keep-Alive
|
120
186
|
body:
|
@@ -126,21 +192,24 @@ http_interactions:
|
|
126
192
|
"href": "http://localhost:3000/"
|
127
193
|
},
|
128
194
|
"surveys": {
|
129
|
-
"href": "api/surveys"
|
195
|
+
"href": "http://localhost:3000/api/surveys{/id}{?query*}"
|
130
196
|
},
|
131
197
|
"users": {
|
132
|
-
"href": "api/users"
|
198
|
+
"href": "http://localhost:3000/api/users{/id}{?query*}"
|
133
199
|
},
|
134
200
|
"questions": {
|
135
|
-
"href": "api/questions"
|
201
|
+
"href": "http://localhost:3000/api/questions{/id}{?query*}"
|
202
|
+
},
|
203
|
+
"survey_questions": {
|
204
|
+
"href": "http://localhost:3000/api/questions{/question_id}/survey_questions{?query*}"
|
136
205
|
}
|
137
206
|
}
|
138
207
|
}
|
139
208
|
http_version:
|
140
|
-
recorded_at: Sun,
|
209
|
+
recorded_at: Sun, 05 Oct 2014 12:55:10 GMT
|
141
210
|
- request:
|
142
211
|
method: post
|
143
|
-
uri: http://localhost:3000/api/questions
|
212
|
+
uri: http://localhost:3000/api/questions
|
144
213
|
body:
|
145
214
|
encoding: UTF-8
|
146
215
|
string: '{"question":{"question_type":"multiple","responses":["Yes","No"],"text":"Do
|
@@ -172,26 +241,26 @@ http_interactions:
|
|
172
241
|
Content-Type:
|
173
242
|
- application/json; charset=utf-8
|
174
243
|
Etag:
|
175
|
-
- '"
|
244
|
+
- '"8d90f182735381db4cbb580948d16f52"'
|
176
245
|
Cache-Control:
|
177
246
|
- max-age=0, private, must-revalidate
|
178
247
|
X-Request-Id:
|
179
|
-
-
|
248
|
+
- 4380db29-dd06-4919-9426-d11a8834afd6
|
180
249
|
X-Runtime:
|
181
|
-
- '0.
|
250
|
+
- '0.008300'
|
182
251
|
Server:
|
183
252
|
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
184
253
|
Date:
|
185
|
-
- Sun,
|
254
|
+
- Sun, 05 Oct 2014 12:55:10 GMT
|
186
255
|
Content-Length:
|
187
|
-
- '
|
256
|
+
- '200'
|
188
257
|
Connection:
|
189
258
|
- Keep-Alive
|
190
259
|
body:
|
191
260
|
encoding: UTF-8
|
192
261
|
string: |-
|
193
262
|
{
|
194
|
-
"id":
|
263
|
+
"id": 111,
|
195
264
|
"question_type": "multiple",
|
196
265
|
"text": "Do you like poptarts?",
|
197
266
|
"responses": [
|
@@ -203,5 +272,5 @@ http_interactions:
|
|
203
272
|
"parent_question_id": null
|
204
273
|
}
|
205
274
|
http_version:
|
206
|
-
recorded_at: Sun,
|
275
|
+
recorded_at: Sun, 05 Oct 2014 12:55:10 GMT
|
207
276
|
recorded_with: VCR 2.6.0
|
@@ -37,13 +37,13 @@ http_interactions:
|
|
37
37
|
Cache-Control:
|
38
38
|
- max-age=0, private, must-revalidate
|
39
39
|
X-Request-Id:
|
40
|
-
-
|
40
|
+
- ed064e0b-e136-4ce6-95c8-8e10c88412af
|
41
41
|
X-Runtime:
|
42
|
-
- '0.
|
42
|
+
- '0.004066'
|
43
43
|
Server:
|
44
44
|
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
45
45
|
Date:
|
46
|
-
- Sun, 28 Sep 2014 14:
|
46
|
+
- Sun, 28 Sep 2014 14:33:16 GMT
|
47
47
|
Content-Length:
|
48
48
|
- '236'
|
49
49
|
Connection:
|
@@ -68,7 +68,72 @@ http_interactions:
|
|
68
68
|
}
|
69
69
|
}
|
70
70
|
http_version:
|
71
|
-
recorded_at: Sun, 28 Sep 2014 14:
|
71
|
+
recorded_at: Sun, 28 Sep 2014 14:33:16 GMT
|
72
|
+
- request:
|
73
|
+
method: post
|
74
|
+
uri: http://localhost:3000/api/questions/
|
75
|
+
body:
|
76
|
+
encoding: UTF-8
|
77
|
+
string: '{"question":{"question_type":"range","responses":[0,10],"text":"Do
|
78
|
+
you like poptarts?","freeform":false,"absolute_index":null}}'
|
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: 201
|
93
|
+
message: 'Created '
|
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
|
+
- '"9eef25b486b78af9f95e57c05769d723"'
|
107
|
+
Cache-Control:
|
108
|
+
- max-age=0, private, must-revalidate
|
109
|
+
X-Request-Id:
|
110
|
+
- 066da954-7460-437f-9364-e9b732b438d5
|
111
|
+
X-Runtime:
|
112
|
+
- '0.006798'
|
113
|
+
Server:
|
114
|
+
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
115
|
+
Date:
|
116
|
+
- Sun, 28 Sep 2014 14:33:16 GMT
|
117
|
+
Content-Length:
|
118
|
+
- '160'
|
119
|
+
Connection:
|
120
|
+
- Keep-Alive
|
121
|
+
body:
|
122
|
+
encoding: UTF-8
|
123
|
+
string: |-
|
124
|
+
{
|
125
|
+
"id": 74,
|
126
|
+
"question_type": "range",
|
127
|
+
"text": "Do you like poptarts?",
|
128
|
+
"responses": [
|
129
|
+
0,
|
130
|
+
10
|
131
|
+
],
|
132
|
+
"freeform": false,
|
133
|
+
"absolute_index": null
|
134
|
+
}
|
135
|
+
http_version:
|
136
|
+
recorded_at: Sun, 28 Sep 2014 14:33:16 GMT
|
72
137
|
- request:
|
73
138
|
method: get
|
74
139
|
uri: http://localhost:3000/
|
@@ -102,19 +167,19 @@ http_interactions:
|
|
102
167
|
Content-Type:
|
103
168
|
- application/json; charset=utf-8
|
104
169
|
Etag:
|
105
|
-
- '"
|
170
|
+
- '"2aa11a1ab77b139e58f765299f923a01"'
|
106
171
|
Cache-Control:
|
107
172
|
- max-age=0, private, must-revalidate
|
108
173
|
X-Request-Id:
|
109
|
-
-
|
174
|
+
- 382cdd7e-faf9-4c4c-8683-fdc85bcca8e5
|
110
175
|
X-Runtime:
|
111
|
-
- '0.
|
176
|
+
- '0.005742'
|
112
177
|
Server:
|
113
178
|
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
114
179
|
Date:
|
115
|
-
- Sun,
|
180
|
+
- Sun, 05 Oct 2014 12:55:10 GMT
|
116
181
|
Content-Length:
|
117
|
-
- '
|
182
|
+
- '469'
|
118
183
|
Connection:
|
119
184
|
- Keep-Alive
|
120
185
|
body:
|
@@ -126,25 +191,28 @@ http_interactions:
|
|
126
191
|
"href": "http://localhost:3000/"
|
127
192
|
},
|
128
193
|
"surveys": {
|
129
|
-
"href": "api/surveys"
|
194
|
+
"href": "http://localhost:3000/api/surveys{/id}{?query*}"
|
130
195
|
},
|
131
196
|
"users": {
|
132
|
-
"href": "api/users"
|
197
|
+
"href": "http://localhost:3000/api/users{/id}{?query*}"
|
133
198
|
},
|
134
199
|
"questions": {
|
135
|
-
"href": "api/questions"
|
200
|
+
"href": "http://localhost:3000/api/questions{/id}{?query*}"
|
201
|
+
},
|
202
|
+
"survey_questions": {
|
203
|
+
"href": "http://localhost:3000/api/questions{/question_id}/survey_questions{?query*}"
|
136
204
|
}
|
137
205
|
}
|
138
206
|
}
|
139
207
|
http_version:
|
140
|
-
recorded_at: Sun,
|
208
|
+
recorded_at: Sun, 05 Oct 2014 12:55:10 GMT
|
141
209
|
- request:
|
142
210
|
method: post
|
143
|
-
uri: http://localhost:3000/api/questions
|
211
|
+
uri: http://localhost:3000/api/questions
|
144
212
|
body:
|
145
213
|
encoding: UTF-8
|
146
214
|
string: '{"question":{"question_type":"range","responses":[0,10],"text":"Do
|
147
|
-
you like poptarts?","freeform":false,"absolute_index":null}}'
|
215
|
+
you like poptarts?","freeform":false,"absolute_index":null,"parent_question_id":null}}'
|
148
216
|
headers:
|
149
217
|
User-Agent:
|
150
218
|
- Faraday v0.9.0
|
@@ -172,26 +240,26 @@ http_interactions:
|
|
172
240
|
Content-Type:
|
173
241
|
- application/json; charset=utf-8
|
174
242
|
Etag:
|
175
|
-
- '"
|
243
|
+
- '"60f0cb2372c536abebf75efbca496e49"'
|
176
244
|
Cache-Control:
|
177
245
|
- max-age=0, private, must-revalidate
|
178
246
|
X-Request-Id:
|
179
|
-
-
|
247
|
+
- f67e1ae7-6a2b-438e-b285-363d1133e2a8
|
180
248
|
X-Runtime:
|
181
|
-
- '0.
|
249
|
+
- '0.007468'
|
182
250
|
Server:
|
183
251
|
- WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08)
|
184
252
|
Date:
|
185
|
-
- Sun,
|
253
|
+
- Sun, 05 Oct 2014 12:55:10 GMT
|
186
254
|
Content-Length:
|
187
|
-
- '
|
255
|
+
- '191'
|
188
256
|
Connection:
|
189
257
|
- Keep-Alive
|
190
258
|
body:
|
191
259
|
encoding: UTF-8
|
192
260
|
string: |-
|
193
261
|
{
|
194
|
-
"id":
|
262
|
+
"id": 112,
|
195
263
|
"question_type": "range",
|
196
264
|
"text": "Do you like poptarts?",
|
197
265
|
"responses": [
|
@@ -199,8 +267,9 @@ http_interactions:
|
|
199
267
|
10
|
200
268
|
],
|
201
269
|
"freeform": false,
|
202
|
-
"absolute_index": null
|
270
|
+
"absolute_index": null,
|
271
|
+
"parent_question_id": null
|
203
272
|
}
|
204
273
|
http_version:
|
205
|
-
recorded_at: Sun,
|
274
|
+
recorded_at: Sun, 05 Oct 2014 12:55:10 GMT
|
206
275
|
recorded_with: VCR 2.6.0
|