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.
Files changed (39) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.rspec +1 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +3 -0
  6. data/Gemfile +3 -0
  7. data/Gemfile.lock +88 -0
  8. data/README.md +0 -0
  9. data/Rakefile +18 -0
  10. data/lib/poptart/.DS_Store +0 -0
  11. data/lib/poptart/model.rb +17 -0
  12. data/lib/poptart/question.rb +19 -0
  13. data/lib/poptart/request.rb +48 -0
  14. data/lib/poptart/root.rb +11 -0
  15. data/lib/poptart/survey.rb +37 -0
  16. data/lib/poptart/survey_question.rb +42 -0
  17. data/lib/poptart/user.rb +46 -0
  18. data/lib/poptart.rb +22 -0
  19. data/lib/version.rb +3 -0
  20. data/poptart.gemspec +31 -0
  21. data/spec/requests/answering_survey_questions_spec.rb +56 -0
  22. data/spec/requests/root_spec.rb +8 -0
  23. data/spec/requests/user_management_spec.rb +17 -0
  24. data/spec/spec_helper.rb +68 -0
  25. data/spec/vcr/answering/survey_questions_answers_a_survey_question.yml +1588 -0
  26. data/spec/vcr/answering/survey_questions_creates_and_returns_a_random_question_survey.yml +330 -0
  27. data/spec/vcr/answering/survey_questions_creates_and_returns_an_empty_survey.yml +272 -0
  28. data/spec/vcr/answering/survey_questions_finds_survey_question_for_id.yml +330 -0
  29. data/spec/vcr/poptart/root/returns_survey_links.yml +72 -0
  30. data/spec/vcr/poptart/user/answers_a_survey_question.yml +1580 -0
  31. data/spec/vcr/poptart/user/creates_a_user.yml +135 -0
  32. data/spec/vcr/poptart/user/creates_and_returns_a_random_question_survey.yml +341 -0
  33. data/spec/vcr/poptart/user/creates_and_returns_an_empty_survey.yml +272 -0
  34. data/spec/vcr/poptart/user/finds_survey_question_for_id.yml +327 -0
  35. data/spec/vcr/poptart/user/returns_a_user.yml +267 -0
  36. data/spec/vcr/user/management_creates_a_user.yml +135 -0
  37. data/spec/vcr/user/management_returns_a_user.yml +267 -0
  38. data/tags +72 -0
  39. metadata +266 -0
