lti_skydrive 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +20 -0
  4. data/app/assets/fonts/skydrive/font/FontAwesome.otf +0 -0
  5. data/app/assets/fonts/skydrive/font/fontawesome-webfont.eot +0 -0
  6. data/app/assets/fonts/skydrive/font/fontawesome-webfont.svg +399 -0
  7. data/app/assets/fonts/skydrive/font/fontawesome-webfont.ttf +0 -0
  8. data/app/assets/fonts/skydrive/font/fontawesome-webfont.woff +0 -0
  9. data/app/assets/images/skydrive/banner.png +0 -0
  10. data/app/assets/images/skydrive/icon-file.png +0 -0
  11. data/app/assets/images/skydrive/icon-folder-back.png +0 -0
  12. data/app/assets/images/skydrive/icon-folder.png +0 -0
  13. data/app/assets/images/skydrive/icon-jpg.png +0 -0
  14. data/app/assets/images/skydrive/icon-pdf.png +0 -0
  15. data/app/assets/images/skydrive/icon-png.png +0 -0
  16. data/app/assets/images/skydrive/icon-word.png +0 -0
  17. data/app/assets/images/skydrive/logo.png +0 -0
  18. data/app/assets/images/skydrive/office_365.jpg +0 -0
  19. data/app/assets/images/skydrive/skydrive_icon.png +0 -0
  20. data/app/assets/javascripts/skydrive/application.js +16 -0
  21. data/app/assets/javascripts/skydrive/vendor/ember.js +23 -0
  22. data/app/assets/javascripts/skydrive/vendor/handlebars.js +362 -0
  23. data/app/assets/javascripts/skydrive/vendor/jquery.js +9597 -0
  24. data/app/assets/stylesheets/skydrive/app.css +5617 -0
  25. data/app/assets/stylesheets/skydrive/font-awesome/font-awesome.min.css +403 -0
  26. data/app/assets/stylesheets/skydrive/normalize.css +405 -0
  27. data/app/assets/stylesheets/skydrive/style.css +27 -0
  28. data/app/controllers/skydrive/api_keys_controller.rb +13 -0
  29. data/app/controllers/skydrive/application_controller.rb +40 -0
  30. data/app/controllers/skydrive/ember_controller.rb +23 -0
  31. data/app/controllers/skydrive/files_controller.rb +62 -0
  32. data/app/controllers/skydrive/launch_controller.rb +152 -0
  33. data/app/controllers/skydrive/session_controller.rb +12 -0
  34. data/app/controllers/skydrive/users_controller.rb +34 -0
  35. data/app/helpers/skydrive/application_helper.rb +4 -0
  36. data/app/helpers/skydrive/ember_helper.rb +4 -0
  37. data/app/models/skydrive/api_key.rb +47 -0
  38. data/app/models/skydrive/lti_key.rb +10 -0
  39. data/app/models/skydrive/token.rb +14 -0
  40. data/app/models/skydrive/user.rb +28 -0
  41. data/app/serializers/api_key_serializer.rb +5 -0
  42. data/app/serializers/user_serializer.rb +5 -0
  43. data/app/views/layouts/skydrive/application.html.erb +21 -0
  44. data/app/views/skydrive/ember/index.html.erb +20 -0
  45. data/config/initializers/sharepoint.rb +1 -0
  46. data/config/routes.rb +24 -0
  47. data/config/sharepoint.yml.example +17 -0
  48. data/db/migrate/20130710195807_create_users.rb +11 -0
  49. data/db/migrate/20130710195819_create_api_keys.rb +15 -0
  50. data/db/migrate/20130722173006_add_skydrive_token_storage.rb +15 -0
  51. data/db/migrate/20130725183724_add_client_domain_to_skydrive_tokens.rb +5 -0
  52. data/db/migrate/20130726170108_add_personal_url_to_skydrive_token.rb +5 -0
  53. data/db/migrate/20130730164700_add_init_params_to_api_key.rb +5 -0
  54. data/db/migrate/20130801181008_create_lti_keys.rb +9 -0
  55. data/db/migrate/20130802231147_change_skydrive_token_length.rb +6 -0
  56. data/db/migrate/20140103221052_skydrive_namespace.rb +13 -0
  57. data/lib/skydrive/client.rb +161 -0
  58. data/lib/skydrive/engine.rb +16 -0
  59. data/lib/skydrive/file.rb +49 -0
  60. data/lib/skydrive/folder.rb +13 -0
  61. data/lib/skydrive/version.rb +3 -0
  62. data/lib/skydrive.rb +4 -0
  63. data/lib/skydrive_proxy.rb +33 -0
  64. data/lib/tasks/ember.rake +48 -0
  65. data/lib/tasks/lti_key.rake +8 -0
  66. data/test/controllers/skydrive/ember_controller_test.rb +11 -0
  67. data/test/dummy/README.rdoc +28 -0
  68. data/test/dummy/Rakefile +6 -0
  69. data/test/dummy/app/assets/javascripts/application.js +13 -0
  70. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  71. data/test/dummy/app/controllers/application_controller.rb +5 -0
  72. data/test/dummy/app/helpers/application_helper.rb +2 -0
  73. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  74. data/test/dummy/bin/bundle +3 -0
  75. data/test/dummy/bin/rails +4 -0
  76. data/test/dummy/bin/rake +4 -0
  77. data/test/dummy/config/application.rb +25 -0
  78. data/test/dummy/config/boot.rb +5 -0
  79. data/test/dummy/config/database.yml +25 -0
  80. data/test/dummy/config/environment.rb +5 -0
  81. data/test/dummy/config/environments/development.rb +29 -0
  82. data/test/dummy/config/environments/production.rb +80 -0
  83. data/test/dummy/config/environments/test.rb +36 -0
  84. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  85. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  86. data/test/dummy/config/initializers/inflections.rb +16 -0
  87. data/test/dummy/config/initializers/mime_types.rb +5 -0
  88. data/test/dummy/config/initializers/secret_token.rb +12 -0
  89. data/test/dummy/config/initializers/session_store.rb +3 -0
  90. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  91. data/test/dummy/config/locales/en.yml +23 -0
  92. data/test/dummy/config/routes.rb +3 -0
  93. data/test/dummy/config/sharepoint.yml +15 -0
  94. data/test/dummy/config.ru +4 -0
  95. data/test/dummy/db/development.sqlite3 +0 -0
  96. data/test/dummy/db/schema.rb +60 -0
  97. data/test/dummy/db/test.sqlite3 +0 -0
  98. data/test/dummy/log/development.log +6484 -0
  99. data/test/dummy/log/test.log +2958 -0
  100. data/test/dummy/public/404.html +58 -0
  101. data/test/dummy/public/422.html +58 -0
  102. data/test/dummy/public/500.html +57 -0
  103. data/test/dummy/public/favicon.ico +0 -0
  104. data/test/dummy/tmp/cache/assets/development/sprockets/00546f7f6da41f471084ed2589ca4442 +0 -0
  105. data/test/dummy/tmp/cache/assets/development/sprockets/049dac97744466d4435aa8de57cc6099 +0 -0
  106. data/test/dummy/tmp/cache/assets/development/sprockets/0c92f67702b0dbd50edf7e6be63359ca +0 -0
  107. data/test/dummy/tmp/cache/assets/development/sprockets/0d26053221de21901f734bd6ba75bb28 +0 -0
  108. data/test/dummy/tmp/cache/assets/development/sprockets/0e383306a92ebd12d003a9e49ef6d508 +0 -0
  109. data/test/dummy/tmp/cache/assets/development/sprockets/16fa9bed5ef4abda841d3ef00e727580 +0 -0
  110. data/test/dummy/tmp/cache/assets/development/sprockets/17588b92c903e02837946f638eca86db +0 -0
  111. data/test/dummy/tmp/cache/assets/development/sprockets/21900b90dba7acf710178f3cd9dad43b +0 -0
  112. data/test/dummy/tmp/cache/assets/development/sprockets/25efc08f115a66b9c241a48e80a207ca +0 -0
  113. data/test/dummy/tmp/cache/assets/development/sprockets/3064fc29e24c9e97f7aad24f7e899cf6 +0 -0
  114. data/test/dummy/tmp/cache/assets/development/sprockets/311d9a5a43eb3fee9bba76971680620f +0 -0
  115. data/test/dummy/tmp/cache/assets/development/sprockets/35a147c1af5b608250e82ccb2f569d4b +0 -0
  116. data/test/dummy/tmp/cache/assets/development/sprockets/3dd0eb5a85d766c8d9fe5b29014edee4 +0 -0
  117. data/test/dummy/tmp/cache/assets/development/sprockets/63616bfc6c3f0267d5951cbbc83308cd +0 -0
  118. data/test/dummy/tmp/cache/assets/development/sprockets/65aa42ce50eac6f72e31861670f94518 +0 -0
  119. data/test/dummy/tmp/cache/assets/development/sprockets/66a8e9d3d86505dece06e6dd0edd18e1 +0 -0
  120. data/test/dummy/tmp/cache/assets/development/sprockets/78c4cbc0498be843f50ebdd02e2ead2f +0 -0
  121. data/test/dummy/tmp/cache/assets/development/sprockets/7caeca69c3c375c50a3c8cad8584be79 +0 -0
  122. data/test/dummy/tmp/cache/assets/development/sprockets/7d2b5e5332f464f65bf745d12ed9cbaa +0 -0
  123. data/test/dummy/tmp/cache/assets/development/sprockets/7e229ef6d57ba0e9f562cc129a3e4dfc +0 -0
  124. data/test/dummy/tmp/cache/assets/development/sprockets/87149d8992d83d7a95023dbfa4b53907 +0 -0
  125. data/test/dummy/tmp/cache/assets/development/sprockets/8bf6a6b96f5c827206f1fd42babe6c5e +0 -0
  126. data/test/dummy/tmp/cache/assets/development/sprockets/8c2066f7cc911ab8803cab8fea4e8bd6 +0 -0
  127. data/test/dummy/tmp/cache/assets/development/sprockets/9157ff048f219d7abc8b0f0fda771c92 +0 -0
  128. data/test/dummy/tmp/cache/assets/development/sprockets/a17c28776c4a2887f0fff4893854ef1d +0 -0
  129. data/test/dummy/tmp/cache/assets/development/sprockets/a29fed21bbc3985a31325c84a77e5f26 +0 -0
  130. data/test/dummy/tmp/cache/assets/development/sprockets/a3119da5b51c1a0a3c5cb7414ec920f5 +0 -0
  131. data/test/dummy/tmp/cache/assets/development/sprockets/a674526f54bc8458ebe36912ef85f003 +0 -0
  132. data/test/dummy/tmp/cache/assets/development/sprockets/aa904c0cc06f37bb0df493db59f18d70 +0 -0
  133. data/test/dummy/tmp/cache/assets/development/sprockets/adfa454123f4741a4b3919023b570d82 +0 -0
  134. data/test/dummy/tmp/cache/assets/development/sprockets/af6eedeceb4b732776dca83f456b2b93 +0 -0
  135. data/test/dummy/tmp/cache/assets/development/sprockets/b40cb2ddb88705f771e77d872feacf6a +0 -0
  136. data/test/dummy/tmp/cache/assets/development/sprockets/bf64c92410e28e00afb6139c5d4c61b9 +0 -0
  137. data/test/dummy/tmp/cache/assets/development/sprockets/dc6268ee4fa18069ce7c21888ea1932e +0 -0
  138. data/test/dummy/tmp/cache/assets/development/sprockets/df9900b8557146382d16cc592306b17f +0 -0
  139. data/test/dummy/tmp/cache/assets/development/sprockets/e3caec07cb46343e49b4f060e2d3392a +0 -0
  140. data/test/dummy/tmp/cache/assets/development/sprockets/e6ebfb0e93a47d0164d0fc4637054c38 +0 -0
  141. data/test/dummy/tmp/cache/assets/development/sprockets/ecb48e7374f399434aedbf30716e489a +0 -0
  142. data/test/dummy/tmp/cache/assets/development/sprockets/eeb495bc326785d2a6a14cf6d97024e4 +0 -0
  143. data/test/dummy/tmp/cache/assets/development/sprockets/ef91e47e51f204a8373f160f13a05a30 +0 -0
  144. data/test/dummy/tmp/cache/assets/development/sprockets/f48290aae486ea863a9f456ba96443e9 +0 -0
  145. data/test/dummy/tmp/cache/assets/development/sprockets/fa078ac6abaaee94445294c5a7c6d793 +0 -0
  146. data/test/helpers/skydrive/ember_helper_test.rb +6 -0
  147. data/test/integration/navigation_test.rb +10 -0
  148. data/test/skydrive_test.rb +7 -0
  149. data/test/test_helper.rb +15 -0
  150. metadata +375 -0
