trakt_api 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.travis.yml +3 -1
  4. data/README.md +21 -209
  5. data/lib/trakt_api.rb +3 -17
  6. data/lib/trakt_api/base.rb +35 -68
  7. data/lib/trakt_api/client.rb +6 -67
  8. data/lib/trakt_api/search.rb +7 -18
  9. data/lib/trakt_api/version.rb +1 -1
  10. data/spec/fixtures/search.json +125 -0
  11. data/spec/functionals/search_spec.rb +23 -0
  12. data/spec/integrations/search_spec.rb +9 -30
  13. data/spec/spec_helper.rb +2 -38
  14. data/spec/support/.keep +0 -0
  15. data/spec/support/trakt_api.rb.example +1 -0
  16. data/trakt_api.gemspec +4 -3
  17. metadata +42 -94
  18. data/lib/generators/templates/trakt_api.rb +0 -5
  19. data/lib/generators/trakt_api/install_generator.rb +0 -12
  20. data/lib/trakt_api/account.rb +0 -16
  21. data/lib/trakt_api/activity.rb +0 -94
  22. data/lib/trakt_api/calendar.rb +0 -17
  23. data/lib/trakt_api/comment.rb +0 -16
  24. data/lib/trakt_api/configuration.rb +0 -7
  25. data/lib/trakt_api/genres.rb +0 -11
  26. data/lib/trakt_api/lists.rb +0 -26
  27. data/lib/trakt_api/movie.rb +0 -86
  28. data/lib/trakt_api/movies.rb +0 -11
  29. data/lib/trakt_api/network.rb +0 -26
  30. data/lib/trakt_api/rate.rb +0 -31
  31. data/lib/trakt_api/recommendations.rb +0 -21
  32. data/lib/trakt_api/server.rb +0 -6
  33. data/lib/trakt_api/show.rb +0 -151
  34. data/lib/trakt_api/shows.rb +0 -11
  35. data/lib/trakt_api/user.rb +0 -116
  36. data/spec/integration_spec_helper.rb +0 -3
  37. data/spec/integrations/account_spec.rb +0 -19
  38. data/spec/integrations/calendar_spec.rb +0 -31
  39. data/spec/integrations/client_spec.rb +0 -173
  40. data/spec/integrations/genres_spec.rb +0 -19
  41. data/spec/integrations/movies_spec.rb +0 -25
  42. data/spec/integrations/network_spec.rb +0 -37
  43. data/spec/integrations/server_spec.rb +0 -13
  44. data/spec/integrations/shows_spec.rb +0 -25
  45. data/spec/integrations/support/trakt_api.rb.example +0 -5
  46. data/spec/trakt_api/account_spec.rb +0 -56
  47. data/spec/trakt_api/activity_spec.rb +0 -243
  48. data/spec/trakt_api/base_spec.rb +0 -140
  49. data/spec/trakt_api/calendar_spec.rb +0 -48
  50. data/spec/trakt_api/client_spec.rb +0 -101
  51. data/spec/trakt_api/comment_spec.rb +0 -69
  52. data/spec/trakt_api/genres_spec.rb +0 -24
  53. data/spec/trakt_api/lists_spec.rb +0 -111
  54. data/spec/trakt_api/movie_spec.rb +0 -345
  55. data/spec/trakt_api/movies_spec.rb +0 -44
  56. data/spec/trakt_api/network_spec.rb +0 -105
  57. data/spec/trakt_api/rate_spec.rb +0 -132
  58. data/spec/trakt_api/recommendations_spec.rb +0 -90
  59. data/spec/trakt_api/search_spec.rb +0 -81
  60. data/spec/trakt_api/server_spec.rb +0 -15
  61. data/spec/trakt_api/show_spec.rb +0 -618
  62. data/spec/trakt_api/shows_spec.rb +0 -44
  63. data/spec/trakt_api/user_spec.rb +0 -489
