poptart 0.0.1
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 +7 -0
- data/.gitignore +22 -0
- data/.rspec +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +88 -0
- data/README.md +0 -0
- data/Rakefile +18 -0
- data/lib/poptart/.DS_Store +0 -0
- data/lib/poptart/model.rb +17 -0
- data/lib/poptart/question.rb +19 -0
- data/lib/poptart/request.rb +48 -0
- data/lib/poptart/root.rb +11 -0
- data/lib/poptart/survey.rb +37 -0
- data/lib/poptart/survey_question.rb +42 -0
- data/lib/poptart/user.rb +46 -0
- data/lib/poptart.rb +22 -0
- data/lib/version.rb +3 -0
- data/poptart.gemspec +31 -0
- data/spec/requests/answering_survey_questions_spec.rb +56 -0
- data/spec/requests/root_spec.rb +8 -0
- data/spec/requests/user_management_spec.rb +17 -0
- data/spec/spec_helper.rb +68 -0
- data/spec/vcr/answering/survey_questions_answers_a_survey_question.yml +1588 -0
- data/spec/vcr/answering/survey_questions_creates_and_returns_a_random_question_survey.yml +330 -0
- data/spec/vcr/answering/survey_questions_creates_and_returns_an_empty_survey.yml +272 -0
- data/spec/vcr/answering/survey_questions_finds_survey_question_for_id.yml +330 -0
- data/spec/vcr/poptart/root/returns_survey_links.yml +72 -0
- data/spec/vcr/poptart/user/answers_a_survey_question.yml +1580 -0
- data/spec/vcr/poptart/user/creates_a_user.yml +135 -0
- data/spec/vcr/poptart/user/creates_and_returns_a_random_question_survey.yml +341 -0
- data/spec/vcr/poptart/user/creates_and_returns_an_empty_survey.yml +272 -0
- data/spec/vcr/poptart/user/finds_survey_question_for_id.yml +327 -0
- data/spec/vcr/poptart/user/returns_a_user.yml +267 -0
- data/spec/vcr/user/management_creates_a_user.yml +135 -0
- data/spec/vcr/user/management_returns_a_user.yml +267 -0
- data/tags +72 -0
- metadata +266 -0
@@ -0,0 +1,135 @@
|
|
1
|
+
---
|
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
|
+
- 130fb0a2-7e96-44e2-9c32-d07a116af678
|
41
|
+
X-Runtime:
|
42
|
+
- '0.014387'
|
43
|
+
Server:
|
44
|
+
- WEBrick/1.3.1 (Ruby/2.1.1/2014-02-24)
|
45
|
+
Date:
|
46
|
+
- Sun, 25 May 2014 18:41:14 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: Sun, 25 May 2014 18:41:14 GMT
|
72
|
+
- request:
|
73
|
+
method: post
|
74
|
+
uri: http://localhost:3000/api/users
|
75
|
+
body:
|
76
|
+
encoding: UTF-8
|
77
|
+
string: '{"user":{"external_user_id":42}}'
|
78
|
+
headers:
|
79
|
+
User-Agent:
|
80
|
+
- Faraday v0.9.0
|
81
|
+
Content-Type:
|
82
|
+
- application/json
|
83
|
+
Api-Token:
|
84
|
+
- testing
|
85
|
+
Accept-Encoding:
|
86
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
87
|
+
Accept:
|
88
|
+
- "*/*"
|
89
|
+
response:
|
90
|
+
status:
|
91
|
+
code: 201
|
92
|
+
message: 'Created '
|
93
|
+
headers:
|
94
|
+
X-Frame-Options:
|
95
|
+
- SAMEORIGIN
|
96
|
+
X-Xss-Protection:
|
97
|
+
- 1; mode=block
|
98
|
+
X-Content-Type-Options:
|
99
|
+
- nosniff
|
100
|
+
X-Ua-Compatible:
|
101
|
+
- chrome=1
|
102
|
+
Content-Type:
|
103
|
+
- application/json; charset=utf-8
|
104
|
+
Etag:
|
105
|
+
- '"d184de728819d835a4eca754fded4837"'
|
106
|
+
Cache-Control:
|
107
|
+
- max-age=0, private, must-revalidate
|
108
|
+
X-Request-Id:
|
109
|
+
- aad4d56b-f2ad-4cfe-9248-d7c618b1f1e0
|
110
|
+
X-Runtime:
|
111
|
+
- '0.012959'
|
112
|
+
Server:
|
113
|
+
- WEBrick/1.3.1 (Ruby/2.1.1/2014-02-24)
|
114
|
+
Date:
|
115
|
+
- Sun, 25 May 2014 18:41:14 GMT
|
116
|
+
Content-Length:
|
117
|
+
- '275'
|
118
|
+
Connection:
|
119
|
+
- Keep-Alive
|
120
|
+
body:
|
121
|
+
encoding: UTF-8
|
122
|
+
string: |-
|
123
|
+
{
|
124
|
+
"id": 218,
|
125
|
+
"external_user_id": 42,
|
126
|
+
"token": "b1bdb39c61259ee38af9d5f1333af8adb04b818358ce7427d4a49b20b4e9470803ec7aaeebe8d2cb38e48a74007c0c98d582c954ec52ad6f5948ba7da7feb216",
|
127
|
+
"_links": {
|
128
|
+
"self": {
|
129
|
+
"href": "http://localhost:3000/api/users/218"
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
http_version:
|
134
|
+
recorded_at: Sun, 25 May 2014 18:41:14 GMT
|
135
|
+
recorded_with: VCR 2.6.0
|
@@ -0,0 +1,341 @@
|
|
1
|
+
---
|
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
|
+
- a9c20184-7b31-4e0a-b81b-ade0856f4a00
|
41
|
+
X-Runtime:
|
42
|
+
- '0.008398'
|
43
|
+
Server:
|
44
|
+
- WEBrick/1.3.1 (Ruby/2.1.1/2014-02-24)
|
45
|
+
Date:
|
46
|
+
- Sun, 25 May 2014 18:41:14 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: Sun, 25 May 2014 18:41:14 GMT
|
72
|
+
- request:
|
73
|
+
method: post
|
74
|
+
uri: http://localhost:3000/api/users
|
75
|
+
body:
|
76
|
+
encoding: UTF-8
|
77
|
+
string: '{"user":{"external_user_id":42}}'
|
78
|
+
headers:
|
79
|
+
User-Agent:
|
80
|
+
- Faraday v0.9.0
|
81
|
+
Content-Type:
|
82
|
+
- application/json
|
83
|
+
Api-Token:
|
84
|
+
- testing
|
85
|
+
Accept-Encoding:
|
86
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
87
|
+
Accept:
|
88
|
+
- "*/*"
|
89
|
+
response:
|
90
|
+
status:
|
91
|
+
code: 201
|
92
|
+
message: 'Created '
|
93
|
+
headers:
|
94
|
+
X-Frame-Options:
|
95
|
+
- SAMEORIGIN
|
96
|
+
X-Xss-Protection:
|
97
|
+
- 1; mode=block
|
98
|
+
X-Content-Type-Options:
|
99
|
+
- nosniff
|
100
|
+
X-Ua-Compatible:
|
101
|
+
- chrome=1
|
102
|
+
Content-Type:
|
103
|
+
- application/json; charset=utf-8
|
104
|
+
Etag:
|
105
|
+
- '"833d84af8ff8f6646e7a2a085b405536"'
|
106
|
+
Cache-Control:
|
107
|
+
- max-age=0, private, must-revalidate
|
108
|
+
X-Request-Id:
|
109
|
+
- bd757531-d734-4b28-8c13-26fbd04b09b9
|
110
|
+
X-Runtime:
|
111
|
+
- '0.009740'
|
112
|
+
Server:
|
113
|
+
- WEBrick/1.3.1 (Ruby/2.1.1/2014-02-24)
|
114
|
+
Date:
|
115
|
+
- Sun, 25 May 2014 18:41:14 GMT
|
116
|
+
Content-Length:
|
117
|
+
- '275'
|
118
|
+
Connection:
|
119
|
+
- Keep-Alive
|
120
|
+
body:
|
121
|
+
encoding: UTF-8
|
122
|
+
string: |-
|
123
|
+
{
|
124
|
+
"id": 221,
|
125
|
+
"external_user_id": 42,
|
126
|
+
"token": "b1bdb39c61259ee38af9d5f1333af8adb04b818358ce7427d4a49b20b4e9470803ec7aaeebe8d2cb38e48a74007c0c98d582c954ec52ad6f5948ba7da7feb216",
|
127
|
+
"_links": {
|
128
|
+
"self": {
|
129
|
+
"href": "http://localhost:3000/api/users/221"
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
133
|
+
http_version:
|
134
|
+
recorded_at: Sun, 25 May 2014 18:41:14 GMT
|
135
|
+
- request:
|
136
|
+
method: post
|
137
|
+
uri: http://localhost:3000/api/surveys?random=true
|
138
|
+
body:
|
139
|
+
encoding: UTF-8
|
140
|
+
string: '{"survey":{"user_id":221}}'
|
141
|
+
headers:
|
142
|
+
User-Agent:
|
143
|
+
- Faraday v0.9.0
|
144
|
+
Content-Type:
|
145
|
+
- application/json
|
146
|
+
Api-Token:
|
147
|
+
- testing
|
148
|
+
Accept-Encoding:
|
149
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
150
|
+
Accept:
|
151
|
+
- "*/*"
|
152
|
+
response:
|
153
|
+
status:
|
154
|
+
code: 201
|
155
|
+
message: 'Created '
|
156
|
+
headers:
|
157
|
+
X-Frame-Options:
|
158
|
+
- SAMEORIGIN
|
159
|
+
X-Xss-Protection:
|
160
|
+
- 1; mode=block
|
161
|
+
X-Content-Type-Options:
|
162
|
+
- nosniff
|
163
|
+
X-Ua-Compatible:
|
164
|
+
- chrome=1
|
165
|
+
Content-Type:
|
166
|
+
- application/json; charset=utf-8
|
167
|
+
Etag:
|
168
|
+
- '"048210ca6f8c395b9d1955eef2d48ebc"'
|
169
|
+
Cache-Control:
|
170
|
+
- max-age=0, private, must-revalidate
|
171
|
+
X-Request-Id:
|
172
|
+
- 3ba01ccf-7905-4a1d-b2b9-0b848be938ff
|
173
|
+
X-Runtime:
|
174
|
+
- '0.075052'
|
175
|
+
Server:
|
176
|
+
- WEBrick/1.3.1 (Ruby/2.1.1/2014-02-24)
|
177
|
+
Date:
|
178
|
+
- Sun, 25 May 2014 18:41:14 GMT
|
179
|
+
Content-Length:
|
180
|
+
- '4003'
|
181
|
+
Connection:
|
182
|
+
- Keep-Alive
|
183
|
+
body:
|
184
|
+
encoding: UTF-8
|
185
|
+
string: |-
|
186
|
+
{
|
187
|
+
"id": 165,
|
188
|
+
"user_id": 221,
|
189
|
+
"survey_questions": [
|
190
|
+
{
|
191
|
+
"id": 552,
|
192
|
+
"text": "When did you last check Facebook?",
|
193
|
+
"type": "multiple",
|
194
|
+
"responses": [
|
195
|
+
"Right now",
|
196
|
+
"In the last 5 minutes",
|
197
|
+
"In the last 15 minutes",
|
198
|
+
"In the last 30 minutes",
|
199
|
+
"In the last hour",
|
200
|
+
"1-2 hours ago",
|
201
|
+
"3-5 hours ago",
|
202
|
+
"6-12 hours ago",
|
203
|
+
"24 hours ago",
|
204
|
+
"Don't use facebook"
|
205
|
+
],
|
206
|
+
"freeform": false,
|
207
|
+
"_links": {
|
208
|
+
"self": {
|
209
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions/552"
|
210
|
+
},
|
211
|
+
"survey": {
|
212
|
+
"href": "http://localhost:3000/api/surveys/165"
|
213
|
+
},
|
214
|
+
"create": {
|
215
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions"
|
216
|
+
},
|
217
|
+
"submit": {
|
218
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions/552"
|
219
|
+
}
|
220
|
+
}
|
221
|
+
},
|
222
|
+
{
|
223
|
+
"id": 553,
|
224
|
+
"text": "Who are you talking or interacting with?",
|
225
|
+
"type": "multiple",
|
226
|
+
"responses": [
|
227
|
+
"Spouse/partner/significant other",
|
228
|
+
"Children",
|
229
|
+
"Parents",
|
230
|
+
"Other relatives",
|
231
|
+
"Friends",
|
232
|
+
"Acquaintances",
|
233
|
+
"Strangers",
|
234
|
+
"Co-workers",
|
235
|
+
"Customers/students",
|
236
|
+
"Boss"
|
237
|
+
],
|
238
|
+
"freeform": true,
|
239
|
+
"_links": {
|
240
|
+
"self": {
|
241
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions/553"
|
242
|
+
},
|
243
|
+
"survey": {
|
244
|
+
"href": "http://localhost:3000/api/surveys/165"
|
245
|
+
},
|
246
|
+
"create": {
|
247
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions"
|
248
|
+
},
|
249
|
+
"submit": {
|
250
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions/553"
|
251
|
+
}
|
252
|
+
}
|
253
|
+
},
|
254
|
+
{
|
255
|
+
"id": 554,
|
256
|
+
"text": "Have you surprised someone with a gift (including small gifts) in the last week?",
|
257
|
+
"type": "boolean",
|
258
|
+
"responses": [
|
259
|
+
"t",
|
260
|
+
"f"
|
261
|
+
],
|
262
|
+
"freeform": false,
|
263
|
+
"_links": {
|
264
|
+
"self": {
|
265
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions/554"
|
266
|
+
},
|
267
|
+
"survey": {
|
268
|
+
"href": "http://localhost:3000/api/surveys/165"
|
269
|
+
},
|
270
|
+
"create": {
|
271
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions"
|
272
|
+
},
|
273
|
+
"submit": {
|
274
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions/554"
|
275
|
+
}
|
276
|
+
}
|
277
|
+
},
|
278
|
+
{
|
279
|
+
"id": 555,
|
280
|
+
"text": "Do you have to do what you're doing?",
|
281
|
+
"type": "boolean",
|
282
|
+
"responses": [
|
283
|
+
"t",
|
284
|
+
"f"
|
285
|
+
],
|
286
|
+
"freeform": false,
|
287
|
+
"_links": {
|
288
|
+
"self": {
|
289
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions/555"
|
290
|
+
},
|
291
|
+
"survey": {
|
292
|
+
"href": "http://localhost:3000/api/surveys/165"
|
293
|
+
},
|
294
|
+
"create": {
|
295
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions"
|
296
|
+
},
|
297
|
+
"submit": {
|
298
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions/555"
|
299
|
+
}
|
300
|
+
}
|
301
|
+
},
|
302
|
+
{
|
303
|
+
"id": 556,
|
304
|
+
"text": "Are you talking or interacting with anyone?",
|
305
|
+
"type": "boolean",
|
306
|
+
"responses": [
|
307
|
+
"t",
|
308
|
+
"f"
|
309
|
+
],
|
310
|
+
"freeform": false,
|
311
|
+
"_links": {
|
312
|
+
"self": {
|
313
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions/556"
|
314
|
+
},
|
315
|
+
"survey": {
|
316
|
+
"href": "http://localhost:3000/api/surveys/165"
|
317
|
+
},
|
318
|
+
"create": {
|
319
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions"
|
320
|
+
},
|
321
|
+
"submit": {
|
322
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions/556"
|
323
|
+
}
|
324
|
+
}
|
325
|
+
}
|
326
|
+
],
|
327
|
+
"_links": {
|
328
|
+
"self": {
|
329
|
+
"href": "http://localhost:3000/api/surveys/165"
|
330
|
+
},
|
331
|
+
"submit": {
|
332
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions"
|
333
|
+
},
|
334
|
+
"next": {
|
335
|
+
"href": "http://localhost:3000/api/surveys/165/survey_questions/552"
|
336
|
+
}
|
337
|
+
}
|
338
|
+
}
|
339
|
+
http_version:
|
340
|
+
recorded_at: Sun, 25 May 2014 18:41:14 GMT
|
341
|
+
recorded_with: VCR 2.6.0
|