traktr 0.5.0 → 0.7.0
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.
- checksums.yaml +4 -4
- data/Rakefile +4 -0
- data/lib/traktr.rb +1 -2
- data/lib/traktr/account.rb +5 -18
- data/lib/traktr/activity.rb +20 -45
- data/lib/traktr/activity/user.rb +12 -27
- data/lib/traktr/calendar.rb +13 -0
- data/lib/traktr/client.rb +52 -1
- data/lib/traktr/comment.rb +18 -0
- data/lib/traktr/endpoint.rb +38 -0
- data/lib/traktr/genres.rb +11 -0
- data/lib/traktr/lists.rb +22 -0
- data/lib/traktr/lists/items.rb +15 -0
- data/lib/traktr/movie.rb +29 -93
- data/lib/traktr/movies.rb +4 -22
- data/lib/traktr/network.rb +27 -0
- data/lib/traktr/rate.rb +30 -0
- data/lib/traktr/recommendations.rb +19 -0
- data/lib/traktr/search.rb +11 -46
- data/lib/traktr/server.rb +7 -0
- data/lib/traktr/show.rb +32 -99
- data/lib/traktr/show/episode.rb +13 -54
- data/lib/traktr/show/season.rb +3 -20
- data/lib/traktr/shows.rb +4 -22
- data/lib/traktr/user.rb +33 -36
- data/lib/traktr/user/calendar.rb +4 -12
- data/lib/traktr/user/library.rb +9 -7
- data/lib/traktr/user/library/movies.rb +6 -24
- data/lib/traktr/user/library/shows.rb +6 -24
- data/lib/traktr/user/network.rb +5 -23
- data/lib/traktr/user/progress.rb +4 -17
- data/lib/traktr/user/ratings.rb +5 -23
- data/lib/traktr/user/watchlist.rb +5 -23
- data/lib/traktr/version.rb +1 -1
- data/spec/calendar_spec.rb +78 -0
- data/spec/comment_spec.rb +65 -0
- data/spec/genres_spec.rb +33 -0
- data/spec/lists_items_spec.rb +65 -0
- data/spec/lists_spec.rb +64 -0
- data/spec/movie_spec.rb +8 -0
- data/spec/network_spec.rb +94 -0
- data/spec/rate_spec.rb +110 -0
- data/spec/recommendations_spec.rb +71 -0
- data/spec/server_spec.rb +25 -0
- data/spec/show_episode_spec.rb +8 -0
- data/spec/show_spec.rb +12 -0
- data/spec/spec.yaml.sample +11 -4
- data/spec/spec_helper.rb +13 -4
- data/spec/user_calendar_spec.rb +51 -0
- data/spec/user_library_movies_spec.rb +59 -0
- data/spec/user_library_shows_spec.rb +59 -0
- data/spec/user_network_spec.rb +59 -0
- data/spec/user_progress_spec.rb +47 -0
- data/spec/user_ratings_spec.rb +59 -0
- data/spec/user_spec.rb +115 -0
- data/spec/user_watchlist_spec.rb +59 -0
- metadata +46 -2
data/lib/traktr/movies.rb
CHANGED
@@ -1,30 +1,12 @@
|
|
1
1
|
module Traktr
|
2
|
-
class Movies
|
3
|
-
include HTTParty
|
4
|
-
base_uri File.join(Traktr.base_uri, 'movies')
|
5
|
-
|
6
|
-
def initialize(client)
|
7
|
-
@client = client
|
8
|
-
end
|
9
|
-
|
10
|
-
##
|
11
|
-
## movies GET methods
|
12
|
-
##
|
2
|
+
class Movies < Endpoint
|
13
3
|
def trending
|
14
|
-
|
15
|
-
raise ResponseError.new(response) if response.code != 200
|
16
|
-
|
17
|
-
response.parsed_response.collect do |movie|
|
18
|
-
Mash.new(movie)
|
19
|
-
end
|
4
|
+
parse_response self.class.get('/' + File.join('trending.json', @client.api_key))
|
20
5
|
end
|
21
6
|
|
22
7
|
def updated(timestamp)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
Mash.new(response.parsed_response)
|
8
|
+
timestamp = timestamp.class == Time ? timestamp.to_i.to_s : timestamp.to_s
|
9
|
+
parse_response self.class.get('/' + File.join('updated.json', @client.api_key, timestamp))
|
27
10
|
end
|
28
|
-
|
29
11
|
end
|
30
12
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Traktr
|
2
|
+
class Network < Endpoint
|
3
|
+
def approve( user, follow_back = false )
|
4
|
+
data = @auth.merge({:user => user, :follow_back => follow_back})
|
5
|
+
parse_response self.class.post('/' + File.join('approve', @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
6
|
+
end
|
7
|
+
|
8
|
+
def deny( user )
|
9
|
+
data = @auth.merge({:user => user})
|
10
|
+
parse_response self.class.post('/' + File.join('deny', @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
11
|
+
end
|
12
|
+
|
13
|
+
def follow( user )
|
14
|
+
data = @auth.merge({:user => user})
|
15
|
+
parse_response self.class.post('/' + File.join('follow', @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
16
|
+
end
|
17
|
+
|
18
|
+
def requests
|
19
|
+
parse_response self.class.post('/' + File.join('requests', @client.api_key), body: @auth.to_json, headers: { 'Content-Type' => 'application/json'})
|
20
|
+
end
|
21
|
+
|
22
|
+
def unfollow( user )
|
23
|
+
data = @auth.merge({:user => user})
|
24
|
+
parse_response self.class.post('/' + File.join('unfollow', @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/traktr/rate.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
module Traktr
|
2
|
+
class Rate < Endpoint
|
3
|
+
def episode( data )
|
4
|
+
parse_response self.class.post('/' + File.join('episode', @client.api_key), body: data.merge(@auth).to_json, headers: { 'Content-Type' => 'application/json'})
|
5
|
+
end
|
6
|
+
|
7
|
+
def episodes( data )
|
8
|
+
data = @auth.merge( :episodes => data )
|
9
|
+
parse_response self.class.post('/' + File.join('episodes', @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
10
|
+
end
|
11
|
+
|
12
|
+
def movie( data )
|
13
|
+
parse_response self.class.post('/' + File.join('movie', @client.api_key), body: data.merge(@auth).to_json, headers: { 'Content-Type' => 'application/json'})
|
14
|
+
end
|
15
|
+
|
16
|
+
def movies( data )
|
17
|
+
data = @auth.merge( :movies => data )
|
18
|
+
parse_response self.class.post('/' + File.join('movies', @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
19
|
+
end
|
20
|
+
|
21
|
+
def show( data )
|
22
|
+
parse_response self.class.post('/' + File.join('show', @client.api_key), body: data.merge(@auth).to_json, headers: { 'Content-Type' => 'application/json'})
|
23
|
+
end
|
24
|
+
|
25
|
+
def shows( data )
|
26
|
+
data = @auth.merge( :shows => data )
|
27
|
+
parse_response self.class.post('/' + File.join('shows', @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Traktr
|
2
|
+
class Recommendations < Endpoint
|
3
|
+
def movies( data = {} )
|
4
|
+
parse_response self.class.post('/' + File.join('movies', @client.api_key), body: data.merge(@auth).to_json, headers: { 'Content-Type' => 'application/json'})
|
5
|
+
end
|
6
|
+
|
7
|
+
def movies_dismiss( data )
|
8
|
+
parse_response self.class.post('/' + File.join('movies/dismiss', @client.api_key), body: data.merge(@auth).to_json, headers: { 'Content-Type' => 'application/json'})
|
9
|
+
end
|
10
|
+
|
11
|
+
def shows( data = {} )
|
12
|
+
parse_response self.class.post('/' + File.join('shows', @client.api_key), body: data.merge(@auth).to_json, headers: { 'Content-Type' => 'application/json'})
|
13
|
+
end
|
14
|
+
|
15
|
+
def shows_dismiss( data )
|
16
|
+
parse_response self.class.post('/' + File.join('shows/dismiss', @client.api_key), body: data.merge(@auth).to_json, headers: { 'Content-Type' => 'application/json'})
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/traktr/search.rb
CHANGED
@@ -1,59 +1,24 @@
|
|
1
1
|
module Traktr
|
2
|
-
class Search
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
def initialize(client)
|
7
|
-
@client = client
|
8
|
-
end
|
9
|
-
|
10
|
-
##
|
11
|
-
## search GET methods
|
12
|
-
##
|
13
|
-
def episodes(query)
|
14
|
-
response = self.class.get('/' + File.join('episodes.json', @client.api_key, URI::encode(query)))
|
15
|
-
raise ResponseError.new(response) if response.code != 200
|
16
|
-
|
17
|
-
response.parsed_response.collect do |result|
|
18
|
-
Mash.new(result)
|
19
|
-
end
|
2
|
+
class Search < Endpoint
|
3
|
+
def episodes(query, limit = 30)
|
4
|
+
parse_response self.class.get('/' + File.join('episodes.json', @client.api_key, URI::encode(query), limit.to_s))
|
20
5
|
end
|
21
6
|
|
22
|
-
def movies(query)
|
23
|
-
|
24
|
-
raise ResponseError.new(response) if response.code != 200
|
25
|
-
|
26
|
-
response.parsed_response.collect do |result|
|
27
|
-
Mash.new(result)
|
28
|
-
end
|
7
|
+
def movies(query, limit = 30)
|
8
|
+
parse_response self.class.get('/' + File.join('movies.json', @client.api_key, URI::encode(query), limit.to_s))
|
29
9
|
end
|
30
10
|
|
31
|
-
def people(query)
|
32
|
-
|
33
|
-
raise ResponseError.new(response) if response.code != 200
|
34
|
-
|
35
|
-
response.parsed_response.collect do |result|
|
36
|
-
Mash.new(result)
|
37
|
-
end
|
11
|
+
def people(query, limit = 30)
|
12
|
+
parse_response self.class.get('/' + File.join('people.json', @client.api_key, URI::encode(query), limit.to_s))
|
38
13
|
end
|
39
14
|
|
40
15
|
def shows(query, limit = 30, seasons = nil)
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
response.parsed_response.collect do |result|
|
45
|
-
Mash.new(result)
|
46
|
-
end
|
16
|
+
seasons = seasons == nil || seasons == false ? "" : "seasons"
|
17
|
+
parse_response self.class.get('/' + File.join('shows.json', @client.api_key, URI::encode(query), limit.to_s, seasons))
|
47
18
|
end
|
48
19
|
|
49
|
-
def users(query)
|
50
|
-
|
51
|
-
raise ResponseError.new(response) if response.code != 200
|
52
|
-
|
53
|
-
response.parsed_response.collect do |result|
|
54
|
-
Mash.new(result)
|
55
|
-
end
|
20
|
+
def users(query, limit = 30)
|
21
|
+
parse_response self.class.get('/' + File.join('users.json', @client.api_key, URI::encode(query), limit.to_s), :basic_auth => @auth)
|
56
22
|
end
|
57
|
-
|
58
23
|
end
|
59
24
|
end
|
data/lib/traktr/show.rb
CHANGED
@@ -1,45 +1,19 @@
|
|
1
1
|
module Traktr
|
2
|
-
class Show
|
3
|
-
include HTTParty
|
4
|
-
base_uri File.join(Traktr.base_uri, "show")
|
5
|
-
|
6
|
-
def initialize(client)
|
7
|
-
@client = client
|
8
|
-
end
|
9
|
-
|
10
|
-
def episode
|
11
|
-
@episode ||= Traktr::Show::Episode.new(@client)
|
12
|
-
end
|
13
|
-
|
14
|
-
##
|
15
|
-
## show GET methods
|
16
|
-
##
|
2
|
+
class Show < Endpoint
|
17
3
|
def comments(title, type = :all)
|
18
|
-
|
19
|
-
|
4
|
+
type = [:all, :shouts, :reviews].include?(type) ? type.to_s : ""
|
5
|
+
parse_response self.class.get("/" + File.join("comments.json", @client.api_key, title, type))
|
20
6
|
|
21
|
-
response.parsed_response.collect do |comment|
|
22
|
-
Mash.new(comment)
|
23
|
-
end
|
24
7
|
end
|
25
8
|
|
26
|
-
def related(title, hidewatched =
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
response.parsed_response.collect do |summary|
|
31
|
-
Mash.new(summary)
|
32
|
-
end
|
9
|
+
def related(title, hidewatched = nil)
|
10
|
+
hidewatched = hidewatched == false || hidewatched == nil ? "" : "hidewatched"
|
11
|
+
parse_response self.class.get("/" + File.join("related.json", @client.api_key, title, hidewatched.to_s), :basic_auth => @auth)
|
33
12
|
end
|
34
13
|
|
35
14
|
def season(title = nil, season = nil)
|
36
15
|
if title && season
|
37
|
-
|
38
|
-
raise ResponseError.new(response) if response.code != 200
|
39
|
-
|
40
|
-
response.parsed_response.collect do |episode|
|
41
|
-
Mash.new(episode)
|
42
|
-
end
|
16
|
+
parse_response self.class.get("/" + File.join("season.json", @client.api_key, title, season.to_s), :basic_auth => @auth)
|
43
17
|
elsif !title && !season
|
44
18
|
@season ||= Traktr::Show::Season.new(@client)
|
45
19
|
else
|
@@ -48,98 +22,57 @@ module Traktr
|
|
48
22
|
end
|
49
23
|
|
50
24
|
def seasons(title)
|
51
|
-
|
52
|
-
raise ResponseError.new(response) if response.code != 200
|
53
|
-
|
54
|
-
response.parsed_response.collect do |season|
|
55
|
-
Mash.new(season)
|
56
|
-
end
|
25
|
+
parse_response self.class.get("/" + File.join("seasons.json", @client.api_key, title))
|
57
26
|
end
|
58
27
|
|
59
|
-
def
|
60
|
-
|
61
|
-
raise ResponseError.new(response) if response.code != 200
|
62
|
-
|
63
|
-
Mash.new(response.parsed_response)
|
28
|
+
def stats(title)
|
29
|
+
parse_response self.class.get('/' + File.join('stats.json', @client.api_key, title))
|
64
30
|
end
|
65
31
|
|
66
|
-
def
|
67
|
-
|
68
|
-
|
69
|
-
|
32
|
+
def summary(title, extended = nil)
|
33
|
+
extended = [:normal, :full].include?(extended) ? extended.to_s : ""
|
34
|
+
parse_response self.class.get("/" + File.join("summary.json", @client.api_key, title, extended), :basic_auth => @auth)
|
35
|
+
end
|
70
36
|
|
71
|
-
|
72
|
-
|
73
|
-
|
37
|
+
def summaries(titles, extended = nil)
|
38
|
+
titles = titles.join(",") if titles.class == Array
|
39
|
+
extended = [:normal, :full].include?(extended) ? extended.to_s : ""
|
40
|
+
parse_response self.class.get("/" + File.join("summaries.json", @client.api_key, titles, extended))
|
74
41
|
end
|
75
42
|
|
76
43
|
def watchingnow(title)
|
77
|
-
|
78
|
-
raise ResponseError.new(response) if response.code != 200
|
79
|
-
|
80
|
-
response.parsed_response.collect do |user|
|
81
|
-
Mash.new(user)
|
82
|
-
end
|
44
|
+
parse_response self.class.get("/" + File.join("watchingnow.json", @client.api_key, title), :basic_auth => @auth)
|
83
45
|
end
|
84
46
|
|
85
|
-
##
|
86
|
-
## show POST methods
|
87
|
-
##
|
88
47
|
def library(show)
|
89
|
-
data =
|
90
|
-
|
91
|
-
title: show.title, year: show.year, imdb_id: show.imdb_id, tvdb_id: show.tvdb_id,
|
92
|
-
}
|
93
|
-
response = self.class.post("/" + File.join("library", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
94
|
-
raise ResponseError.new(response) if response.code != 200
|
95
|
-
|
96
|
-
Mash.new(response.parsed_response)
|
48
|
+
data = @auth.merge(show)
|
49
|
+
parse_response self.class.post("/" + File.join("library", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
97
50
|
end
|
98
51
|
|
99
52
|
def unlibrary(show)
|
100
|
-
data =
|
101
|
-
|
102
|
-
title: show.title, year: show.year, imdb_id: show.imdb_id, tvdb_id: show.tvdb_id,
|
103
|
-
}
|
104
|
-
response = self.class.post("/" + File.join("unlibrary", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
105
|
-
raise ResponseError.new(response) if response.code != 200
|
106
|
-
|
107
|
-
Mash.new(response.parsed_response)
|
53
|
+
data = @auth.merge(show)
|
54
|
+
parse_response self.class.post("/" + File.join("unlibrary", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
108
55
|
end
|
109
56
|
|
110
57
|
def watchlist(shows)
|
111
58
|
shows = [ shows ] if shows.class != Array
|
112
|
-
data = {
|
113
|
-
|
114
|
-
shows: shows.collect{ |s| { title: s.title, year: s.year, imdb_id: s.imdb_id, tvdb_id: s.tvdb_id }}
|
115
|
-
}
|
116
|
-
response = self.class.post("/" + File.join("watchlist", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
117
|
-
raise ResponseError.new(response) if response.code != 200
|
118
|
-
|
119
|
-
Mash.new(JSON.parse(response.parsed_response))
|
59
|
+
data = @auth.merge({ shows: shows })
|
60
|
+
parse_response self.class.post("/" + File.join("watchlist", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
120
61
|
end
|
121
62
|
|
122
63
|
def unwatchlist(shows)
|
123
64
|
shows = [ shows ] if shows.class != Array
|
124
|
-
data = {
|
125
|
-
|
126
|
-
shows: shows.collect{ |s| { title: s.title, year: s.year, imdb_id: s.imdb_id, tvdb_id: s.tvdb_id }}
|
127
|
-
}
|
128
|
-
response = self.class.post("/" + File.join("unwatchlist", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
129
|
-
raise ResponseError.new(response) if response.code != 200
|
130
|
-
|
131
|
-
Mash.new(response.parsed_response)
|
65
|
+
data = @auth.merge({ shows: shows })
|
66
|
+
parse_response self.class.post("/" + File.join("unwatchlist", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
132
67
|
end
|
133
68
|
|
134
69
|
def seen(show)
|
135
|
-
data =
|
136
|
-
|
137
|
-
|
138
|
-
}
|
139
|
-
response = self.class.post("/" + File.join("seen", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
140
|
-
raise ResponseError.new(response) if response.code != 200
|
70
|
+
data = @auth.merge(show)
|
71
|
+
parse_response self.class.post("/" + File.join("seen", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
72
|
+
end
|
141
73
|
|
142
|
-
|
74
|
+
def episode
|
75
|
+
@episode ||= Traktr::Show::Episode.new(@client)
|
143
76
|
end
|
144
77
|
end
|
145
78
|
end
|
data/lib/traktr/show/episode.rb
CHANGED
@@ -1,55 +1,29 @@
|
|
1
1
|
module Traktr
|
2
2
|
class Show
|
3
|
-
class Episode
|
4
|
-
include HTTParty
|
5
|
-
base_uri File.join(Traktr::Show.base_uri, "episode")
|
6
|
-
|
7
|
-
def initialize(client)
|
8
|
-
@client = client
|
9
|
-
end
|
10
|
-
|
11
|
-
##
|
12
|
-
## show-episode GET methods
|
13
|
-
##
|
3
|
+
class Episode < Endpoint
|
14
4
|
def comments(title, season, episode)
|
15
|
-
|
16
|
-
|
5
|
+
parse_response self.class.get("/" + File.join("comments.json", @client.api_key, title, season.to_s, episode.to_s))
|
6
|
+
end
|
17
7
|
|
18
|
-
|
19
|
-
|
20
|
-
end
|
8
|
+
def stats(title, season, episode)
|
9
|
+
parse_response self.class.get("/" + File.join("stats.json", @client.api_key, title, season.to_s, episode.to_s))
|
21
10
|
end
|
22
11
|
|
23
12
|
def summary(title, season, episode)
|
24
|
-
|
25
|
-
raise ResponseError.new(response) if response.code != 200
|
26
|
-
|
27
|
-
Mash.new(response.parsed_response)
|
13
|
+
parse_response self.class.get("/" + File.join("summary.json", @client.api_key, title, season.to_s, episode.to_s))
|
28
14
|
end
|
29
15
|
|
30
16
|
def watchingnow(title, season, episode)
|
31
|
-
|
32
|
-
raise ResponseError.new(response) if response.code != 200
|
33
|
-
|
34
|
-
response.parsed_response.collect do |user|
|
35
|
-
Mash.new(user)
|
36
|
-
end
|
17
|
+
parse_response self.class.get("/" + File.join("watchingnow.json", @client.api_key, title, season.to_s, episode.to_s))
|
37
18
|
end
|
38
19
|
|
39
|
-
|
40
|
-
##
|
41
|
-
## show-episode POST methods
|
42
|
-
##
|
43
20
|
def library(show, episodes)
|
44
21
|
data = {
|
45
22
|
username: @client.username, password: @client.password,
|
46
23
|
title: show.title, year: show.year, imdb_id: show.imdb_id, tvdb_id: show.tvdb_id,
|
47
24
|
episodes: episodes.collect{ |e| { season: e.season, episode: e.episode } }
|
48
25
|
}
|
49
|
-
|
50
|
-
raise ResponseError.new(response) if response.code != 200
|
51
|
-
|
52
|
-
Mash.new(response.parsed_response)
|
26
|
+
parse_response self.class.post("/" + File.join("library", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
53
27
|
end
|
54
28
|
|
55
29
|
def unlibrary(show, episodes)
|
@@ -58,10 +32,7 @@ module Traktr
|
|
58
32
|
title: show.title, year: show.year, imdb_id: show.imdb_id, tvdb_id: show.tvdb_id,
|
59
33
|
episodes: episodes.collect{ |e| { season: e.season, episode: e.episode } }
|
60
34
|
}
|
61
|
-
|
62
|
-
raise ResponseError.new(response) if response.code != 200
|
63
|
-
|
64
|
-
Mash.new(response.parsed_response)
|
35
|
+
parse_response self.class.post("/" + File.join("unlibrary", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
65
36
|
end
|
66
37
|
|
67
38
|
def seen(show, episodes)
|
@@ -70,10 +41,7 @@ module Traktr
|
|
70
41
|
title: show.title, year: show.year, imdb_id: show.imdb_id, tvdb_id: show.tvdb_id,
|
71
42
|
episodes: episodes.collect{ |e| { season: e.season, episode: e.episode } }
|
72
43
|
}
|
73
|
-
|
74
|
-
raise ResponseError.new(response) if response.code != 200
|
75
|
-
|
76
|
-
Mash.new(response.parsed_response)
|
44
|
+
parse_response self.class.post("/" + File.join("seen", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
77
45
|
end
|
78
46
|
|
79
47
|
def unseen(show, episodes)
|
@@ -82,10 +50,7 @@ module Traktr
|
|
82
50
|
title: show.title, year: show.year, imdb_id: show.imdb_id, tvdb_id: show.tvdb_id,
|
83
51
|
episodes: episodes.collect{ |e| { season: e.season, episode: e.episode } }
|
84
52
|
}
|
85
|
-
|
86
|
-
raise ResponseError.new(response) if response.code != 200
|
87
|
-
|
88
|
-
Mash.new(response.parsed_response)
|
53
|
+
parse_response self.class.post("/" + File.join("unseen", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
89
54
|
end
|
90
55
|
|
91
56
|
def watchlist(show, episodes)
|
@@ -94,10 +59,7 @@ module Traktr
|
|
94
59
|
title: show.title, year: show.year, imdb_id: show.imdb_id, tvdb_id: show.tvdb_id,
|
95
60
|
episodes: episodes.collect{ |e| { season: e.season, episode: e.episode } }
|
96
61
|
}
|
97
|
-
|
98
|
-
raise ResponseError.new(response) if response.code != 200
|
99
|
-
|
100
|
-
Mash.new(response.parsed_response)
|
62
|
+
parse_response self.class.post("/" + File.join("watchlist", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
101
63
|
end
|
102
64
|
|
103
65
|
def unwatchlist(show, episodes)
|
@@ -106,10 +68,7 @@ module Traktr
|
|
106
68
|
title: show.title, year: show.year, imdb_id: show.imdb_id, tvdb_id: show.tvdb_id,
|
107
69
|
episodes: episodes.collect{ |e| { season: e.season, episode: e.episode } }
|
108
70
|
}
|
109
|
-
|
110
|
-
raise ResponseError.new(response) if response.code != 200
|
111
|
-
|
112
|
-
Mash.new(response.parsed_response)
|
71
|
+
parse_response self.class.post("/" + File.join("unwatchlist", @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
|
113
72
|
end
|
114
73
|
end
|
115
74
|
end
|