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.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +3 -1
- data/README.md +21 -209
- data/lib/trakt_api.rb +3 -17
- data/lib/trakt_api/base.rb +35 -68
- data/lib/trakt_api/client.rb +6 -67
- data/lib/trakt_api/search.rb +7 -18
- data/lib/trakt_api/version.rb +1 -1
- data/spec/fixtures/search.json +125 -0
- data/spec/functionals/search_spec.rb +23 -0
- data/spec/integrations/search_spec.rb +9 -30
- data/spec/spec_helper.rb +2 -38
- data/spec/support/.keep +0 -0
- data/spec/support/trakt_api.rb.example +1 -0
- data/trakt_api.gemspec +4 -3
- metadata +42 -94
- data/lib/generators/templates/trakt_api.rb +0 -5
- data/lib/generators/trakt_api/install_generator.rb +0 -12
- data/lib/trakt_api/account.rb +0 -16
- data/lib/trakt_api/activity.rb +0 -94
- data/lib/trakt_api/calendar.rb +0 -17
- data/lib/trakt_api/comment.rb +0 -16
- data/lib/trakt_api/configuration.rb +0 -7
- data/lib/trakt_api/genres.rb +0 -11
- data/lib/trakt_api/lists.rb +0 -26
- data/lib/trakt_api/movie.rb +0 -86
- data/lib/trakt_api/movies.rb +0 -11
- data/lib/trakt_api/network.rb +0 -26
- data/lib/trakt_api/rate.rb +0 -31
- data/lib/trakt_api/recommendations.rb +0 -21
- data/lib/trakt_api/server.rb +0 -6
- data/lib/trakt_api/show.rb +0 -151
- data/lib/trakt_api/shows.rb +0 -11
- data/lib/trakt_api/user.rb +0 -116
- data/spec/integration_spec_helper.rb +0 -3
- data/spec/integrations/account_spec.rb +0 -19
- data/spec/integrations/calendar_spec.rb +0 -31
- data/spec/integrations/client_spec.rb +0 -173
- data/spec/integrations/genres_spec.rb +0 -19
- data/spec/integrations/movies_spec.rb +0 -25
- data/spec/integrations/network_spec.rb +0 -37
- data/spec/integrations/server_spec.rb +0 -13
- data/spec/integrations/shows_spec.rb +0 -25
- data/spec/integrations/support/trakt_api.rb.example +0 -5
- data/spec/trakt_api/account_spec.rb +0 -56
- data/spec/trakt_api/activity_spec.rb +0 -243
- data/spec/trakt_api/base_spec.rb +0 -140
- data/spec/trakt_api/calendar_spec.rb +0 -48
- data/spec/trakt_api/client_spec.rb +0 -101
- data/spec/trakt_api/comment_spec.rb +0 -69
- data/spec/trakt_api/genres_spec.rb +0 -24
- data/spec/trakt_api/lists_spec.rb +0 -111
- data/spec/trakt_api/movie_spec.rb +0 -345
- data/spec/trakt_api/movies_spec.rb +0 -44
- data/spec/trakt_api/network_spec.rb +0 -105
- data/spec/trakt_api/rate_spec.rb +0 -132
- data/spec/trakt_api/recommendations_spec.rb +0 -90
- data/spec/trakt_api/search_spec.rb +0 -81
- data/spec/trakt_api/server_spec.rb +0 -15
- data/spec/trakt_api/show_spec.rb +0 -618
- data/spec/trakt_api/shows_spec.rb +0 -44
- data/spec/trakt_api/user_spec.rb +0 -489
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe TraktApi::Movies do
|
4
|
-
let(:model) { TraktApi::Movies.new(TraktApi::Client.new) }
|
5
|
-
let(:mock_model) { SampleModel.new }
|
6
|
-
|
7
|
-
describe '.trending' do
|
8
|
-
it 'should call get with specific params' do
|
9
|
-
model.instance_variable_set("@method", :get)
|
10
|
-
model.should_receive(:get).with('movies/trending').and_return(mock_model)
|
11
|
-
|
12
|
-
model.trending
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should call params' do
|
16
|
-
model.should_receive(:params).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('movies/updated').and_return(mock_model)
|
28
|
-
|
29
|
-
model.updated(time: time)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should call params' do
|
33
|
-
model.should_receive(:params).and_return(mock_model)
|
34
|
-
|
35
|
-
model.updated(time: time)
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'should call restful_params' do
|
39
|
-
model.should_receive(:restful_params).and_return(mock_model)
|
40
|
-
|
41
|
-
model.updated(time: time)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,105 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe TraktApi::Network do
|
4
|
-
let(:model) { TraktApi::Network.new(TraktApi::Client.new) }
|
5
|
-
let(:mock_model) { SampleModel.new }
|
6
|
-
|
7
|
-
describe '.approve' do
|
8
|
-
it 'should call auth' do
|
9
|
-
model.should_receive(:auth).and_return(mock_model)
|
10
|
-
|
11
|
-
model.approve(user: 'justin', follow_back: 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('network/approve').and_return(mock_model)
|
17
|
-
|
18
|
-
model.approve(user: 'justin', follow_back: true)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'should call params' do
|
22
|
-
model.should_receive(:params).and_return(mock_model)
|
23
|
-
|
24
|
-
model.approve(user: 'justin', follow_back: true)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '.deny' do
|
29
|
-
it 'should call auth' do
|
30
|
-
model.should_receive(:auth).and_return(mock_model)
|
31
|
-
|
32
|
-
model.deny(user: 'justin')
|
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('network/deny').and_return(mock_model)
|
38
|
-
|
39
|
-
model.deny(user: 'justin')
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'should call params' do
|
43
|
-
model.should_receive(:params).and_return(mock_model)
|
44
|
-
|
45
|
-
model.deny(user: 'justin')
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe '.follow' do
|
50
|
-
it 'should call auth' do
|
51
|
-
model.should_receive(:auth).and_return(mock_model)
|
52
|
-
|
53
|
-
model.follow(user: 'justin')
|
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('network/follow').and_return(mock_model)
|
59
|
-
|
60
|
-
model.follow(user: 'justin')
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'should call params' do
|
64
|
-
model.should_receive(:params).and_return(mock_model)
|
65
|
-
|
66
|
-
model.follow(user: 'justin')
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '.requests' do
|
71
|
-
it 'should call auth' do
|
72
|
-
model.should_receive(:auth).and_return(mock_model)
|
73
|
-
|
74
|
-
model.requests
|
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('network/requests').and_return(mock_model)
|
80
|
-
|
81
|
-
model.requests
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe '.unfollow' do
|
86
|
-
it 'should call auth' do
|
87
|
-
model.should_receive(:auth).and_return(mock_model)
|
88
|
-
|
89
|
-
model.unfollow(user: 'justin')
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'should call post with specific params' do
|
93
|
-
model.instance_variable_set("@method", :post)
|
94
|
-
model.should_receive(:post).with('network/unfollow').and_return(mock_model)
|
95
|
-
|
96
|
-
model.unfollow(user: 'justin')
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'should call params' do
|
100
|
-
model.should_receive(:params).and_return(mock_model)
|
101
|
-
|
102
|
-
model.unfollow(user: 'justin')
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
data/spec/trakt_api/rate_spec.rb
DELETED
@@ -1,132 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe TraktApi::Rate do
|
4
|
-
let(:model) { TraktApi::Rate.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('rate/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 '.episodes' do
|
29
|
-
it 'should call auth' do
|
30
|
-
model.should_receive(:auth).and_return(mock_model)
|
31
|
-
|
32
|
-
model.episodes(sample: true)
|
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('rate/episodes').and_return(mock_model)
|
38
|
-
|
39
|
-
model.episodes(sample: true)
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'should call params' do
|
43
|
-
model.should_receive(:params).and_return(mock_model)
|
44
|
-
|
45
|
-
model.episodes(sample: true)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe '.movie' do
|
50
|
-
it 'should call auth' do
|
51
|
-
model.should_receive(:auth).and_return(mock_model)
|
52
|
-
|
53
|
-
model.movie(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('rate/movie').and_return(mock_model)
|
59
|
-
|
60
|
-
model.movie(sample: true)
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'should call params' do
|
64
|
-
model.should_receive(:params).and_return(mock_model)
|
65
|
-
|
66
|
-
model.movie(sample: true)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '.movies' do
|
71
|
-
it 'should call auth' do
|
72
|
-
model.should_receive(:auth).and_return(mock_model)
|
73
|
-
|
74
|
-
model.movies(sample: true)
|
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('rate/movies').and_return(mock_model)
|
80
|
-
|
81
|
-
model.movies(sample: true)
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'should call params' do
|
85
|
-
model.should_receive(:params).and_return(mock_model)
|
86
|
-
|
87
|
-
model.movies(sample: true)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
describe '.show' do
|
92
|
-
it 'should call auth' do
|
93
|
-
model.should_receive(:auth).and_return(mock_model)
|
94
|
-
|
95
|
-
model.show(sample: true)
|
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('rate/show').and_return(mock_model)
|
101
|
-
|
102
|
-
model.show(sample: true)
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'should call params' do
|
106
|
-
model.should_receive(:params).and_return(mock_model)
|
107
|
-
|
108
|
-
model.show(sample: true)
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe '.shows' do
|
113
|
-
it 'should call auth' do
|
114
|
-
model.should_receive(:auth).and_return(mock_model)
|
115
|
-
|
116
|
-
model.shows(sample: true)
|
117
|
-
end
|
118
|
-
|
119
|
-
it 'should call post with specific params' do
|
120
|
-
model.instance_variable_set("@method", :post)
|
121
|
-
model.should_receive(:post).with('rate/shows').and_return(mock_model)
|
122
|
-
|
123
|
-
model.shows(sample: true)
|
124
|
-
end
|
125
|
-
|
126
|
-
it 'should call params' do
|
127
|
-
model.should_receive(:params).and_return(mock_model)
|
128
|
-
|
129
|
-
model.shows(sample: true)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe TraktApi::Recommendations do
|
4
|
-
let(:model) { TraktApi::Recommendations.new(TraktApi::Client.new) }
|
5
|
-
let(:mock_model) { SampleModel.new }
|
6
|
-
|
7
|
-
describe '.movies' do
|
8
|
-
it 'should call auth' do
|
9
|
-
model.should_receive(:auth).and_return(mock_model)
|
10
|
-
|
11
|
-
model.movies(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('recommendations/movies').and_return(mock_model)
|
17
|
-
|
18
|
-
model.movies(sample: true)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'should call params' do
|
22
|
-
model.should_receive(:params).and_return(mock_model)
|
23
|
-
|
24
|
-
model.movies(sample: true)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '.movies_dismiss' do
|
29
|
-
it 'should call auth' do
|
30
|
-
model.should_receive(:auth).and_return(mock_model)
|
31
|
-
|
32
|
-
model.movies_dismiss(sample: true)
|
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('recommendations/movies/dismiss').and_return(mock_model)
|
38
|
-
|
39
|
-
model.movies_dismiss(sample: true)
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'should call params' do
|
43
|
-
model.should_receive(:params).and_return(mock_model)
|
44
|
-
|
45
|
-
model.movies_dismiss(sample: true)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe '.shows' do
|
50
|
-
it 'should call auth' do
|
51
|
-
model.should_receive(:auth).and_return(mock_model)
|
52
|
-
|
53
|
-
model.shows(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('recommendations/shows').and_return(mock_model)
|
59
|
-
|
60
|
-
model.shows(sample: true)
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'should call params' do
|
64
|
-
model.should_receive(:params).and_return(mock_model)
|
65
|
-
|
66
|
-
model.shows(sample: true)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '.shows_dismiss' do
|
71
|
-
it 'should call auth' do
|
72
|
-
model.should_receive(:auth).and_return(mock_model)
|
73
|
-
|
74
|
-
model.shows_dismiss(sample: true)
|
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('recommendations/shows/dismiss').and_return(mock_model)
|
80
|
-
|
81
|
-
model.shows_dismiss(sample: true)
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'should call params' do
|
85
|
-
model.should_receive(:params).and_return(mock_model)
|
86
|
-
|
87
|
-
model.shows_dismiss(sample: true)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe TraktApi::Search do
|
4
|
-
let(:model) { TraktApi::Search.new(TraktApi::Client.new) }
|
5
|
-
let(:mock_model) { SampleModel.new }
|
6
|
-
|
7
|
-
describe '.episodes' do
|
8
|
-
it 'should call get with specific params' do
|
9
|
-
model.instance_variable_set("@method", :get)
|
10
|
-
model.should_receive(:get).with('search/episodes').and_return(mock_model)
|
11
|
-
|
12
|
-
model.episodes(query: 'test')
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should call restful_params' do
|
16
|
-
model.should_receive(:params).and_return(mock_model)
|
17
|
-
|
18
|
-
model.episodes(query: 'test')
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '.movies' do
|
23
|
-
it 'should call get with specific params' do
|
24
|
-
model.instance_variable_set("@method", :get)
|
25
|
-
model.should_receive(:get).with('search/movies').and_return(mock_model)
|
26
|
-
|
27
|
-
model.movies(query: 'test')
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should call restful_params' do
|
31
|
-
model.should_receive(:params).and_return(mock_model)
|
32
|
-
|
33
|
-
model.movies(query: 'test')
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe '.people' do
|
38
|
-
it 'should call get with specific params' do
|
39
|
-
model.instance_variable_set("@method", :get)
|
40
|
-
model.should_receive(:get).with('search/people').and_return(mock_model)
|
41
|
-
|
42
|
-
model.people(query: 'test')
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'should call restful_params' do
|
46
|
-
model.should_receive(:params).and_return(mock_model)
|
47
|
-
|
48
|
-
model.people(query: 'test')
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe '.shows' do
|
53
|
-
it 'should call get with specific params' do
|
54
|
-
model.instance_variable_set("@method", :get)
|
55
|
-
model.should_receive(:get).with('search/shows').and_return(mock_model)
|
56
|
-
|
57
|
-
model.shows(query: 'test')
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'should call restful_params' do
|
61
|
-
model.should_receive(:params).and_return(mock_model)
|
62
|
-
|
63
|
-
model.shows(query: 'test')
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
describe '.users' do
|
68
|
-
it 'should call get with specific params' do
|
69
|
-
model.instance_variable_set("@method", :get)
|
70
|
-
model.should_receive(:get).with('search/users').and_return(mock_model)
|
71
|
-
|
72
|
-
model.users(query: 'test')
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'should call restful_params' do
|
76
|
-
model.should_receive(:params).and_return(mock_model)
|
77
|
-
|
78
|
-
model.users(query: 'test')
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|