@@ -0,0 +1,405 @@
1
+ /* normalize.css v2.1.0 | MIT License | git.io/normalize */
2
+ /* ==========================================================================
3
+ HTML5 display definitions
4
+ ========================================================================== */
5
+ /**
6
+ * Correct `block` display not defined in IE 8/9.
7
+ */
8
+ /* line 22, ../../foundation/sass/normalize.scss */
9
+ article,
10
+ aside,
11
+ details,
12
+ figcaption,
13
+ figure,
14
+ footer,
15
+ header,
16
+ hgroup,
17
+ main,
18
+ nav,
19
+ section,
20
+ summary {
21
+ display: block;
22
+ }
23
+
24
+ /**
25
+ * Correct `inline-block` display not defined in IE 8/9.
26
+ */
27
+ /* line 32, ../../foundation/sass/normalize.scss */
28
+ audio,
29
+ canvas,
30
+ video {
31
+ display: inline-block;
32
+ }
33
+
34
+ /**
35
+ * Prevent modern browsers from displaying `audio` without controls.
36
+ * Remove excess height in iOS 5 devices.
37
+ */
38
+ /* line 41, ../../foundation/sass/normalize.scss */
39
+ audio:not([controls]) {
40
+ display: none;
41
+ height: 0;
42
+ }
43
+
44
+ /**
45
+ * Address styling not present in IE 8/9.
46
+ */
47
+ /* line 50, ../../foundation/sass/normalize.scss */
48
+ [hidden] {
49
+ display: none;
50
+ }
51
+
52
+ /* ==========================================================================
53
+ Base
54
+ ========================================================================== */
55
+ /**
56
+ * 1. Set default font family to sans-serif.
57
+ * 2. Prevent iOS text size adjust after orientation change, without disabling
58
+ * user zoom.
59
+ */
60
+ /* line 64, ../../foundation/sass/normalize.scss */
61
+ html {
62
+ font-family: sans-serif;
63
+ /* 1 */
64
+ -webkit-text-size-adjust: 100%;
65
+ /* 2 */
66
+ -ms-text-size-adjust: 100%;
67
+ /* 2 */
68
+ }
69
+
70
+ /**
71
+ * Remove default margin.
72
+ */
73
+ /* line 74, ../../foundation/sass/normalize.scss */
74
+ body {
75
+ margin: 0;
76
+ }
77
+
78
+ /* ==========================================================================
79
+ Links
80
+ ========================================================================== */
81
+ /**
82
+ * Address `outline` inconsistency between Chrome and other browsers.
83
+ */
84
+ /* line 86, ../../foundation/sass/normalize.scss */
85
+ a:focus {
86
+ outline: thin dotted;
87
+ }
88
+
89
+ /**
90
+ * Improve readability when focused and also mouse hovered in all browsers.
91
+ */
92
+ /* line 95, ../../foundation/sass/normalize.scss */
93
+ a:active,
94
+ a:hover {
95
+ outline: 0;
96
+ }
97
+
98
+ /* ==========================================================================
99
+ Typography
100
+ ========================================================================== */
101
+ /**
102
+ * Address variable `h1` font-size and margin within `section` and `article`
103
+ * contexts in Firefox 4+, Safari 5, and Chrome.
104
+ */
105
+ /* line 108, ../../foundation/sass/normalize.scss */
106
+ h1 {
107
+ font-size: 2em;
108
+ margin: 0.67em 0;
109
+ }
110
+
111
+ /**
112
+ * Address styling not present in IE 8/9, Safari 5, and Chrome.
113
+ */
114
+ /* line 117, ../../foundation/sass/normalize.scss */
115
+ abbr[title] {
116
+ border-bottom: 1px dotted;
117
+ }
118
+
119
+ /**
120
+ * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
121
+ */
122
+ /* line 126, ../../foundation/sass/normalize.scss */
123
+ b,
124
+ strong {
125
+ font-weight: bold;
126
+ }
127
+
128
+ /**
129
+ * Address styling not present in Safari 5 and Chrome.
130
+ */
131
+ /* line 134, ../../foundation/sass/normalize.scss */
132
+ dfn {
133
+ font-style: italic;
134
+ }
135
+
136
+ /**
137
+ * Address differences between Firefox and other browsers.
138
+ */
139
+ /* line 142, ../../foundation/sass/normalize.scss */
140
+ hr {
141
+ -moz-box-sizing: content-box;
142
+ box-sizing: content-box;
143
+ height: 0;
144
+ }
145
+
146
+ /**
147
+ * Address styling not present in IE 8/9.
148
+ */
149
+ /* line 152, ../../foundation/sass/normalize.scss */
150
+ mark {
151
+ background: #ff0;
152
+ color: #000;
153
+ }
154
+
155
+ /**
156
+ * Correct font family set oddly in Safari 5 and Chrome.
157
+ */
158
+ /* line 164, ../../foundation/sass/normalize.scss */
159
+ code,
160
+ kbd,
161
+ pre,
162
+ samp {
163
+ font-family: monospace, serif;
164
+ font-size: 1em;
165
+ }
166
+
167
+ /**
168
+ * Improve readability of pre-formatted text in all browsers.
169
+ */
170
+ /* line 173, ../../foundation/sass/normalize.scss */
171
+ pre {
172
+ white-space: pre-wrap;
173
+ }
174
+
175
+ /**
176
+ * Set consistent quote types.
177
+ */
178
+ /* line 181, ../../foundation/sass/normalize.scss */
179
+ q {
180
+ quotes: "\201C" "\201D" "\2018" "\2019";
181
+ }
182
+
183
+ /**
184
+ * Address inconsistent and variable font size in all browsers.
185
+ */
186
+ /* line 189, ../../foundation/sass/normalize.scss */
187
+ small {
188
+ font-size: 80%;
189
+ }
190
+
191
+ /**
192
+ * Prevent `sub` and `sup` affecting `line-height` in all browsers.
193
+ */
194
+ /* line 198, ../../foundation/sass/normalize.scss */
195
+ sub,
196
+ sup {
197
+ font-size: 75%;
198
+ line-height: 0;
199
+ position: relative;
200
+ vertical-align: baseline;
201
+ }
202
+
203
+ /* line 205, ../../foundation/sass/normalize.scss */
204
+ sup {
205
+ top: -0.5em;
206
+ }
207
+
208
+ /* line 209, ../../foundation/sass/normalize.scss */
209
+ sub {
210
+ bottom: -0.25em;
211
+ }
212
+
213
+ /* ==========================================================================
214
+ Embedded content
215
+ ========================================================================== */
216
+ /**
217
+ * Remove border when inside `a` element in IE 8/9.
218
+ */
219
+ /* line 221, ../../foundation/sass/normalize.scss */
220
+ img {
221
+ border: 0;
222
+ }
223
+
224
+ /**
225
+ * Correct overflow displayed oddly in IE 9.
226
+ */
227
+ /* line 229, ../../foundation/sass/normalize.scss */
228
+ svg:not(:root) {
229
+ overflow: hidden;
230
+ }
231
+
232
+ /* ==========================================================================
233
+ Figures
234
+ ========================================================================== */
235
+ /**
236
+ * Address margin not present in IE 8/9 and Safari 5.
237
+ */
238
+ /* line 241, ../../foundation/sass/normalize.scss */
239
+ figure {
240
+ margin: 0;
241
+ }
242
+
243
+ /* ==========================================================================
244
+ Forms
245
+ ========================================================================== */
246
+ /**
247
+ * Define consistent border, margin, and padding.
248
+ */
249
+ /* line 253, ../../foundation/sass/normalize.scss */
250
+ fieldset {
251
+ border: 1px solid #c0c0c0;
252
+ margin: 0 2px;
253
+ padding: 0.35em 0.625em 0.75em;
254
+ }
255
+
256
+ /**
257
+ * 1. Correct `color` not being inherited in IE 8/9.
258
+ * 2. Remove padding so people aren't caught out if they zero out fieldsets.
259
+ */
260
+ /* line 264, ../../foundation/sass/normalize.scss */
261
+ legend {
262
+ border: 0;
263
+ /* 1 */
264
+ padding: 0;
265
+ /* 2 */
266
+ }
267
+
268
+ /**
269
+ * 1. Correct font family not being inherited in all browsers.
270
+ * 2. Correct font size not being inherited in all browsers.
271
+ * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
272
+ */
273
+ /* line 278, ../../foundation/sass/normalize.scss */
274
+ button,
275
+ input,
276
+ select,
277
+ textarea {
278
+ font-family: inherit;
279
+ /* 1 */
280
+ font-size: 100%;
281
+ /* 2 */
282
+ margin: 0;
283
+ /* 3 */
284
+ }
285
+
286
+ /**
287
+ * Address Firefox 4+ setting `line-height` on `input` using `!important` in
288
+ * the UA stylesheet.
289
+ */
290
+ /* line 290, ../../foundation/sass/normalize.scss */
291
+ button,
292
+ input {
293
+ line-height: normal;
294
+ }
295
+
296
+ /**
297
+ * Address inconsistent `text-transform` inheritance for `button` and `select`.
298
+ * All other form control elements do not inherit `text-transform` values.
299
+ * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
300
+ * Correct `select` style inheritance in Firefox 4+ and Opera.
301
+ */
302
+ /* line 302, ../../foundation/sass/normalize.scss */
303
+ button,
304
+ select {
305
+ text-transform: none;
306
+ }
307
+
308
+ /**
309
+ * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
310
+ * and `video` controls.
311
+ * 2. Correct inability to style clickable `input` types in iOS.
312
+ * 3. Improve usability and consistency of cursor style between image-type
313
+ * `input` and others.
314
+ */
315
+ /* line 317, ../../foundation/sass/normalize.scss */
316
+ button,
317
+ html input[type="button"],
318
+ input[type="reset"],
319
+ input[type="submit"] {
320
+ -webkit-appearance: button;
321
+ /* 2 */
322
+ cursor: pointer;
323
+ /* 3 */
324
+ }
325
+
326
+ /**
327
+ * Re-set default cursor for disabled elements.
328
+ */
329
+ /* line 327, ../../foundation/sass/normalize.scss */
330
+ button[disabled],
331
+ html input[disabled] {
332
+ cursor: default;
333
+ }
334
+
335
+ /**
336
+ * 1. Address box sizing set to `content-box` in IE 8/9.
337
+ * 2. Remove excess padding in IE 8/9.
338
+ */
339
+ /* line 337, ../../foundation/sass/normalize.scss */
340
+ input[type="checkbox"],
341
+ input[type="radio"] {
342
+ box-sizing: border-box;
343
+ /* 1 */
344
+ padding: 0;
345
+ /* 2 */
346
+ }
347
+
348
+ /**
349
+ * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
350
+ * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
351
+ * (include `-moz` to future-proof).
352
+ */
353
+ /* line 348, ../../foundation/sass/normalize.scss */
354
+ input[type="search"] {
355
+ -webkit-appearance: textfield;
356
+ /* 1 */
357
+ -moz-box-sizing: content-box;
358
+ -webkit-box-sizing: content-box;
359
+ /* 2 */
360
+ box-sizing: content-box;
361
+ }
362
+
363
+ /**
364
+ * Remove inner padding and search cancel button in Safari 5 and Chrome
365
+ * on OS X.
366
+ */
367
+ /* line 361, ../../foundation/sass/normalize.scss */
368
+ input[type="search"]::-webkit-search-cancel-button,
369
+ input[type="search"]::-webkit-search-decoration {
370
+ -webkit-appearance: none;
371
+ }
372
+
373
+ /**
374
+ * Remove inner padding and border in Firefox 4+.
375
+ */
376
+ /* line 370, ../../foundation/sass/normalize.scss */
377
+ button::-moz-focus-inner,
378
+ input::-moz-focus-inner {
379
+ border: 0;
380
+ padding: 0;
381
+ }
382
+
383
+ /**
384
+ * 1. Remove default vertical scrollbar in IE 8/9.
385
+ * 2. Improve readability and alignment in all browsers.
386
+ */
387
+ /* line 380, ../../foundation/sass/normalize.scss */
388
+ textarea {
389
+ overflow: auto;
390
+ /* 1 */
391
+ vertical-align: top;
392
+ /* 2 */
393
+ }
394
+
395
+ /* ==========================================================================
396
+ Tables
397
+ ========================================================================== */
398
+ /**
399
+ * Remove most spacing between table cells.
400
+ */
401
+ /* line 393, ../../foundation/sass/normalize.scss */
402
+ table {
403
+ border-collapse: collapse;
404
+ border-spacing: 0;
405
+ }
@@ -0,0 +1,27 @@
1
+ /* Blue: 094AB2 */
2
+
3
+ body {
4
+ background: #272822;
5
+ }
6
+
7
+ #wrapper {
8
+ background-color: #fff;
9
+ width: 630px;
10
+ height: 500px;
11
+ overflow: hidden;
12
+ margin: 50px auto;
13
+ }
14
+
15
+ .top-bar {
16
+ background-color: #094AB2;
17
+ padding: 0 10px;
18
+ margin-bottom: 0px;
19
+ }
20
+
21
+ ul.breadcrumbs {
22
+ border-top: 0px;
23
+ border-right: 0px;
24
+ border-left: 0px;
25
+ -webkit-border-radius: 0px;
26
+ border-radius: 0px;
27
+ }
@@ -0,0 +1,13 @@
1
+ module Skydrive
2
+ class ApiKeysController < ApplicationController
3
+ def oauth2_token
4
+ api_key = ApiKey.trade_oauth_code_for_access_token(params['code'])
5
+ if api_key
6
+ render json: { api_key: api_key }, status: 201
7
+ else
8
+ render json: {"message" => "invalid code"}, status: 400
9
+ end
10
+ end
11
+ end
12
+ end
13
+
@@ -0,0 +1,40 @@
1
+ module Skydrive
2
+ class ApplicationController < ActionController::Base
3
+ protected
4
+
5
+ # Renders a 401 status code if the current user is not authorized
6
+ def ensure_authenticated_user
7
+ head :unauthorized unless current_user
8
+ end
9
+
10
+ # Returns the active user associated with the access token if available
11
+ def current_user
12
+ return @current_user if @current_user
13
+ if current_api_key
14
+ return @current_user = current_api_key.user
15
+ else
16
+ return nil
17
+ end
18
+ end
19
+
20
+ # Parses the access token from the header
21
+ def current_api_key
22
+ return @current_api_key if @current_api_key.present?
23
+
24
+ bearer = request.headers["HTTP_AUTHORIZATION"]
25
+
26
+ bearer ||= params[:access_token]
27
+
28
+ # allows our tests to pass
29
+ bearer ||= request.headers["rack.session"].try(:[], 'Authorization')
30
+
31
+ if bearer.present?
32
+ token = bearer.split.last
33
+ @current_api_key = ApiKey.where(access_token: token).first
34
+ else
35
+ nil
36
+ end
37
+ @current_api_key
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,23 @@
1
+ require_dependency "skydrive/application_controller"
2
+
3
+ module Skydrive
4
+ class EmberController < ApplicationController
5
+ def index
6
+ @env = {
7
+ 'CONFIG' => {
8
+ root_path: root_path
9
+ }
10
+ }
11
+ render layout: false
12
+ end
13
+
14
+ def health_check
15
+ begin
16
+ ApiKey.count
17
+ head 200
18
+ rescue
19
+ head 500
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,62 @@
1
+ require 'open-uri'
2
+
3
+ module Skydrive
4
+ class FilesController < ApplicationController
5
+ before_filter :ensure_authenticated_user, except: :download
6
+ before_filter :ensure_valid_skydrive_token, except: :download
7
+
8
+ def ensure_valid_skydrive_token
9
+ head :unauthorized unless current_user.valid_skydrive_token?
10
+
11
+ if current_user.token.not_before > Time.now
12
+ results = client.refresh_token(current_user.token.refresh_token)
13
+ current_user.token.update_attributes(results)
14
+ end
15
+ end
16
+
17
+ def client
18
+ @client ||= Skydrive::Client.new(SHAREPOINT.merge(
19
+ client_domain: current_user.token.client_domain,
20
+ token: current_user.token.access_token))
21
+ end
22
+
23
+ def index
24
+ uri = params[:uri]
25
+ uri = nil if uri == 'root' || uri == 'undefined'
26
+ has_parent = true
27
+ unless uri.present?
28
+ personal_url = current_user.token.personal_url
29
+ data = client.api_call(personal_url + "_api/web/lists/Documents/")
30
+ uri = data['RootFolder']['__deferred']['uri']
31
+ has_parent = false
32
+ end
33
+ folder = client.get_folder_and_files(uri)
34
+ folder.parent_uri = nil unless has_parent
35
+
36
+ tp = IMS::LTI::ToolProvider.new(nil, nil, current_api_key.params)
37
+ tp.extend IMS::LTI::Extensions::Content::ToolProvider
38
+
39
+ # Update the files with the correct homework submission url
40
+ folder.files.each do |file|
41
+ file.update_content_type_data( current_api_key.accepted_extensions )
42
+ file_download_url = download_url(token: current_api_key.access_token, file: file.server_relative_url)
43
+ file.homework_submission_url = tp.file_content_return_url(file_download_url, file.name)
44
+ end
45
+
46
+ render json: folder
47
+ end
48
+
49
+ def download
50
+ api_key = ApiKey.where(access_token: params[:token]).first
51
+ if api_key
52
+ user = api_key.user
53
+ uri = "#{user.token.personal_url}_api/Web/GetFileByServerRelativeUrl('#{params[:file].gsub(/ /, '%20')}')/$value"
54
+ tempfile = open(uri, { "Authorization" => "Bearer #{user.token.access_token}"})
55
+ send_file tempfile.path, filename: params[:file].split('/').last
56
+ else
57
+ render status: 401
58
+ end
59
+ end
60
+ end
61
+ end
62
+