trakt_api 0.0.2

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 (62) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.travis.yml +4 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +252 -0
  7. data/Rakefile +1 -0
  8. data/lib/generators/templates/trakt_api.rb +5 -0
  9. data/lib/generators/trakt_api/install_generator.rb +12 -0
  10. data/lib/trakt_api.rb +22 -0
  11. data/lib/trakt_api/account.rb +16 -0
  12. data/lib/trakt_api/activity.rb +109 -0
  13. data/lib/trakt_api/base.rb +93 -0
  14. data/lib/trakt_api/calendar.rb +17 -0
  15. data/lib/trakt_api/client.rb +74 -0
  16. data/lib/trakt_api/comment.rb +16 -0
  17. data/lib/trakt_api/configuration.rb +7 -0
  18. data/lib/trakt_api/genres.rb +11 -0
  19. data/lib/trakt_api/lists.rb +26 -0
  20. data/lib/trakt_api/movie.rb +86 -0
  21. data/lib/trakt_api/movies.rb +11 -0
  22. data/lib/trakt_api/network.rb +26 -0
  23. data/lib/trakt_api/rate.rb +31 -0
  24. data/lib/trakt_api/recommendations.rb +21 -0
  25. data/lib/trakt_api/search.rb +26 -0
  26. data/lib/trakt_api/server.rb +6 -0
  27. data/lib/trakt_api/show.rb +152 -0
  28. data/lib/trakt_api/shows.rb +11 -0
  29. data/lib/trakt_api/user.rb +124 -0
  30. data/lib/trakt_api/version.rb +3 -0
  31. data/spec/integration_spec_helper.rb +3 -0
  32. data/spec/integrations/account_spec.rb +19 -0
  33. data/spec/integrations/calendar_spec.rb +31 -0
  34. data/spec/integrations/client_spec.rb +173 -0
  35. data/spec/integrations/genres_spec.rb +19 -0
  36. data/spec/integrations/movies_spec.rb +25 -0
  37. data/spec/integrations/network_spec.rb +37 -0
  38. data/spec/integrations/search_spec.rb +37 -0
  39. data/spec/integrations/server_spec.rb +13 -0
  40. data/spec/integrations/shows_spec.rb +25 -0
  41. data/spec/integrations/support/trakt_api.rb.example +5 -0
  42. data/spec/spec_helper.rb +43 -0
  43. data/spec/trakt_api/account_spec.rb +56 -0
  44. data/spec/trakt_api/activity_spec.rb +297 -0
  45. data/spec/trakt_api/base_spec.rb +147 -0
  46. data/spec/trakt_api/calendar_spec.rb +48 -0
  47. data/spec/trakt_api/client_spec.rb +101 -0
  48. data/spec/trakt_api/comment_spec.rb +69 -0
  49. data/spec/trakt_api/genres_spec.rb +24 -0
  50. data/spec/trakt_api/lists_spec.rb +111 -0
  51. data/spec/trakt_api/movie_spec.rb +333 -0
  52. data/spec/trakt_api/movies_spec.rb +38 -0
  53. data/spec/trakt_api/network_spec.rb +105 -0
  54. data/spec/trakt_api/rate_spec.rb +132 -0
  55. data/spec/trakt_api/recommendations_spec.rb +90 -0
  56. data/spec/trakt_api/search_spec.rb +81 -0
  57. data/spec/trakt_api/server_spec.rb +15 -0
  58. data/spec/trakt_api/show_spec.rb +588 -0
  59. data/spec/trakt_api/shows_spec.rb +38 -0
  60. data/spec/trakt_api/user_spec.rb +561 -0
  61. data/trakt_api.gemspec +29 -0
  62. metadata +232 -0
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe TraktApi::Shows do
4
+ let(:model) { TraktApi::Shows.new(TraktApi::Client.new) }
5
+ let(:mock_model) { SampleModel.new }
6
+
7
+ describe '.trending' do
8
+ it 'should call optional_auth' do
9
+ model.should_receive(:optional_auth).and_return(mock_model)
10
+
11
+ model.trending
12
+ end
13
+
14
+ it 'should call get with specific params' do
15
+ model.instance_variable_set("@method", :get)
16
+ model.should_receive(:get).with('shows/trending').and_return(mock_model)
17
+
18
+ model.trending
19
+ end
20
+ end
21
+
22
+ describe '.updated' do
23
+ let(:time) { Time.now.to_i }
24
+
25
+ it 'should call get with specific params' do
26
+ model.instance_variable_set("@method", :get)
27
+ model.should_receive(:get).with('shows/updated').and_return(mock_model)
28
+
29
+ model.updated(time: time)
30
+ end
31
+
32
+ it 'should call restful_params' do
33
+ model.should_receive(:restful_params).and_return(mock_model)
34
+
35
+ model.updated(time: time)
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,561 @@
1
+ require 'spec_helper'
2
+
3
+ describe TraktApi::User do
4
+ let(:model) { TraktApi::User.new(TraktApi::Client.new) }
5
+ let(:mock_model) { SampleModel.new }
6
+
7
+ describe '.calendar_shows' do
8
+ it 'should call optional_auth' do
9
+ model.should_receive(:optional_auth).and_return(mock_model)
10
+
11
+ model.calendar_shows
12
+ end
13
+
14
+ it 'should call get with specific params' do
15
+ model.instance_variable_set("@method", :get)
16
+ model.should_receive(:get).with('user/calendar/shows').and_return(mock_model)
17
+
18
+ model.calendar_shows
19
+ end
20
+
21
+ it 'should call restful_params' do
22
+ model.should_receive(:restful_params).and_return(mock_model)
23
+
24
+ model.calendar_shows
25
+ end
26
+ end
27
+
28
+ describe '.last_activity' do
29
+ it 'should call optional_auth' do
30
+ model.should_receive(:optional_auth).and_return(mock_model)
31
+
32
+ model.last_activity
33
+ end
34
+
35
+ it 'should call get with specific params' do
36
+ model.instance_variable_set("@method", :get)
37
+ model.should_receive(:get).with('user/lastactivity').and_return(mock_model)
38
+
39
+ model.last_activity
40
+ end
41
+
42
+ it 'should call restful_params' do
43
+ model.should_receive(:restful_params).and_return(mock_model)
44
+
45
+ model.last_activity
46
+ end
47
+ end
48
+
49
+ describe '.library_movies_all' do
50
+ it 'should call optional_auth' do
51
+ model.should_receive(:optional_auth).and_return(mock_model)
52
+
53
+ model.library_movies_all
54
+ end
55
+
56
+ it 'should call get with specific params' do
57
+ model.instance_variable_set("@method", :get)
58
+ model.should_receive(:get).with('user/library/movies/all').and_return(mock_model)
59
+
60
+ model.library_movies_all
61
+ end
62
+
63
+ it 'should call restful_params' do
64
+ model.should_receive(:restful_params).and_return(mock_model)
65
+
66
+ model.library_movies_all
67
+ end
68
+
69
+ it 'should call params' do
70
+ model.should_receive(:params).and_return(mock_model)
71
+
72
+ model.library_movies_all
73
+ end
74
+ end
75
+
76
+ describe '.library_movies_collection' do
77
+ it 'should call optional_auth' do
78
+ model.should_receive(:optional_auth).and_return(mock_model)
79
+
80
+ model.library_movies_collection
81
+ end
82
+
83
+ it 'should call get with specific params' do
84
+ model.instance_variable_set("@method", :get)
85
+ model.should_receive(:get).with('user/library/movies/collection').and_return(mock_model)
86
+
87
+ model.library_movies_collection
88
+ end
89
+
90
+ it 'should call restful_params' do
91
+ model.should_receive(:restful_params).and_return(mock_model)
92
+
93
+ model.library_movies_all
94
+ end
95
+
96
+ it 'should call params' do
97
+ model.should_receive(:params).and_return(mock_model)
98
+
99
+ model.library_movies_collection
100
+ end
101
+ end
102
+
103
+ describe '.library_movies_watched' do
104
+ it 'should call optional_auth' do
105
+ model.should_receive(:optional_auth).and_return(mock_model)
106
+
107
+ model.library_movies_watched
108
+ end
109
+
110
+ it 'should call get with specific params' do
111
+ model.instance_variable_set("@method", :get)
112
+ model.should_receive(:get).with('user/library/movies/watched').and_return(mock_model)
113
+
114
+ model.library_movies_watched
115
+ end
116
+
117
+ it 'should call restful_params' do
118
+ model.should_receive(:restful_params).and_return(mock_model)
119
+
120
+ model.library_movies_all
121
+ end
122
+
123
+ it 'should call params' do
124
+ model.should_receive(:params).and_return(mock_model)
125
+
126
+ model.library_movies_watched
127
+ end
128
+ end
129
+
130
+ describe '.library_shows_all' do
131
+ it 'should call optional_auth' do
132
+ model.should_receive(:optional_auth).and_return(mock_model)
133
+
134
+ model.library_shows_all
135
+ end
136
+
137
+ it 'should call get with specific params' do
138
+ model.instance_variable_set("@method", :get)
139
+ model.should_receive(:get).with('user/library/shows/all').and_return(mock_model)
140
+
141
+ model.library_shows_all
142
+ end
143
+
144
+ it 'should call restful_params' do
145
+ model.should_receive(:restful_params).and_return(mock_model)
146
+
147
+ model.library_movies_all
148
+ end
149
+
150
+ it 'should call params' do
151
+ model.should_receive(:params).and_return(mock_model)
152
+
153
+ model.library_shows_all
154
+ end
155
+ end
156
+
157
+ describe '.library_shows_collection' do
158
+ it 'should call optional_auth' do
159
+ model.should_receive(:optional_auth).and_return(mock_model)
160
+
161
+ model.library_shows_collection
162
+ end
163
+
164
+ it 'should call get with specific params' do
165
+ model.instance_variable_set("@method", :get)
166
+ model.should_receive(:get).with('user/library/shows/collection').and_return(mock_model)
167
+
168
+ model.library_shows_collection
169
+ end
170
+
171
+ it 'should call restful_params' do
172
+ model.should_receive(:restful_params).and_return(mock_model)
173
+
174
+ model.library_movies_collection
175
+ end
176
+
177
+ it 'should call params' do
178
+ model.should_receive(:params).and_return(mock_model)
179
+
180
+ model.library_shows_collection
181
+ end
182
+ end
183
+
184
+ describe '.library_shows_watched' do
185
+ it 'should call optional_auth' do
186
+ model.should_receive(:optional_auth).and_return(mock_model)
187
+
188
+ model.library_shows_watched
189
+ end
190
+
191
+ it 'should call get with specific params' do
192
+ model.instance_variable_set("@method", :get)
193
+ model.should_receive(:get).with('user/library/shows/watched').and_return(mock_model)
194
+
195
+ model.library_shows_watched
196
+ end
197
+
198
+ it 'should call restful_params' do
199
+ model.should_receive(:restful_params).and_return(mock_model)
200
+
201
+ model.library_movies_watched
202
+ end
203
+
204
+ it 'should call params' do
205
+ model.should_receive(:params).and_return(mock_model)
206
+
207
+ model.library_shows_watched
208
+ end
209
+ end
210
+
211
+ describe '.list' do
212
+ it 'should call optional_auth' do
213
+ model.should_receive(:optional_auth).and_return(mock_model)
214
+
215
+ model.list
216
+ end
217
+
218
+ it 'should call get with specific params' do
219
+ model.instance_variable_set("@method", :get)
220
+ model.should_receive(:get).with('user/list').and_return(mock_model)
221
+
222
+ model.list
223
+ end
224
+
225
+ it 'should call restful_params' do
226
+ model.should_receive(:restful_params).and_return(mock_model)
227
+
228
+ model.list
229
+ end
230
+
231
+ it 'should call params' do
232
+ model.should_receive(:params).and_return(mock_model)
233
+
234
+ model.list
235
+ end
236
+ end
237
+
238
+ describe '.lists' do
239
+ it 'should call optional_auth' do
240
+ model.should_receive(:optional_auth).and_return(mock_model)
241
+
242
+ model.lists
243
+ end
244
+
245
+ it 'should call get with specific params' do
246
+ model.instance_variable_set("@method", :get)
247
+ model.should_receive(:get).with('user/lists').and_return(mock_model)
248
+
249
+ model.lists
250
+ end
251
+
252
+ it 'should call restful_params' do
253
+ model.should_receive(:restful_params).and_return(mock_model)
254
+
255
+ model.lists
256
+ end
257
+
258
+ it 'should call params' do
259
+ model.should_receive(:params).and_return(mock_model)
260
+
261
+ model.lists
262
+ end
263
+ end
264
+
265
+ describe '.network_followers' do
266
+ it 'should call optional_auth' do
267
+ model.should_receive(:optional_auth).and_return(mock_model)
268
+
269
+ model.network_followers
270
+ end
271
+
272
+ it 'should call get with specific params' do
273
+ model.instance_variable_set("@method", :get)
274
+ model.should_receive(:get).with('user/network/followers').and_return(mock_model)
275
+
276
+ model.network_followers
277
+ end
278
+
279
+ it 'should call restful_params' do
280
+ model.should_receive(:restful_params).and_return(mock_model)
281
+
282
+ model.network_followers
283
+ end
284
+
285
+ it 'should call params' do
286
+ model.should_receive(:params).and_return(mock_model)
287
+
288
+ model.network_followers
289
+ end
290
+ end
291
+
292
+ describe '.network_following' do
293
+ it 'should call optional_auth' do
294
+ model.should_receive(:optional_auth).and_return(mock_model)
295
+
296
+ model.network_following
297
+ end
298
+
299
+ it 'should call get with specific params' do
300
+ model.instance_variable_set("@method", :get)
301
+ model.should_receive(:get).with('user/network/following').and_return(mock_model)
302
+
303
+ model.network_following
304
+ end
305
+
306
+ it 'should call restful_params' do
307
+ model.should_receive(:restful_params).and_return(mock_model)
308
+
309
+ model.network_following
310
+ end
311
+
312
+ it 'should call params' do
313
+ model.should_receive(:params).and_return(mock_model)
314
+
315
+ model.network_following
316
+ end
317
+ end
318
+
319
+ describe '.network_friends' do
320
+ it 'should call optional_auth' do
321
+ model.should_receive(:optional_auth).and_return(mock_model)
322
+
323
+ model.network_friends
324
+ end
325
+
326
+ it 'should call get with specific params' do
327
+ model.instance_variable_set("@method", :get)
328
+ model.should_receive(:get).with('user/network/friends').and_return(mock_model)
329
+
330
+ model.network_friends
331
+ end
332
+
333
+ it 'should call restful_params' do
334
+ model.should_receive(:restful_params).and_return(mock_model)
335
+
336
+ model.network_friends
337
+ end
338
+
339
+ it 'should call params' do
340
+ model.should_receive(:params).and_return(mock_model)
341
+
342
+ model.network_friends
343
+ end
344
+ end
345
+
346
+ describe '.profile' do
347
+ it 'should call optional_auth' do
348
+ model.should_receive(:optional_auth).and_return(mock_model)
349
+
350
+ model.profile
351
+ end
352
+
353
+ it 'should call get with specific params' do
354
+ model.instance_variable_set("@method", :get)
355
+ model.should_receive(:get).with('user/profile').and_return(mock_model)
356
+
357
+ model.profile
358
+ end
359
+
360
+ it 'should call restful_params' do
361
+ model.should_receive(:restful_params).and_return(mock_model)
362
+
363
+ model.profile
364
+ end
365
+
366
+ it 'should call params' do
367
+ model.should_receive(:params).and_return(mock_model)
368
+
369
+ model.profile
370
+ end
371
+ end
372
+
373
+ describe '.progress_collected' do
374
+ it 'should call optional_auth' do
375
+ model.should_receive(:optional_auth).and_return(mock_model)
376
+
377
+ model.progress_collected
378
+ end
379
+
380
+ it 'should call get with specific params' do
381
+ model.instance_variable_set("@method", :get)
382
+ model.should_receive(:get).with('user/progress/collected').and_return(mock_model)
383
+
384
+ model.progress_collected
385
+ end
386
+
387
+ it 'should call restful_params' do
388
+ model.should_receive(:restful_params).and_return(mock_model)
389
+
390
+ model.progress_collected
391
+ end
392
+ end
393
+
394
+ describe '.progress_watched' do
395
+ it 'should call optional_auth' do
396
+ model.should_receive(:optional_auth).and_return(mock_model)
397
+
398
+ model.progress_watched
399
+ end
400
+
401
+ it 'should call get with specific params' do
402
+ model.instance_variable_set("@method", :get)
403
+ model.should_receive(:get).with('user/progress/watched').and_return(mock_model)
404
+
405
+ model.progress_watched
406
+ end
407
+
408
+ it 'should call restful_params' do
409
+ model.should_receive(:restful_params).and_return(mock_model)
410
+
411
+ model.progress_watched
412
+ end
413
+ end
414
+
415
+ describe '.ratings_episodes' do
416
+ it 'should call optional_auth' do
417
+ model.should_receive(:optional_auth).and_return(mock_model)
418
+
419
+ model.ratings_episodes
420
+ end
421
+
422
+ it 'should call get with specific params' do
423
+ model.instance_variable_set("@method", :get)
424
+ model.should_receive(:get).with('user/ratings/episodes').and_return(mock_model)
425
+
426
+ model.ratings_episodes
427
+ end
428
+
429
+ it 'should call restful_params' do
430
+ model.should_receive(:restful_params).and_return(mock_model)
431
+
432
+ model.ratings_episodes
433
+ end
434
+ end
435
+
436
+ describe '.ratings_movies' do
437
+ it 'should call optional_auth' do
438
+ model.should_receive(:optional_auth).and_return(mock_model)
439
+
440
+ model.ratings_movies
441
+ end
442
+
443
+ it 'should call get with specific params' do
444
+ model.instance_variable_set("@method", :get)
445
+ model.should_receive(:get).with('user/ratings/movies').and_return(mock_model)
446
+
447
+ model.ratings_movies
448
+ end
449
+
450
+ it 'should call restful_params' do
451
+ model.should_receive(:restful_params).and_return(mock_model)
452
+
453
+ model.ratings_movies
454
+ end
455
+ end
456
+
457
+ describe '.ratings_shows' do
458
+ it 'should call optional_auth' do
459
+ model.should_receive(:optional_auth).and_return(mock_model)
460
+
461
+ model.ratings_shows
462
+ end
463
+
464
+ it 'should call get with specific params' do
465
+ model.instance_variable_set("@method", :get)
466
+ model.should_receive(:get).with('user/ratings/shows').and_return(mock_model)
467
+
468
+ model.ratings_shows
469
+ end
470
+
471
+ it 'should call restful_params' do
472
+ model.should_receive(:restful_params).and_return(mock_model)
473
+
474
+ model.ratings_shows
475
+ end
476
+ end
477
+
478
+ describe '.watching' do
479
+ it 'should call optional_auth' do
480
+ model.should_receive(:optional_auth).and_return(mock_model)
481
+
482
+ model.watching
483
+ end
484
+
485
+ it 'should call get with specific params' do
486
+ model.instance_variable_set("@method", :get)
487
+ model.should_receive(:get).with('user/watching').and_return(mock_model)
488
+
489
+ model.watching
490
+ end
491
+
492
+ it 'should call restful_params' do
493
+ model.should_receive(:restful_params).and_return(mock_model)
494
+
495
+ model.watching
496
+ end
497
+ end
498
+
499
+ describe '.watchlist_episode' do
500
+ it 'should call optional_auth' do
501
+ model.should_receive(:optional_auth).and_return(mock_model)
502
+
503
+ model.watchlist_episode
504
+ end
505
+
506
+ it 'should call get with specific params' do
507
+ model.instance_variable_set("@method", :get)
508
+ model.should_receive(:get).with('user/watchlist/episodes').and_return(mock_model)
509
+
510
+ model.watchlist_episode
511
+ end
512
+
513
+ it 'should call restful_params' do
514
+ model.should_receive(:restful_params).and_return(mock_model)
515
+
516
+ model.watchlist_episode
517
+ end
518
+ end
519
+
520
+ describe '.watchlist_movies' do
521
+ it 'should call optional_auth' do
522
+ model.should_receive(:optional_auth).and_return(mock_model)
523
+
524
+ model.watchlist_movies
525
+ end
526
+
527
+ it 'should call get with specific params' do
528
+ model.instance_variable_set("@method", :get)
529
+ model.should_receive(:get).with('user/watchlist/movies').and_return(mock_model)
530
+
531
+ model.watchlist_movies
532
+ end
533
+
534
+ it 'should call restful_params' do
535
+ model.should_receive(:restful_params).and_return(mock_model)
536
+
537
+ model.watchlist_movies
538
+ end
539
+ end
540
+
541
+ describe '.watchlist_shows' do
542
+ it 'should call optional_auth' do
543
+ model.should_receive(:optional_auth).and_return(mock_model)
544
+
545
+ model.watchlist_shows
546
+ end
547
+
548
+ it 'should call get with specific params' do
549
+ model.instance_variable_set("@method", :get)
550
+ model.should_receive(:get).with('user/watchlist/shows').and_return(mock_model)
551
+
552
+ model.watchlist_shows
553
+ end
554
+
555
+ it 'should call restful_params' do
556
+ model.should_receive(:restful_params).and_return(mock_model)
557
+
558
+ model.watchlist_shows
559
+ end
560
+ end
561
+ end