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,5 +0,0 @@
1
- TraktApi::Configuration.configure do |config|
2
- config.api_key = ''
3
- config.username = ''
4
- config.password = ''
5
- end
@@ -1,12 +0,0 @@
1
- module TraktApi
2
- module Generators
3
- class InstallGenerator < Rails::Generators::Base
4
- source_root File.expand_path('../../templates', __FILE__)
5
-
6
- desc 'Creates a TraktApi::Configuration initializer and copy locale files to your application.'
7
- def copy_initializer
8
- template 'trakt_api.rb', 'config/initializers/trakt_api.rb'
9
- end
10
- end
11
- end
12
- end
@@ -1,16 +0,0 @@
1
- class TraktApi::Account < TraktApi::Base
2
- # documentation: http://trakt.tv/api-docs/account-create
3
- def create(options = {})
4
- post('account/create').params(options).response
5
- end
6
-
7
- # documentation: http://trakt.tv/api-docs/account-settings
8
- def settings
9
- auth.post('account/settings').response
10
- end
11
-
12
- # documentation: http://trakt.tv/api-docs/account-test
13
- def test
14
- auth.post('account/test').response
15
- end
16
- end
@@ -1,94 +0,0 @@
1
- class TraktApi::Activity < TraktApi::Base
2
- # documentation: http://trakt.tv/api-docs/activity-community
3
- def community(options = {})
4
- get('activity/community').params(options).restful_params(type_fields).response
5
- end
6
-
7
- # documentation: http://trakt.tv/api-docs/activity-episodes
8
- def episodes(options = {})
9
- get('activity/episodes').params(options).restful_params(episodes_fields).response
10
- end
11
-
12
- # documentation: http://trakt.tv/api-docs/activity-friends
13
- def friends(options = {})
14
- auth.post('activity/friends').params(options).restful_params(type_fields).response
15
- end
16
-
17
- # documentation: http://trakt.tv/api-docs/activity-movies
18
- def movies(options = {})
19
- get('activity/movies').params(options).restful_params(title_fields).response
20
- end
21
-
22
- # documentation: http://trakt.tv/api-docs/activity-seasons
23
- def seasons(options = {})
24
- get('activity/seasons').params(options).restful_params(seasons_fields).response
25
- end
26
-
27
- # documentation: http://trakt.tv/api-docs/activity-shows
28
- def shows(options = {})
29
- get('activity/shows').params(options).restful_params(title_fields).response
30
- end
31
-
32
- # documentation: http://trakt.tv/api-docs/activity-user
33
- def user(options = {})
34
- get('activity/user').params(options).restful_params(user_fields).response
35
- end
36
-
37
- # documentation: http://trakt.tv/api-docs/activity-user-episodes
38
- def user_episodes(options = {})
39
- get('activity/user/episodes').params(options).restful_params(user_episodes_fields).response
40
- end
41
-
42
- # documentation: http://trakt.tv/api-docs/activity-user-movies
43
- def user_movies(options = {})
44
- get('activity/user/movies').params(options).restful_params(user_title_fields).response
45
- end
46
-
47
- # documentation: http://trakt.tv/api-docs/activity-user-seasons
48
- def user_seasons(options = {})
49
- get('activity/user/seasons').params(options).restful_params(user_seasons_fields).response
50
- end
51
-
52
- # documentation: http://trakt.tv/api-docs/activity-user-shows
53
- def user_shows(options = {})
54
- get('activity/user/shows').params(options).restful_params(user_title_fields).response
55
- end
56
-
57
- private
58
-
59
- def period_fields
60
- [:start_ts, :end_ts]
61
- end
62
-
63
- def type_fields
64
- [:types, :action] + period_fields
65
- end
66
-
67
- def episodes_fields
68
- [:title, :season, :episode, :action] + period_fields
69
- end
70
-
71
- def title_fields
72
- [:title, :action] + period_fields
73
- end
74
-
75
- def seasons_fields
76
- [:title, :season, :action] + period_fields
77
- end
78
-
79
- def user_fields
80
- [:username] + type_fields
81
- end
82
-
83
- def user_episodes_fields
84
- [:username] + episodes_fields
85
- end
86
-
87
- def user_title_fields
88
- [:username] + title_fields
89
- end
90
-
91
- def user_seasons_fields
92
- [:username] + seasons_fields
93
- end
94
- end
@@ -1,17 +0,0 @@
1
- class TraktApi::Calendar < TraktApi::Base
2
- # documentation: http://trakt.tv/api-docs/calendar-premieres
3
- def premieres(options = {})
4
- get('calendar/premieres').params(options).restful_params(fields).response
5
- end
6
-
7
- # documentation: http://trakt.tv/api-docs/calendar-shows
8
- def shows(options = {})
9
- get('calendar/shows').params(options).restful_params(fields).response
10
- end
11
-
12
- private
13
-
14
- def fields
15
- [:date, :days]
16
- end
17
- end
@@ -1,16 +0,0 @@
1
- class TraktApi::Comment < TraktApi::Base
2
- # documentation: http://trakt.tv/api-docs/comment-episode
3
- def episode(options = {})
4
- auth.post('comment/episode').params(options).response
5
- end
6
-
7
- # documentation: http://trakt.tv/api-docs/comment-movie
8
- def movie(options = {})
9
- auth.post('comment/movie').params(options).response
10
- end
11
-
12
- # documentation: http://trakt.tv/api-docs/comment-show
13
- def show(options = {})
14
- auth.post('comment/show').params(options).response
15
- end
16
- end
@@ -1,7 +0,0 @@
1
- require 'confiture'
2
-
3
- class TraktApi::Configuration
4
- include Confiture::Configuration
5
-
6
- confiture_allowed_keys(:api_key, :username, :password)
7
- end
@@ -1,11 +0,0 @@
1
- class TraktApi::Genres < TraktApi::Base
2
- # documentation: http://trakt.tv/api-docs/genres-movies
3
- def movies
4
- get('genres/movies').response
5
- end
6
-
7
- # documentation: http://trakt.tv/api-docs/genres-shows
8
- def shows
9
- get('genres/shows').response
10
- end
11
- end
@@ -1,26 +0,0 @@
1
- class TraktApi::Lists < TraktApi::Base
2
- # documentation: http://trakt.tv/api-docs/lists-add
3
- def add(options = {})
4
- auth.post('lists/add').params(options).response
5
- end
6
-
7
- # documentation: http://trakt.tv/api-docs/lists-delete
8
- def delete(options = {})
9
- auth.post('lists/delete').params(options).response
10
- end
11
-
12
- # documentation: http://trakt.tv/api-docs/lists-items-add
13
- def items_add(options = {})
14
- auth.post('lists/items/add').params(options).response
15
- end
16
-
17
- # documentation: http://trakt.tv/api-docs/lists-items-delete
18
- def items_delete(options = {})
19
- auth.post('lists/items/delete').params(options).response
20
- end
21
-
22
- # documentation: http://trakt.tv/api-docs/lists-update
23
- def update(options = {})
24
- auth.post('lists/update').params(options).response
25
- end
26
- end
@@ -1,86 +0,0 @@
1
- class TraktApi::Movie < TraktApi::Base
2
- # documentation: http://trakt.tv/api-docs/movie-cancelcheckin
3
- def cancel_check_in
4
- auth.post('movie/cancelcheckin').response
5
- end
6
-
7
- # documentation: http://trakt.tv/api-docs/movie-cancelwatching
8
- def cancel_watching
9
- auth.post('movie/cancelwatching').response
10
- end
11
-
12
- # documentation: http://trakt.tv/api-docs/movie-checkin
13
- def check_in(options = {})
14
- auth.post('movie/checkin').params(options).response
15
- end
16
-
17
- # documentation: http://trakt.tv/api-docs/movie-comments
18
- def comments(options = {})
19
- get('movie/comments').restful_params(options, [:title, :type]).response
20
- end
21
-
22
- # documentation: http://trakt.tv/api-docs/movie-scrobble
23
- def scrobble(options = {})
24
- auth.post('movie/scrobble').params(options).response
25
- end
26
-
27
- # documentation: http://trakt.tv/api-docs/movie-seen
28
- def seen(options = {})
29
- auth.post('movie/seen').params(options).response
30
- end
31
-
32
- # documentation: http://trakt.tv/api-docs/movie-library
33
- def library(options = {})
34
- auth.post('movie/library').params(options).response
35
- end
36
-
37
- # documentation: http://trakt.tv/api-docs/movie-related
38
- def related(options = {})
39
- get('movie/related').params(options).restful_params([:title, :hidewatched]).response
40
- end
41
-
42
- # documentation: http://trakt.tv/api-docs/movie-stats
43
- def stats(options = {})
44
- get('movie/stats').params(options).restful_params([:title]).response
45
- end
46
-
47
- # documentation: http://trakt.tv/api-docs/movie-summary
48
- def summary(options = {})
49
- get('movie/summary').params(options).restful_params([:title]).response
50
- end
51
-
52
- # documentation: http://trakt.tv/api-docs/movie-summaries
53
- def summaries(options = {})
54
- get('movie/summaries').params(options).restful_params([:title, :extended]).response
55
- end
56
-
57
- # documentation: http://trakt.tv/api-docs/movie-unlibrary
58
- def unlibrary(options = {})
59
- auth.post('movie/unlibrary').params(options).response
60
- end
61
-
62
- # documentation: http://trakt.tv/api-docs/movie-unseen
63
- def unseen(options = {})
64
- auth.post('movie/unseen').params(options).response
65
- end
66
-
67
- # documentation: http://trakt.tv/api-docs/movie-unwatchlist
68
- def unwatch_list(options = {})
69
- auth.post('movie/unwatchlist').params(options).response
70
- end
71
-
72
- # documentation: http://trakt.tv/api-docs/movie-watching
73
- def watching(options = {})
74
- auth.post('movie/watching').params(options).response
75
- end
76
-
77
- # documentation: http://trakt.tv/api-docs/movie-watchingnow
78
- def watching_now(options = {})
79
- get('movie/watchingnow').params(options).restful_params([:title]).response
80
- end
81
-
82
- # documentation: http://trakt.tv/api-docs/movie-watchlist
83
- def watch_list(options = {})
84
- auth.post('movie/watchlist').params(options).response
85
- end
86
- end
@@ -1,11 +0,0 @@
1
- class TraktApi::Movies < TraktApi::Base
2
- # documentation: http://trakt.tv/api-docs/movies-trending
3
- def trending(options = {})
4
- get('movies/trending').params(options).response
5
- end
6
-
7
- # documentation: http://trakt.tv/api-docs/movies-updated
8
- def updated(options = {})
9
- get('movies/updated').params(options).restful_params([:timestamp]).response
10
- end
11
- end
@@ -1,26 +0,0 @@
1
- class TraktApi::Network < TraktApi::Base
2
- # documentation: http://trakt.tv/api-docs/network-approve
3
- def approve(options = {})
4
- auth.post('network/approve').params(options).response
5
- end
6
-
7
- # documentation: http://trakt.tv/api-docs/network-deny
8
- def deny(options = {})
9
- auth.post('network/deny').params(options).response
10
- end
11
-
12
- # documentation: http://trakt.tv/api-docs/network-follow
13
- def follow(options = {})
14
- auth.post('network/follow').params(options).response
15
- end
16
-
17
- # documentation: http://trakt.tv/api-docs/network-requests
18
- def requests
19
- auth.post('network/requests').response
20
- end
21
-
22
- # documentation: http://trakt.tv/api-docs/network-unfollow
23
- def unfollow(options = {})
24
- auth.post('network/unfollow').params(options).response
25
- end
26
- end
@@ -1,31 +0,0 @@
1
- class TraktApi::Rate < TraktApi::Base
2
- # documentation: http://trakt.tv/api-docs/rate-episode
3
- def episode(options)
4
- auth.post('rate/episode').params(options).response
5
- end
6
-
7
- # documentation: http://trakt.tv/api-docs/rate-episodes
8
- def episodes(options)
9
- auth.post('rate/episodes').params(options).response
10
- end
11
-
12
- # documentation: http://trakt.tv/api-docs/rate-movie
13
- def movie(options)
14
- auth.post('rate/movie').params(options).response
15
- end
16
-
17
- # documentation: http://trakt.tv/api-docs/rate-movies
18
- def movies(options)
19
- auth.post('rate/movies').params(options).response
20
- end
21
-
22
- # documentation: http://trakt.tv/api-docs/rate-show
23
- def show(options)
24
- auth.post('rate/show').params(options).response
25
- end
26
-
27
- # documentation: http://trakt.tv/api-docs/rate-shows
28
- def shows(options)
29
- auth.post('rate/shows').params(options).response
30
- end
31
- end
@@ -1,21 +0,0 @@
1
- class TraktApi::Recommendations < TraktApi::Base
2
- # documentation: http://trakt.tv/api-docs/recommendations-movies
3
- def movies(options)
4
- auth.post('recommendations/movies').params(options).response
5
- end
6
-
7
- # documentation: http://trakt.tv/api-docs/recommendations-movies-dismiss
8
- def movies_dismiss(options)
9
- auth.post('recommendations/movies/dismiss').params(options).response
10
- end
11
-
12
- # documentation: http://trakt.tv/api-docs/recommendations-shows
13
- def shows(options)
14
- auth.post('recommendations/shows').params(options).response
15
- end
16
-
17
- # documentation: http://trakt.tv/api-docs/recommendations-shows-dismiss
18
- def shows_dismiss(options)
19
- auth.post('recommendations/shows/dismiss').params(options).response
20
- end
21
- end
@@ -1,6 +0,0 @@
1
- class TraktApi::Server < TraktApi::Base
2
- # documentation: http://trakt.tv/api-docs/server-time
3
- def time
4
- get('server/time').response
5
- end
6
- end
@@ -1,151 +0,0 @@
1
- class TraktApi::Show < TraktApi::Base
2
- # documentation: http://trakt.tv/api-docs/show-cancelcheckin
3
- def cancel_check_in
4
- auth.post('show/cancelcheckin').response
5
- end
6
-
7
- # documentation: http://trakt.tv/api-docs/show-cancelwatching
8
- def cancel_watching
9
- auth.post('show/cancelwatching').response
10
- end
11
-
12
- # documentation: http://trakt.tv/api-docs/show-checkin
13
- def check_in(options = {})
14
- auth.post('show/checkin').params(options).response
15
- end
16
-
17
- # documentation: http://trakt.tv/api-docs/show-comments
18
- def comments(options = {})
19
- get('show/comments').params(options).restful_params([:title, :type]).response
20
- end
21
-
22
- # documentation: http://trakt.tv/api-docs/show-episode-comments
23
- def episode_comments(options = {})
24
- get('show/episode/comments').params(options).restful_params([:title, :season, :episode, :type]).response
25
- end
26
-
27
- # documentation: http://trakt.tv/api-docs/show-episode-library
28
- def episode_library(options = {})
29
- auth.post('show/episode/library').params(options).response
30
- end
31
-
32
- # documentation: http://trakt.tv/api-docs/show-episode-seen
33
- def episode_seen(options = {})
34
- auth.post('show/episode/seen').params(options).response
35
- end
36
-
37
- # documentation: http://trakt.tv/api-docs/show-episode-stats
38
- def episode_stats(options = {})
39
- get('show/episode/stats').params(options).restful_params([:title, :season, :episode]).response
40
- end
41
-
42
- # documentation: http://trakt.tv/api-docs/show-episode-summary
43
- def episode_summary(options = {})
44
- get('show/episode/summary').params(options).restful_params([:title, :season, :episode]).response
45
- end
46
-
47
- # documentation: http://trakt.tv/api-docs/show-episode-unlibrary
48
- def episode_unlibrary(options = {})
49
- auth.post('show/episode/unlibrary').params(options).response
50
- end
51
-
52
- # documentation: http://trakt.tv/api-docs/show-episode-unseen
53
- def episode_unseen(options = {})
54
- auth.post('show/episode/unseen').params(options).response
55
- end
56
-
57
- # documentation: http://trakt.tv/api-docs/show-episode-unwatchlist
58
- def episode_unwatch_list(options = {})
59
- auth.post('show/episode/unwatchlist').params(options).response
60
- end
61
-
62
- # documentation: http://trakt.tv/api-docs/show-episode-watchingnow
63
- def episode_watching_now(options = {})
64
- get('show/episode/watchingnow').params(options).restful_params([:title, :season, :episode]).response
65
- end
66
-
67
- # documentation: http://trakt.tv/api-docs/show-episode-watchlist
68
- def episode_watch_list(options = {})
69
- auth.post('show/episode/watchlist').params(options).response
70
- end
71
-
72
- # documentation: http://trakt.tv/api-docs/show-library
73
- def library(options = {})
74
- auth.post('show/library').params(options).response
75
- end
76
-
77
- # documentation: http://trakt.tv/api-docs/show-related
78
- def related(options = {})
79
- get('show/related').params(options).restful_params([:title, :extended, :hidewatched]).response
80
- end
81
-
82
- # documentation: http://trakt.tv/api-docs/show-scrobble
83
- def scrobble(options = {})
84
- auth.post('show/scrobble').params(options).response
85
- end
86
-
87
- # documentation: http://trakt.tv/api-docs/show-season
88
- def season(options = {})
89
- get('show/season').params(options).restful_params([:title, :season]).response
90
- end
91
-
92
- # documentation: http://trakt.tv/api-docs/show-season-library
93
- def season_library(options = {})
94
- auth.post('show/season/library').params(options).response
95
- end
96
-
97
- # documentation: http://trakt.tv/api-docs/show-season-seen
98
- def season_seen(options = {})
99
- auth.post('show/season/seen').params(options).response
100
- end
101
-
102
- # documentation: http://trakt.tv/api-docs/show-seasons
103
- def seasons(options = {})
104
- get('show/seasons').params(options).restful_params([:title]).response
105
- end
106
-
107
- # documentation: http://trakt.tv/api-docs/show-seen
108
- def seen(options = {})
109
- auth.post('show/seen').params(options).response
110
- end
111
-
112
- # documentation: http://trakt.tv/api-docs/show-stats
113
- def stats(options = {})
114
- get('show/stats').params(options).restful_params([:title]).response
115
- end
116
-
117
- # documentation: http://trakt.tv/api-docs/show-summary
118
- def summary(options = {})
119
- get('show/summary').params(options).restful_params([:title, :extended]).response
120
- end
121
-
122
- # documentation: http://trakt.tv/api-docs/show-summaries
123
- def summaries(options = {})
124
- get('show/summaries').restful_params(options, [:title, :extended]).response
125
- end
126
-
127
- # documentation: http://trakt.tv/api-docs/show-unlibrary
128
- def unlibrary(options = {})
129
- auth.post('show/unlibrary').params(options).response
130
- end
131
-
132
- # documentation: http://trakt.tv/api-docs/show-unwatchlist
133
- def unwatch_list(options = {})
134
- auth.post('show/unwatchlist').params(options).response
135
- end
136
-
137
- # documentation: http://trakt.tv/api-docs/show-watching
138
- def watching(options = {})
139
- auth.post('show/watching').params(options).response
140
- end
141
-
142
- # documentation: http://trakt.tv/api-docs/show-watchingnow
143
- def watching_now(options = {})
144
- get('show/watchingnow').params(options).restful_params([:title]).response
145
- end
146
-
147
- # documentation: http://trakt.tv/api-docs/show-watchlist
148
- def watch_list(options = {})
149
- auth.post('show/watchlist').params(options).response
150
- end
151
- end