@@ -1,48 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe TraktApi::Calendar do
4
- let(:model) { TraktApi::Calendar.new(TraktApi::Client.new) }
5
- let(:mock_model) { SampleModel.new }
6
-
7
- describe '.settings' do
8
- it 'should call get with specific params' do
9
- model.instance_variable_set("@method", :get)
10
- model.should_receive(:get).with('calendar/premieres').and_return(mock_model)
11
-
12
- model.premieres(date: '20130101')
13
- end
14
-
15
- it 'should call params' do
16
- model.should_receive(:params).and_return(mock_model)
17
-
18
- model.premieres(date: '20130101')
19
- end
20
-
21
- it 'should call restful_params' do
22
- model.should_receive(:restful_params).and_return(mock_model)
23
-
24
- model.premieres(date: '20130101')
25
- end
26
- end
27
-
28
- describe '.shows' do
29
- it 'should call get with specific params' do
30
- model.instance_variable_set("@method", :get)
31
- model.should_receive(:get).with('calendar/shows').and_return(mock_model)
32
-
33
- model.shows(date: '20130101')
34
- end
35
-
36
- it 'should call params' do
37
- model.should_receive(:params).and_return(mock_model)
38
-
39
- model.shows(date: '20130101')
40
- end
41
-
42
- it 'should call restful_params' do
43
- model.should_receive(:restful_params).and_return(mock_model)
44
-
45
- model.premieres(date: '20130101')
46
- end
47
- end
48
- end
@@ -1,101 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe TraktApi::Client do
4
- let(:model) { TraktApi::Client.new }
5
-
6
- describe '.account' do
7
- it 'should return account class' do
8
- model.account.class.should == TraktApi::Account
9
- end
10
- end
11
-
12
- describe '.activity' do
13
- it 'should return account class' do
14
- model.activity.class.should == TraktApi::Activity
15
- end
16
- end
17
-
18
- describe '.calendar' do
19
- it 'should return calendar class' do
20
- model.calendar.class.should == TraktApi::Calendar
21
- end
22
- end
23
-
24
- describe '.comment' do
25
- it 'should return comment class' do
26
- model.comment.class.should == TraktApi::Comment
27
- end
28
- end
29
-
30
- describe '.genres' do
31
- it 'should return genres class' do
32
- model.genres.class.should == TraktApi::Genres
33
- end
34
- end
35
-
36
- describe '.lists' do
37
- it 'should return lists class' do
38
- model.lists.class.should == TraktApi::Lists
39
- end
40
- end
41
-
42
- describe '.movie' do
43
- it 'should return movie class' do
44
- model.movie.class.should == TraktApi::Movie
45
- end
46
- end
47
-
48
- describe '.movies' do
49
- it 'should return movies class' do
50
- model.movies.class.should == TraktApi::Movies
51
- end
52
- end
53
-
54
- describe '.network' do
55
- it 'should return network class' do
56
- model.network.class.should == TraktApi::Network
57
- end
58
- end
59
-
60
- describe '.rate' do
61
- it 'should return rate class' do
62
- model.rate.class.should == TraktApi::Rate
63
- end
64
- end
65
-
66
- describe '.recommendations' do
67
- it 'should return movies class' do
68
- model.recommendations.class.should == TraktApi::Recommendations
69
- end
70
- end
71
-
72
- describe '.search' do
73
- it 'should return search class' do
74
- model.search.class.should == TraktApi::Search
75
- end
76
- end
77
-
78
- describe '.server' do
79
- it 'should return server class' do
80
- model.server.class.should == TraktApi::Server
81
- end
82
- end
83
-
84
- describe '.show' do
85
- it 'should return show class' do
86
- model.show.class.should == TraktApi::Show
87
- end
88
- end
89
-
90
- describe '.shows' do
91
- it 'should return shows class' do
92
- model.shows.class.should == TraktApi::Shows
93
- end
94
- end
95
-
96
- describe '.user' do
97
- it 'should return user class' do
98
- model.user.class.should == TraktApi::User
99
- end
100
- end
101
- end
@@ -1,69 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe TraktApi::Comment do
4
- let(:model) { TraktApi::Comment.new(TraktApi::Client.new) }
5
- let(:mock_model) { SampleModel.new }
6
-
7
- describe '.episode' do
8
- it 'should call auth' do
9
- model.should_receive(:auth).and_return(mock_model)
10
-
11
- model.episode(sample: true)
12
- end
13
-
14
- it 'should call post with specific params' do
15
- model.instance_variable_set("@method", :post)
16
- model.should_receive(:post).with('comment/episode').and_return(mock_model)
17
-
18
- model.episode(sample: true)
19
- end
20
-
21
- it 'should call params' do
22
- model.should_receive(:params).and_return(mock_model)
23
-
24
- model.episode(sample: true)
25
- end
26
- end
27
-
28
- describe '.movie' do
29
- it 'should call auth' do
30
- model.should_receive(:auth).and_return(mock_model)
31
-
32
- model.movie(sample: true)
33
- end
34
-
35
- it 'should call postt with specific params' do
36
- model.instance_variable_set("@method", :post)
37
- model.should_receive(:post).with('comment/movie').and_return(mock_model)
38
-
39
- model.movie(sample: true)
40
- end
41
-
42
- it 'should call params' do
43
- model.should_receive(:params).and_return(mock_model)
44
-
45
- model.movie(sample: true)
46
- end
47
- end
48
-
49
- describe '.show' do
50
- it 'should call auth' do
51
- model.should_receive(:auth).and_return(mock_model)
52
-
53
- model.show(sample: true)
54
- end
55
-
56
- it 'should call post with specific params' do
57
- model.instance_variable_set("@method", :post)
58
- model.should_receive(:post).with('comment/show').and_return(mock_model)
59
-
60
- model.show(sample: true)
61
- end
62
-
63
- it 'should call params' do
64
- model.should_receive(:params).and_return(mock_model)
65
-
66
- model.show(sample: true)
67
- end
68
- end
69
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe TraktApi::Genres do
4
- let(:model) { TraktApi::Genres.new(TraktApi::Client.new) }
5
- let(:mock_model) { SampleModel.new }
6
-
7
- describe '.movies' do
8
- it 'should call get with specific params' do
9
- model.instance_variable_set("@method", :get)
10
- model.should_receive(:get).with('genres/movies').and_return(mock_model)
11
-
12
- model.movies
13
- end
14
- end
15
-
16
- describe '.shows' do
17
- it 'should call get with specific params' do
18
- model.instance_variable_set("@method", :get)
19
- model.should_receive(:get).with('genres/shows').and_return(mock_model)
20
-
21
- model.shows
22
- end
23
- end
24
- end
@@ -1,111 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe TraktApi::Lists do
4
- let(:model) { TraktApi::Lists.new(TraktApi::Client.new) }
5
- let(:mock_model) { SampleModel.new }
6
-
7
- describe '.add' do
8
- it 'should call auth' do
9
- model.should_receive(:auth).and_return(mock_model)
10
-
11
- model.add(name: 'test', privacy: 'private', sample: true)
12
- end
13
-
14
- it 'should call post with specific params' do
15
- model.instance_variable_set("@method", :post)
16
- model.should_receive(:post).with('lists/add').and_return(mock_model)
17
-
18
- model.add(name: 'test', privacy: 'private', sample: true)
19
- end
20
-
21
- it 'should call params' do
22
- model.should_receive(:params).and_return(mock_model)
23
-
24
- model.add(name: 'test', privacy: 'private', sample: true)
25
- end
26
- end
27
-
28
- describe '.delete' do
29
- it 'should call auth' do
30
- model.should_receive(:auth).and_return(mock_model)
31
-
32
- model.delete(slug: 'test')
33
- end
34
-
35
- it 'should call post with specific params' do
36
- model.instance_variable_set("@method", :post)
37
- model.should_receive(:post).with('lists/delete').and_return(mock_model)
38
-
39
- model.delete(slug: 'test')
40
- end
41
-
42
- it 'should call params' do
43
- model.should_receive(:params).and_return(mock_model)
44
-
45
- model.delete(slug: 'test')
46
- end
47
- end
48
-
49
- describe '.items_add' do
50
- it 'should call auth' do
51
- model.should_receive(:auth).and_return(mock_model)
52
-
53
- model.items_add(slug: 'test', items: [])
54
- end
55
-
56
- it 'should call post with specific params' do
57
- model.instance_variable_set("@method", :post)
58
- model.should_receive(:post).with('lists/items/add').and_return(mock_model)
59
-
60
- model.items_add(slug: 'test', items: [])
61
- end
62
-
63
- it 'should call params' do
64
- model.should_receive(:params).and_return(mock_model)
65
-
66
- model.items_add(slug: 'test', items: [])
67
- end
68
- end
69
-
70
- describe '.items_delete' do
71
- it 'should call auth' do
72
- model.should_receive(:auth).and_return(mock_model)
73
-
74
- model.items_delete(slug: 'test', items: [])
75
- end
76
-
77
- it 'should call post with specific params' do
78
- model.instance_variable_set("@method", :post)
79
- model.should_receive(:post).with('lists/items/delete').and_return(mock_model)
80
-
81
- model.items_delete(slug: 'test', items: [])
82
- end
83
-
84
- it 'should call params' do
85
- model.should_receive(:params).and_return(mock_model)
86
-
87
- model.items_delete(slug: 'test', items: [])
88
- end
89
- end
90
-
91
- describe '.update' do
92
- it 'should call auth' do
93
- model.should_receive(:auth).and_return(mock_model)
94
-
95
- model.update(slug: 'test', sample: 1)
96
- end
97
-
98
- it 'should call post with specific params' do
99
- model.instance_variable_set("@method", :post)
100
- model.should_receive(:post).with('lists/update').and_return(mock_model)
101
-
102
- model.update(slug: 'test', sample: 1)
103
- end
104
-
105
- it 'should call params' do
106
- model.should_receive(:params).and_return(mock_model)
107
-
108
- model.update(slug: 'test', sample: 1)
109
- end
110
- end
111
- end
@@ -1,345 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe TraktApi::Movie do
4
- let(:model) { TraktApi::Movie.new(TraktApi::Client.new) }
5
- let(:mock_model) { SampleModel.new }
6
-
7
- describe '.cancel_check_in' do
8
- it 'should call auth' do
9
- model.should_receive(:auth).and_return(mock_model)
10
-
11
- model.cancel_check_in
12
- end
13
-
14
- it 'should call post with specific params' do
15
- model.instance_variable_set("@method", :post)
16
- model.should_receive(:post).with('movie/cancelcheckin').and_return(mock_model)
17
-
18
- model.cancel_check_in
19
- end
20
- end
21
-
22
- describe '.cancel_watching' do
23
- it 'should call auth' do
24
- model.should_receive(:auth).and_return(mock_model)
25
-
26
- model.cancel_watching
27
- end
28
-
29
- it 'should call post with specific params' do
30
- model.instance_variable_set("@method", :post)
31
- model.should_receive(:post).with('movie/cancelwatching').and_return(mock_model)
32
-
33
- model.cancel_watching
34
- end
35
- end
36
-
37
- describe '.check_in' do
38
- it 'should call auth' do
39
- model.should_receive(:auth).and_return(mock_model)
40
-
41
- model.check_in(sample: true)
42
- end
43
-
44
- it 'should call post with specific params' do
45
- model.instance_variable_set("@method", :post)
46
- model.should_receive(:post).with('movie/checkin').and_return(mock_model)
47
-
48
- model.check_in(sample: true)
49
- end
50
-
51
- it 'should call params' do
52
- model.should_receive(:params).and_return(mock_model)
53
-
54
- model.check_in(sample: true)
55
- end
56
- end
57
-
58
- describe '.comments' do
59
- it 'should call get with specific params' do
60
- model.instance_variable_set("@method", :get)
61
- model.should_receive(:get).with('movie/comments').and_return(mock_model)
62
-
63
- model.comments(title: 'TITLE', type: 'TYPE')
64
- end
65
-
66
- it 'should call restful_params' do
67
- model.should_receive(:restful_params).and_return(mock_model)
68
-
69
- model.comments(title: 'TITLE', type: 'TYPE')
70
- end
71
- end
72
-
73
- describe '.scrobble' do
74
- it 'should call auth' do
75
- model.should_receive(:auth).and_return(mock_model)
76
-
77
- model.scrobble(sample: true)
78
- end
79
-
80
- it 'should call post with specific params' do
81
- model.instance_variable_set("@method", :post)
82
- model.should_receive(:post).with('movie/scrobble').and_return(mock_model)
83
-
84
- model.scrobble(sample: true)
85
- end
86
-
87
- it 'should call params' do
88
- model.should_receive(:params).and_return(mock_model)
89
-
90
- model.scrobble(sample: true)
91
- end
92
- end
93
-
94
- describe '.seen' do
95
- it 'should call auth' do
96
- model.should_receive(:auth).and_return(mock_model)
97
-
98
- model.seen(sample: true)
99
- end
100
-
101
- it 'should call post with specific params' do
102
- model.instance_variable_set("@method", :post)
103
- model.should_receive(:post).with('movie/seen').and_return(mock_model)
104
-
105
- model.seen(sample: true)
106
- end
107
-
108
- it 'should call params' do
109
- model.should_receive(:params).and_return(mock_model)
110
-
111
- model.seen(sample: true)
112
- end
113
- end
114
-
115
- describe '.library' do
116
- it 'should call auth' do
117
- model.should_receive(:auth).and_return(mock_model)
118
-
119
- model.library(sample: true)
120
- end
121
-
122
- it 'should call post with specific params' do
123
- model.instance_variable_set("@method", :post)
124
- model.should_receive(:post).with('movie/library').and_return(mock_model)
125
-
126
- model.library(sample: true)
127
- end
128
-
129
- it 'should call params' do
130
- model.should_receive(:params).and_return(mock_model)
131
-
132
- model.library(sample: true)
133
- end
134
- end
135
-
136
- describe '.related' do
137
- it 'should call get with specific params' do
138
- model.instance_variable_set("@method", :get)
139
- model.should_receive(:get).with('movie/related').and_return(mock_model)
140
-
141
- model.related(title: 'TITLE', hidewatched: 'HIDEWATCH')
142
- end
143
-
144
- it 'should call params' do
145
- model.should_receive(:params).and_return(mock_model)
146
-
147
- model.related(title: 'TITLE', hidewatched: 'HIDEWATCH')
148
- end
149
-
150
- it 'should call restful_params' do
151
- model.should_receive(:restful_params).and_return(mock_model)
152
-
153
- model.related(title: 'TITLE', hidewatched: 'HIDEWATCH')
154
- end
155
- end
156
-
157
- describe '.stats' do
158
- it 'should call get with specific params' do
159
- model.instance_variable_set("@method", :get)
160
- model.should_receive(:get).with('movie/stats').and_return(mock_model)
161
-
162
- model.stats(title: 'TITLE')
163
- end
164
-
165
- it 'should call params' do
166
- model.should_receive(:params).and_return(mock_model)
167
-
168
- model.stats(title: 'TITLE')
169
- end
170
-
171
- it 'should call restful_params' do
172
- model.should_receive(:restful_params).and_return(mock_model)
173
-
174
- model.stats(title: 'TITLE')
175
- end
176
- end
177
-
178
- describe '.summary' do
179
- it 'should call get with specific params' do
180
- model.instance_variable_set("@method", :get)
181
- model.should_receive(:get).with('movie/summary').and_return(mock_model)
182
-
183
- model.summary(title: 'TITLE')
184
- end
185
-
186
- it 'should call params' do
187
- model.should_receive(:params).and_return(mock_model)
188
-
189
- model.summary(title: 'TITLE')
190
- end
191
-
192
- it 'should call restful_params' do
193
- model.should_receive(:restful_params).and_return(mock_model)
194
-
195
- model.summary(title: 'TITLE')
196
- end
197
- end
198
-
199
- describe '.summaries' do
200
- it 'should call get with specific params' do
201
- model.instance_variable_set("@method", :get)
202
- model.should_receive(:get).with('movie/summaries').and_return(mock_model)
203
-
204
- model.summaries(title: 'TITLE', extended: 'EXTENDED')
205
- end
206
-
207
- it 'should call params' do
208
- model.should_receive(:params).and_return(mock_model)
209
-
210
- model.summaries(title: 'TITLE', extended: 'EXTENDED')
211
- end
212
-
213
- it 'should call restful_params' do
214
- model.should_receive(:restful_params).and_return(mock_model)
215
-
216
- model.summaries(title: 'TITLE', extended: 'EXTENDED')
217
- end
218
- end
219
-
220
- describe '.unlibrary' do
221
- it 'should call auth' do
222
- model.should_receive(:auth).and_return(mock_model)
223
-
224
- model.unlibrary(sample: true)
225
- end
226
-
227
- it 'should call post with specific params' do
228
- model.instance_variable_set("@method", :post)
229
- model.should_receive(:post).with('movie/unlibrary').and_return(mock_model)
230
-
231
- model.unlibrary(sample: true)
232
- end
233
-
234
- it 'should call params' do
235
- model.should_receive(:params).and_return(mock_model)
236
-
237
- model.unlibrary(sample: true)
238
- end
239
- end
240
-
241
- describe '.unseen' do
242
- it 'should call auth' do
243
- model.should_receive(:auth).and_return(mock_model)
244
-
245
- model.unseen(sample: true)
246
- end
247
-
248
- it 'should call post with specific params' do
249
- model.instance_variable_set("@method", :post)
250
- model.should_receive(:post).with('movie/unseen').and_return(mock_model)
251
-
252
- model.unseen(sample: true)
253
- end
254
-
255
- it 'should call params' do
256
- model.should_receive(:params).and_return(mock_model)
257
-
258
- model.unseen(sample: true)
259
- end
260
- end
261
-
262
- describe '.unwatch_list' do
263
- it 'should call auth' do
264
- model.should_receive(:auth).and_return(mock_model)
265
-
266
- model.unwatch_list(sample: true)
267
- end
268
-
269
- it 'should call post with specific params' do
270
- model.instance_variable_set("@method", :post)
271
- model.should_receive(:post).with('movie/unwatchlist').and_return(mock_model)
272
-
273
- model.unwatch_list(sample: true)
274
- end
275
-
276
- it 'should call params' do
277
- model.should_receive(:params).and_return(mock_model)
278
-
279
- model.unwatch_list(sample: true)
280
- end
281
- end
282
-
283
- describe '.watching' do
284
- it 'should call auth' do
285
- model.should_receive(:auth).and_return(mock_model)
286
-
287
- model.watching(sample: true)
288
- end
289
-
290
- it 'should call post with specific params' do
291
- model.instance_variable_set("@method", :post)
292
- model.should_receive(:post).with('movie/watching').and_return(mock_model)
293
-
294
- model.watching(sample: true)
295
- end
296
-
297
- it 'should call params' do
298
- model.should_receive(:params).and_return(mock_model)
299
-
300
- model.watching(sample: true)
301
- end
302
- end
303
-
304
- describe '.watching_now' do
305
- it 'should call get with specific params' do
306
- model.instance_variable_set("@method", :get)
307
- model.should_receive(:get).with('movie/watchingnow').and_return(mock_model)
308
-
309
- model.watching_now(title: 'TITLE')
310
- end
311
-
312
- it 'should call params' do
313
- model.should_receive(:params).and_return(mock_model)
314
-
315
- model.watching_now(title: 'TITLE')
316
- end
317
-
318
- it 'should call restful_params' do
319
- model.should_receive(:restful_params).and_return(mock_model)
320
-
321
- model.watching_now(title: 'TITLE')
322
- end
323
- end
324
-
325
- describe '.watch_list' do
326
- it 'should call auth' do
327
- model.should_receive(:auth).and_return(mock_model)
328
-
329
- model.watch_list(sample: true)
330
- end
331
-
332
- it 'should call post with specific params' do
333
- model.instance_variable_set("@method", :post)
334
- model.should_receive(:post).with('movie/watchlist').and_return(mock_model)
335
-
336
- model.watch_list(sample: true)
337
- end
338
-
339
- it 'should call params' do
340
- model.should_receive(:params).and_return(mock_model)
341
-
342
- model.watch_list(sample: true)
343
- end
344
- end
345
- end