@@ -0,0 +1,330 @@
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
+ - cf4e9afd-65e0-474f-9970-69fb07e567f6
41
+ X-Runtime:
42
+ - '0.007388'
43
+ Server:
44
+ - WEBrick/1.3.1 (Ruby/2.1.1/2014-02-24)
45
+ Date:
46
+ - Mon, 26 May 2014 20:53:53 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: Mon, 26 May 2014 20:53:53 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
+ - '"e16c7bbed0b1feb4277054db861eb316"'
106
+ Cache-Control:
107
+ - max-age=0, private, must-revalidate
108
+ X-Request-Id:
109
+ - 684ddb6a-7660-487d-be18-b977cfa6ec79
110
+ X-Runtime:
111
+ - '0.021671'
112
+ Server:
113
+ - WEBrick/1.3.1 (Ruby/2.1.1/2014-02-24)
114
+ Date:
115
+ - Mon, 26 May 2014 20:53:54 GMT
116
+ Content-Length:
117
+ - '275'
118
+ Connection:
119
+ - Keep-Alive
120
+ body:
121
+ encoding: UTF-8
122
+ string: |-
123
+ {
124
+ "id": 236,
125
+ "external_user_id": 42,
126
+ "token": "38d7d61cc18a56e2c3319db6aa17d8695215db9a8b37a160b3458ba3f2bdd28b8bd25abfea8c133941623bc358e0e2ee42313d598e07a97ac889449279d7b61d",
127
+ "_links": {
128
+ "self": {
129
+ "href": "http://localhost:3000/api/users/236"
130
+ }
131
+ }
132
+ }
133
+ http_version:
134
+ recorded_at: Mon, 26 May 2014 20:53:54 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":236}}'
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
+ - '"3d0dd8b4f11573ea847b3a73f0e1d80e"'
169
+ Cache-Control:
170
+ - max-age=0, private, must-revalidate
171
+ X-Request-Id:
172
+ - 668d282e-a459-4ef6-abeb-dc8bdf89085a
173
+ X-Runtime:
174
+ - '0.065822'
175
+ Server:
176
+ - WEBrick/1.3.1 (Ruby/2.1.1/2014-02-24)
177
+ Date:
178
+ - Mon, 26 May 2014 20:53:54 GMT
179
+ Content-Length:
180
+ - '3739'
181
+ Connection:
182
+ - Keep-Alive
183
+ body:
184
+ encoding: UTF-8
185
+ string: |-
186
+ {
187
+ "id": 192,
188
+ "user_id": 236,
189
+ "survey_questions": [
190
+ {
191
+ "id": 670,
192
+ "text": "Do you have to do what you're doing?",
193
+ "type": "boolean",
194
+ "responses": [
195
+ "t",
196
+ "f"
197
+ ],
198
+ "freeform": false,
199
+ "_links": {
200
+ "self": {
201
+ "href": "http://localhost:3000/api/surveys/192/survey_questions/670"
202
+ },
203
+ "survey": {
204
+ "href": "http://localhost:3000/api/surveys/192"
205
+ },
206
+ "create": {
207
+ "href": "http://localhost:3000/api/surveys/192/survey_questions"
208
+ },
209
+ "submit": {
210
+ "href": "http://localhost:3000/api/surveys/192/survey_questions/670"
211
+ }
212
+ }
213
+ },
214
+ {
215
+ "id": 671,
216
+ "text": "To what extent is what you're doing interesting?",
217
+ "type": "range",
218
+ "responses": [
219
+ "0",
220
+ "10"
221
+ ],
222
+ "freeform": false,
223
+ "_links": {
224
+ "self": {
225
+ "href": "http://localhost:3000/api/surveys/192/survey_questions/671"
226
+ },
227
+ "survey": {
228
+ "href": "http://localhost:3000/api/surveys/192"
229
+ },
230
+ "create": {
231
+ "href": "http://localhost:3000/api/surveys/192/survey_questions"
232
+ },
233
+ "submit": {
234
+ "href": "http://localhost:3000/api/surveys/192/survey_questions/671"
235
+ }
236
+ }
237
+ },
238
+ {
239
+ "id": 672,
240
+ "text": "How hungry or full are you right now?",
241
+ "type": "multiple",
242
+ "responses": [
243
+ "Very hungry",
244
+ "Somewhat hungry",
245
+ "Neither full nor hungry",
246
+ "Somewhat full",
247
+ "Very full"
248
+ ],
249
+ "freeform": false,
250
+ "_links": {
251
+ "self": {
252
+ "href": "http://localhost:3000/api/surveys/192/survey_questions/672"
253
+ },
254
+ "survey": {
255
+ "href": "http://localhost:3000/api/surveys/192"
256
+ },
257
+ "create": {
258
+ "href": "http://localhost:3000/api/surveys/192/survey_questions"
259
+ },
260
+ "submit": {
261
+ "href": "http://localhost:3000/api/surveys/192/survey_questions/672"
262
+ }
263
+ }
264
+ },
265
+ {
266
+ "id": 673,
267
+ "text": "Are you judging or evaluating what you are doing right now (i.e. at the moment just before you were notified?)",
268
+ "type": "multiple",
269
+ "responses": [
270
+ "f",
271
+ "Yes - Negatively",
272
+ "Yes - Neutrally",
273
+ "Yes - Positively"
274
+ ],
275
+ "freeform": false,
276
+ "_links": {
277
+ "self": {
278
+ "href": "http://localhost:3000/api/surveys/192/survey_questions/673"
279
+ },
280
+ "survey": {
281
+ "href": "http://localhost:3000/api/surveys/192"
282
+ },
283
+ "create": {
284
+ "href": "http://localhost:3000/api/surveys/192/survey_questions"
285
+ },
286
+ "submit": {
287
+ "href": "http://localhost:3000/api/surveys/192/survey_questions/673"
288
+ }
289
+ }
290
+ },
291
+ {
292
+ "id": 674,
293
+ "text": "How well did you sleep last night?",
294
+ "type": "range",
295
+ "responses": [
296
+ "0",
297
+ "10"
298
+ ],
299
+ "freeform": false,
300
+ "_links": {
301
+ "self": {
302
+ "href": "http://localhost:3000/api/surveys/192/survey_questions/674"
303
+ },
304
+ "survey": {
305
+ "href": "http://localhost:3000/api/surveys/192"
306
+ },
307
+ "create": {
308
+ "href": "http://localhost:3000/api/surveys/192/survey_questions"
309
+ },
310
+ "submit": {
311
+ "href": "http://localhost:3000/api/surveys/192/survey_questions/674"
312
+ }
313
+ }
314
+ }
315
+ ],
316
+ "_links": {
317
+ "self": {
318
+ "href": "http://localhost:3000/api/surveys/192"
319
+ },
320
+ "submit": {
321
+ "href": "http://localhost:3000/api/surveys/192/survey_questions"
322
+ },
323
+ "next": {
324
+ "href": "http://localhost:3000/api/surveys/192/survey_questions/670"
325
+ }
326
+ }
327
+ }
328
+ http_version:
329
+ recorded_at: Mon, 26 May 2014 20:53:54 GMT
330
+ recorded_with: VCR 2.6.0
@@ -0,0 +1,72 @@
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
+ - e89f895f-6589-4f68-bc0c-7e22209e782a
41
+ X-Runtime:
42
+ - '0.012950'
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
+ recorded_with: VCR 2.6.0