yify 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -229
- data/lib/yify.rb +7 -3
- data/lib/yify/client.rb +307 -95
- data/lib/yify/models/actor.rb +6 -0
- data/lib/yify/models/api_response.rb +0 -2
- data/lib/yify/models/base.rb +18 -0
- data/lib/yify/models/bookmark.rb +6 -0
- data/lib/yify/models/comment.rb +1 -9
- data/lib/yify/models/director.rb +6 -0
- data/lib/yify/models/movie.rb +0 -48
- data/lib/yify/models/parental_guide.rb +6 -0
- data/lib/yify/models/profile.rb +1 -5
- data/lib/yify/models/review.rb +6 -0
- data/lib/yify/models/session.rb +0 -4
- data/lib/yify/models/torrent.rb +6 -0
- data/lib/yify/models/user.rb +1 -13
- data/lib/yify/response.rb +1 -12
- data/lib/yify/support/utils.rb +24 -1
- data/lib/yify/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_add_a_movie_bookmark.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_delete_a_comment.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_delete_a_movie_bookmark.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_edit_a_user_profile.yml +61 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_a_user_key.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_a_user_profile.yml +56 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_movie_bookmarks.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_movie_comments.yml +106 -60
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_movie_details.yml +42 -29
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_movie_parental_guides.yml +106 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_movie_reviews.yml +285 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_movie_suggestions.yml +69 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_upcoming_movies.yml +31 -159
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_user_details.yml +35 -16
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_like_a_comment.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_like_a_movie.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_list_movies.yml +36 -14
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_make_a_comment.yml +60 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_make_a_request.yml +60 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_recover_forgotten_passwords.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_register_a_user.yml +29 -12
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_report_a_comment.yml +59 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_reset_a_password.yml +29 -12
- data/spec/models/base_spec.rb +21 -0
- data/spec/response_spec.rb +7 -11
- data/spec/spec_helper.rb +8 -4
- data/spec/yify_spec.rb +97 -57
- data/yify.gemspec +1 -1
- metadata +44 -38
- data/lib/yify/models/requested_movie.rb +0 -17
- data/lib/yify/models/upcoming_movie.rb +0 -15
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_add_a_request.yml +0 -43
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_edit_a_profile.yml +0 -42
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_a_profile.yml +0 -44
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_requests_list.yml +0 -52
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_login_a_user.yml +0 -42
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_post_a_comment.yml +0 -42
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_recover_passwords.yml +0 -42
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_vote_on_requests.yml +0 -42
- data/spec/models/api_response_spec.rb +0 -6
- data/spec/models/comment_spec.rb +0 -13
- data/spec/models/movie_spec.rb +0 -53
- data/spec/models/profile_spec.rb +0 -21
- data/spec/models/requested_movie_spec.rb +0 -20
- data/spec/models/session_spec.rb +0 -8
- data/spec/models/upcoming_movie_spec.rb +0 -13
- data/spec/models/user_spec.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 444df3202b63cbb563862f2f46f4ec751d91c0ca
|
4
|
+
data.tar.gz: a6f427e5350de1647a29f7a02ea32d7dae927dc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8270e6f9d1840c8a606d931b2430ed0c3b69599dd11c8365d1869da3815c70962de79c22423ef99064285a566f121f09221a3379530041189653b093122b1e6a
|
7
|
+
data.tar.gz: 5f338f9040b02b68466caea1b216d9365b3a9aa20648cae84f0b42fe15536dce91131193da8b0eec2ec6575bba82fd5fc7d99972cd0af213c1eb066dd1aa4408
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/yify.svg)](http://badge.fury.io/rb/yify)
|
4
4
|
|
5
|
-
A Ruby wrapper for the [Yify Torrents API](
|
5
|
+
A Ruby wrapper for the [Yify Torrents API](https://yts.to/api)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -25,249 +25,41 @@ Require Yify in your project:
|
|
25
25
|
require 'yify'
|
26
26
|
|
27
27
|
This gem translates the raw JSON coming back from Yify into full fledged Ruby objects. This means you can access properties like this:
|
28
|
-
|
28
|
+
|
29
29
|
client = Yify::Client.new
|
30
30
|
=> #<Yify::Client:0x007f9b14321ef8>
|
31
|
-
|
32
|
-
movie = client.
|
31
|
+
|
32
|
+
movie = client.movie_details(353).result
|
33
33
|
=> #<Yify::Models::Movie:0x007f9b14360130>
|
34
|
-
|
34
|
+
|
35
35
|
movie.movie_title
|
36
36
|
=> "We Were Soldiers (2002)"
|
37
|
-
|
37
|
+
|
38
38
|
A `Yify::Response` will always return an untouched hash as well, like this:
|
39
|
-
|
40
|
-
movie = client.
|
41
|
-
=> {"
|
42
|
-
"MovieUrl"=>"http://yts.to/movie/We_Were_Soldiers_2002",
|
39
|
+
|
40
|
+
movie = client.movie_details(353).response
|
41
|
+
=> {"id"=>"353",
|
43
42
|
"DateUploaded"=>"2011-08-31 01:04:02",
|
44
43
|
... }
|
45
|
-
|
46
|
-
movie["MovieID"]
|
47
|
-
=> "353"
|
48
|
-
|
49
|
-
#### Upcoming Movies, [yify docs](http://yify-torrents.com/api/#upcomingDocs)
|
50
|
-
|
51
|
-
Get a list of all upcoming movies.
|
52
|
-
|
53
|
-
client = Yify::Client.new
|
54
|
-
movies = client.upcoming.result
|
55
|
-
|
56
|
-
#### List Movies, [yify docs](http://yify-torrents.com/api/#listDocs)
|
57
|
-
|
58
|
-
Get a list of movies, this can also be used to search or filter all movies on Yify.
|
59
|
-
|
60
|
-
params = { limit: 50, quality: 720 }
|
61
|
-
client = Yify::Client.new
|
62
|
-
movies = client.list(params).result
|
63
|
-
|
64
|
-
Available request parameters:
|
65
|
-
|
66
|
-
Parameter |required | Default | Description
|
67
|
-
----------|---------|---------|----
|
68
|
-
`limit` | **no** |20 |Determines the max amount of movie results
|
69
|
-
`set` | **no** |1 |Used to see the next set of movies, eg limit=15 and set=2 will show you movies 15-30
|
70
|
-
`quality` | **no** |ALL |Ability to select a quality type to filter by
|
71
|
-
`rating` | **no** |0 |Sets minimum movie rating for display
|
72
|
-
`keywords`| **no** | |Matching keywords title search, IMDB code, Actor Name/IMDB code or Director Name/IMDB code
|
73
|
-
`genre` | **no** | ALL |Display movies from chosen type genre
|
74
|
-
`sort` | **no** | date |Sorts the results by choose method
|
75
|
-
`order` | **no** | desc |Orders the results with either ascending or descending
|
76
|
-
|
77
|
-
#### List Movies By IMDB ID, [yify docs](http://yify-torrents.com/api/#listimdbDocs)
|
78
|
-
|
79
|
-
Get a list of movies based on IMDB IDs.
|
80
|
-
|
81
|
-
params = { imdb_id: ["tt0111161", "tt0068646"] }
|
82
|
-
client = Yify::Client.new
|
83
|
-
movies = client.list_imdb(params).result
|
84
|
-
|
85
|
-
Available request parameters:
|
86
|
-
|
87
|
-
Parameter |required | Default | Description
|
88
|
-
----------|----------|---------|----
|
89
|
-
`imdb_id` | **yes** | |he input IMDB IDs to retrieve the movies for
|
90
|
-
|
91
|
-
#### Movie Details, [yify docs](http://yify-torrents.com/api/#movieDocs)
|
92
|
-
|
93
|
-
Get an individual movie.
|
94
|
-
|
95
|
-
client = Yify::Client.new
|
96
|
-
movie = client.movie(353).result
|
97
|
-
|
98
|
-
Available request parameters:
|
99
|
-
|
100
|
-
Parameter |required | Default | Description
|
101
|
-
----------|----------|---------|----
|
102
|
-
`id` | **yes** | |View full details of specified MovieID
|
103
|
-
|
104
|
-
#### Movie Comments, [yify docs](http://yify-torrents.com/api/#commentDocs)
|
105
|
-
|
106
|
-
Get all comments related to a movie.
|
107
|
-
|
108
|
-
client = Yify::Client.new
|
109
|
-
comments = client.comments(353).results
|
110
|
-
|
111
|
-
Available request parameters:
|
112
|
-
|
113
|
-
Parameter |required | Default | Description
|
114
|
-
----------|----------|---------|----
|
115
|
-
`movieid` | **yes** | |View full list of comments for specified film
|
116
|
-
|
117
|
-
#### User Details, [yify docs](http://yify-torrents.com/api/#userDocs)
|
118
|
-
|
119
|
-
Get details for specified user.
|
120
|
-
|
121
|
-
client = Yify::Client.new
|
122
|
-
user = client.user(16).results
|
123
|
-
|
124
|
-
Available request parameters:
|
125
|
-
|
126
|
-
Parameter |required | Default | Description
|
127
|
-
----------|----------|---------|----
|
128
|
-
`id` | **yes** | |The unique userID that we want to see the info for
|
129
44
|
|
130
|
-
|
131
|
-
|
132
|
-
Register a new user. Upon successful registration a confirmation email will be sent.
|
133
|
-
|
134
|
-
params = { username: "my_user", password: "test1234", email: "me@me.com" }
|
135
|
-
client = Yify::Client.new
|
136
|
-
client.register(params)
|
137
|
-
|
138
|
-
Available request parameters:
|
139
|
-
|
140
|
-
Parameter |required | Description
|
141
|
-
----------|----------|-------------
|
142
|
-
`username`| **yes** |The username of the desired account
|
143
|
-
`password`| **yes** |The username of the desired account
|
144
|
-
`email` | **yes** |The email address for verification
|
145
|
-
|
146
|
-
#### Password Recovery, [yify docs](http://yify-torrents.com/api/#passRecoveryDoc)
|
147
|
-
|
148
|
-
Ask Yify for a password recovery email.
|
149
|
-
|
150
|
-
client = Yify::Client.new
|
151
|
-
client.send_password_reset("me@me.com")
|
152
|
-
|
153
|
-
Available request parameters:
|
154
|
-
|
155
|
-
Parameter |required | Description
|
156
|
-
----------|----------|-------------
|
157
|
-
`email` | **yes** |The email address that was registered with the account to send recovery code to
|
158
|
-
|
159
|
-
#### Resetting Password, [yify docs](http://yify-torrents.com/api/#resetPasswordDocs)
|
160
|
-
|
161
|
-
Send the new password to Yify.
|
162
|
-
|
163
|
-
params = { code: "xxxxxxxxxx", newpassword: "MyPassword" }
|
164
|
-
client = Yify::Client.new
|
165
|
-
client.reset_password(params)
|
166
|
-
|
167
|
-
Available request parameters:
|
168
|
-
|
169
|
-
Parameter |required | Description
|
170
|
-
-------------|----------|-------------
|
171
|
-
`code` | **yes** |The password reset code from email
|
172
|
-
`newpassword`| **yes** |The new desired password for the account
|
173
|
-
|
174
|
-
#### Login, [yify docs](http://yify-torrents.com/api/#loginDocs)
|
175
|
-
|
176
|
-
Login a user.
|
177
|
-
|
178
|
-
params = { username: "username", password: "password" }
|
179
|
-
client = Yify::Client.new
|
180
|
-
client.login(params)
|
181
|
-
|
182
|
-
The result of this call will be a Yify::Models::Session object that will store the returned user hash from Yify.
|
183
|
-
|
184
|
-
Available request parameters:
|
185
|
-
|
186
|
-
Parameter |required | Description
|
187
|
-
----------|----------|-------------
|
188
|
-
`username`| **yes** |The username of the desired account
|
189
|
-
`password`| **yes** |The username of the desired account
|
190
|
-
|
191
|
-
#### Profile, [yify docs](https://yts.to/api#profileDocs)
|
192
|
-
|
193
|
-
Get details about a users' profile.
|
194
|
-
|
195
|
-
client = Yify::Client.new
|
196
|
-
profile = client.profile(hash_returned_from_the_login_call)
|
197
|
-
|
198
|
-
Available request parameters:
|
199
|
-
|
200
|
-
Parameter |required | Description
|
201
|
-
----------|----------|-------------
|
202
|
-
`hash` | **yes** |The unique hash that will be used as a means of authentication
|
203
|
-
|
204
|
-
#### Edit Profile, [yify docs](https://yts.to/api#editProfileDocs)
|
205
|
-
|
206
|
-
Edit a users' profile.
|
207
|
-
|
208
|
-
params = { hash: hash_returned_from_the_login_call, about: "RUBY FTW!" }
|
209
|
-
client = Yify::Client.new
|
210
|
-
client.update_profile(params)
|
211
|
-
|
212
|
-
Available request parameters:
|
213
|
-
|
214
|
-
Parameter |required | Description
|
215
|
-
--------------|----------|-------------
|
216
|
-
`hash` | **yes** |The unique hash that will be used as a means of authentication
|
217
|
-
`active` | **no** |By default all profiles are showing and active(1), 0 will make them hidden
|
218
|
-
`about` | **no** |Text describing the user in a short paragraph
|
219
|
-
`new password` | **no** |The new desired password (required 'oldpassword' for confirmation)
|
220
|
-
`old password` | **no** |The old password as confirmation
|
221
|
-
`avatar` | **no** |This will be the newest avatar image for the user
|
222
|
-
|
223
|
-
#### Requests, [yify docs](https://yts.to/api#requestsDocs)
|
224
|
-
|
225
|
-
Get a list of all currently requested movies.
|
226
|
-
|
227
|
-
params = { page: "confirmed", limit: 2 }
|
228
|
-
client = Yifi::Client.new
|
229
|
-
requests = client.requests(params)
|
230
|
-
|
231
|
-
|
232
|
-
Available request parameters:
|
233
|
-
|
234
|
-
Parameter |required | Description
|
235
|
-
--------------|----------|-------------
|
236
|
-
`page` | **yes** |'accepted' or 'confirmed'. Gives the choice to view the currently open movies for voting and the confirmed movies to be done
|
237
|
-
`limit` | **no** |Determines the max amount of request results
|
238
|
-
`set` | **no** |set to see the next set of movies, eg limit=15 and set=2 will show you movies 15-30
|
239
|
-
`sort` | **no** |Sorts the results by choose method
|
240
|
-
`order` | **no** |Orders the results with either ascending or descending
|
241
|
-
|
242
|
-
#### Make Request, [yify docs](https://yts.to/api#makerequestsDocs)
|
45
|
+
movie["id"]
|
46
|
+
=> "353"
|
243
47
|
|
244
|
-
|
245
|
-
|
246
|
-
params = { hash: hash_returned_from_the_login_call, request: "tt0111161" }
|
247
|
-
client - Yify::Client.new
|
248
|
-
client.make_request(params)
|
249
|
-
|
250
|
-
Available request parameters:
|
48
|
+
Note about POST request. You will have to provide your own `application_key` per
|
49
|
+
POST request. You can request an `application_key` [here](https://yts.to/contact).
|
251
50
|
|
252
|
-
Parameter |required | Description
|
253
|
-
--------------|----------|-------------
|
254
|
-
`hash` | **yes** |The unique hash that will be used as a means of authentication
|
255
|
-
`request` | **yes** |Request input can be: Movie name or IMDB Code or IMDB URL
|
256
51
|
|
257
|
-
####
|
52
|
+
#### API Documentation
|
258
53
|
|
259
|
-
|
54
|
+
You can view the full YTS API documentation [here](https://yts.to/api). Every
|
55
|
+
request documented is implemented by this gem, please file an issue if you find
|
56
|
+
a request that is not implemented.
|
260
57
|
|
261
|
-
|
262
|
-
client = Yify::Client.new
|
263
|
-
client.vote(params)
|
264
|
-
|
265
|
-
Available request parameters:
|
58
|
+
## Change Log
|
266
59
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
`requested` | **yes** |The request ID you wish to vote on
|
60
|
+
- **0.0.3:** Implement YTS API V2
|
61
|
+
- **0.0.2:** Update base_uri from yts.re -> yts.to
|
62
|
+
- **0.0.1:** Initial release
|
271
63
|
|
272
64
|
## Contributing
|
273
65
|
|
data/lib/yify.rb
CHANGED
@@ -2,14 +2,18 @@ require 'httparty'
|
|
2
2
|
require 'dotenv'
|
3
3
|
require 'yify/support/utils.rb'
|
4
4
|
require 'yify/models/base.rb'
|
5
|
-
require 'yify/models/
|
6
|
-
require 'yify/models/
|
7
|
-
require 'yify/models/
|
5
|
+
require 'yify/models/torrent.rb'
|
6
|
+
require 'yify/models/director.rb'
|
7
|
+
require 'yify/models/actor.rb'
|
8
8
|
require 'yify/models/comment.rb'
|
9
|
+
require 'yify/models/movie.rb'
|
10
|
+
require 'yify/models/review.rb'
|
9
11
|
require 'yify/models/user.rb'
|
10
12
|
require 'yify/models/profile.rb'
|
11
13
|
require 'yify/models/api_response.rb'
|
14
|
+
require 'yify/models/parental_guide.rb'
|
12
15
|
require 'yify/models/session.rb'
|
16
|
+
require 'yify/models/bookmark.rb'
|
13
17
|
require 'yify/response'
|
14
18
|
require 'yify/client'
|
15
19
|
|
data/lib/yify/client.rb
CHANGED
@@ -3,182 +3,394 @@
|
|
3
3
|
module Yify
|
4
4
|
class Client
|
5
5
|
include HTTParty
|
6
|
-
base_uri 'http://yts.to/api'
|
6
|
+
base_uri 'http://yts.to/api/v2'
|
7
7
|
format :json
|
8
8
|
|
9
|
-
# [GET]
|
10
|
-
# See: https://yts.to/api#
|
11
|
-
#
|
12
|
-
# A list of all upcoming movies.
|
13
|
-
#
|
14
|
-
# @returns [Yify::Models::UpcomingMovie]
|
15
|
-
def upcoming
|
16
|
-
data = self.class.get("/upcoming")
|
17
|
-
Yify::Response.new(data, :upcoming_movie)
|
18
|
-
end
|
19
|
-
|
20
|
-
# [GET] list
|
21
|
-
# See: https://yts.to/api#listDocs
|
9
|
+
# [GET] list_movies
|
10
|
+
# See: https://yts.to/api#list_movies
|
22
11
|
#
|
23
12
|
# Get a list of movies, this method can be used to search
|
24
13
|
# or filter.
|
25
14
|
#
|
26
|
-
# @
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
15
|
+
# @params
|
16
|
+
# limit: Integer between 1 - 50 (inclusive)
|
17
|
+
# page: Integer
|
18
|
+
# quality: String
|
19
|
+
# minimum_rating Integer between 0 - 9 (inclusive)
|
20
|
+
# query_term: String
|
21
|
+
# genre: String
|
22
|
+
# sort_by: String (title, year, rating, peers, seeds, download_count, like_count, date_added)
|
23
|
+
# order_by: String (desc, asc)
|
24
|
+
# with_rt_ratting: Boolean (returns with rotten tomatoes rating)
|
36
25
|
#
|
37
26
|
# @returns [Yify::Models::Movie]
|
38
|
-
|
39
|
-
|
40
|
-
|
27
|
+
|
28
|
+
def list_movies(params)
|
29
|
+
data = self.class.get("/list_movies", { query: params })
|
30
|
+
Yify::Response.new(data, :movies)
|
41
31
|
end
|
42
32
|
|
43
|
-
# [GET]
|
44
|
-
# See: https://yts.to/api#
|
33
|
+
# [GET] movie_details
|
34
|
+
# See: https://yts.to/api#movie_details
|
45
35
|
#
|
46
36
|
# Get movie details.
|
47
37
|
#
|
38
|
+
# @params
|
39
|
+
# movie_id: Integer (required)
|
40
|
+
# with_images: Boolean
|
41
|
+
# with_cast: Boolean
|
42
|
+
#
|
48
43
|
# @returns Yify::Models::Movie
|
49
|
-
|
50
|
-
|
44
|
+
|
45
|
+
def movie_details(params)
|
46
|
+
data = self.class.get("/movie_details", { query: params })
|
51
47
|
Yify::Response.new(data, :movie)
|
52
48
|
end
|
53
49
|
|
54
|
-
# [GET]
|
55
|
-
# See: https://yts.to/api#
|
50
|
+
# [GET] movie_suggestions
|
51
|
+
# See: https://yts.to/api#movie_suggestions
|
52
|
+
#
|
53
|
+
# Returns 4 related movies as suggestions for the user
|
54
|
+
#
|
55
|
+
# @params
|
56
|
+
# movie_id: Integer (required)
|
57
|
+
#
|
58
|
+
# @returns [Yify::Models::Movie]
|
59
|
+
|
60
|
+
def movie_suggestions(movie_id)
|
61
|
+
data = self.class.get("/movie_suggestions", { query: { movie_id: movie_id } })
|
62
|
+
Yify::Response.new(data, :movie_suggestions)
|
63
|
+
end
|
64
|
+
|
65
|
+
# [GET] movie_comments
|
66
|
+
# See: https://yts.to/api#movie_comments
|
56
67
|
#
|
57
68
|
# Get comments for the desired movie
|
58
69
|
#
|
70
|
+
# @params
|
71
|
+
# movie_id: Integer (required)
|
72
|
+
#
|
59
73
|
# @returns [Yify::Models::Comment]
|
60
|
-
|
61
|
-
|
62
|
-
|
74
|
+
|
75
|
+
def movie_comments(movie_id)
|
76
|
+
data = self.class.get("/movie_comments", { query: { movie_id: movie_id } })
|
77
|
+
Yify::Response.new(data, :comments)
|
63
78
|
end
|
64
79
|
|
65
|
-
# [
|
66
|
-
# See: https://yts.to/api#
|
80
|
+
# [GET] movie_reviews
|
81
|
+
# See: https://yts.to/api#movie_reviews
|
67
82
|
#
|
68
|
-
#
|
83
|
+
# Get reviews for the desired movie
|
69
84
|
#
|
70
|
-
# @
|
71
|
-
|
72
|
-
|
73
|
-
|
85
|
+
# @params
|
86
|
+
# movie_id: Integer (required)
|
87
|
+
#
|
88
|
+
# @returns [Yify::Models::Review]
|
89
|
+
|
90
|
+
def movie_reviews(movie_id)
|
91
|
+
data = self.class.get("/movie_reviews", { query: { movie_id: movie_id } })
|
92
|
+
Yify::Response.new(data, :reviews)
|
93
|
+
end
|
94
|
+
|
95
|
+
# [GET] movie_parental_guides
|
96
|
+
# See: https://yts.to/api#movie_parental_guides
|
97
|
+
#
|
98
|
+
# Get parental guides for the desired movie
|
99
|
+
#
|
100
|
+
# @params
|
101
|
+
# movie_id: Integer (required)
|
102
|
+
#
|
103
|
+
# @returns [Yify::Models::ParentalGuide]
|
104
|
+
|
105
|
+
def movie_parental_guides(movie_id)
|
106
|
+
data = self.class.get("/movie_parental_guides", { query: { movie_id: movie_id } })
|
107
|
+
Yify::Response.new(data, :parental_guides)
|
74
108
|
end
|
75
109
|
|
76
|
-
# [GET]
|
77
|
-
# See: https://yts.to/api#
|
110
|
+
# [GET] list_upcoming
|
111
|
+
# See: https://yts.to/api#list_upcoming
|
112
|
+
#
|
113
|
+
# A list of all upcoming movies.
|
114
|
+
#
|
115
|
+
# @returns [Yify::Models::UpcomingMovie]
|
116
|
+
|
117
|
+
def list_upcoming
|
118
|
+
data = self.class.get("/list_upcoming")
|
119
|
+
Yify::Response.new(data, :upcoming_movies)
|
120
|
+
end
|
121
|
+
|
122
|
+
# [GET] user_details
|
123
|
+
# See: https://yts.to/api#user_details
|
78
124
|
#
|
79
125
|
# Get desired users' details.
|
80
126
|
#
|
127
|
+
# @params
|
128
|
+
# user_id: Integer (required)
|
129
|
+
# with_recently_downloaded: Boolean
|
130
|
+
#
|
131
|
+
# @returns Yify::Models::User
|
132
|
+
|
133
|
+
def user_details(params)
|
134
|
+
data = self.class.get("/user_details", { query: params })
|
135
|
+
Yify::Response.new(data, :user)
|
136
|
+
end
|
137
|
+
|
138
|
+
# [POST] get_user_key
|
139
|
+
# See: https://yts.to/api#get_user_key
|
140
|
+
#
|
141
|
+
# The same as logging in, if successful the returned data will
|
142
|
+
# include the user_key for later use of the API as a means of authentication
|
143
|
+
#
|
144
|
+
# @params (all required)
|
145
|
+
# username: String
|
146
|
+
# password: String
|
147
|
+
# application_key: String
|
148
|
+
#
|
149
|
+
# @returns [Yify::Models::Session]
|
150
|
+
|
151
|
+
def user_get_key(params)
|
152
|
+
data = self.class.post("/user_get_key", { body: params })
|
153
|
+
Yify::Response.new(data, :session)
|
154
|
+
end
|
155
|
+
|
156
|
+
# [GET] user_profile
|
157
|
+
# See: https://yts.to/api#user_profile
|
158
|
+
#
|
159
|
+
# Get a logged in user's profile.
|
160
|
+
#
|
161
|
+
# @params
|
162
|
+
# user_key: String (required) response from user_get_key
|
163
|
+
#
|
81
164
|
# @returns Yify::Models::User
|
82
|
-
|
83
|
-
|
165
|
+
|
166
|
+
def user_profile(user_key)
|
167
|
+
data = self.class.get("/user_profile", { query: { user_key: user_key } })
|
84
168
|
Yify::Response.new(data, :user)
|
85
169
|
end
|
86
170
|
|
87
|
-
# [POST]
|
88
|
-
# See: https://yts.to/api#
|
171
|
+
# [POST] user_edit_settings
|
172
|
+
# See: https://yts.to/api#user_edit_settings
|
173
|
+
#
|
174
|
+
# update a logged in user's profile.
|
175
|
+
#
|
176
|
+
# @params
|
177
|
+
# user_key: String (required)
|
178
|
+
# application_key: String (required)
|
179
|
+
# new_password: String
|
180
|
+
# about_text: String
|
181
|
+
# avatar_image: img, jpg, jpef, gif, png (10MB max)
|
182
|
+
#
|
183
|
+
# @returns Yify::Models::User
|
184
|
+
|
185
|
+
def user_edit_settings(params)
|
186
|
+
data = self.class.post("/user_edit_settings", { body: params })
|
187
|
+
Yify::Response.new(data, :user)
|
188
|
+
end
|
189
|
+
|
190
|
+
# [POST] user_register
|
191
|
+
# See: https://yts.to/api#user_register
|
89
192
|
#
|
90
193
|
# Register a new user with Yify.
|
91
194
|
#
|
195
|
+
# @params
|
196
|
+
# application_key: String (required)
|
197
|
+
# username: String (required)
|
198
|
+
# password: String (required)
|
199
|
+
# email: String (required)
|
200
|
+
#
|
201
|
+
# @returns Yify::Models::Session
|
202
|
+
|
203
|
+
def user_register(params)
|
204
|
+
data = self.class.post("/user_register", { body: params })
|
205
|
+
Yify::Response.new(data, :session)
|
206
|
+
end
|
207
|
+
|
208
|
+
# [POST] user_forgot_password
|
209
|
+
# https://yts.to/api#user_forgot_password
|
210
|
+
#
|
211
|
+
# Send a password reset email to the specified email address.
|
212
|
+
#
|
213
|
+
# @params
|
214
|
+
# email: String (required)
|
215
|
+
# application_key: String (required)
|
216
|
+
#
|
92
217
|
# @returns Yify::Models::ApiResponse
|
93
|
-
|
94
|
-
|
218
|
+
|
219
|
+
def user_forgot_password(params)
|
220
|
+
data = self.class.post("/user_forgot_password", { body: params })
|
95
221
|
Yify::Response.new(data, :api_response)
|
96
222
|
end
|
97
223
|
|
98
|
-
# [POST]
|
99
|
-
# See: https://yts.to/api#
|
224
|
+
# [POST] user_reset_password
|
225
|
+
# See: https://yts.to/api#user_reset_password
|
226
|
+
#
|
227
|
+
# Reset the users' password.
|
100
228
|
#
|
101
|
-
#
|
229
|
+
# @params
|
230
|
+
# reset_code: String (required)
|
231
|
+
# new_password: String (required)
|
232
|
+
# application_key: String (required)
|
102
233
|
#
|
103
234
|
# @returns Yify::Models::Session
|
104
|
-
|
105
|
-
|
235
|
+
|
236
|
+
def user_reset_password(params)
|
237
|
+
data = self.class.post("/user_reset_password", { body: params })
|
106
238
|
Yify::Response.new(data, :session)
|
107
239
|
end
|
108
240
|
|
109
|
-
# [POST]
|
110
|
-
# https://yts.to/api#
|
241
|
+
# [POST] like_movie
|
242
|
+
# See: https://yts.to/api#like_movie
|
111
243
|
#
|
112
|
-
#
|
244
|
+
# Reset the users' password.
|
245
|
+
#
|
246
|
+
# @params
|
247
|
+
# user_key: String (required)
|
248
|
+
# movie_id: Integer (required)
|
249
|
+
# application_key: String (required)
|
113
250
|
#
|
114
251
|
# @returns Yify::Models::ApiResponse
|
115
|
-
|
116
|
-
|
252
|
+
|
253
|
+
def like_movie(params)
|
254
|
+
data = self.class.post("/like_movie", { body: params })
|
117
255
|
Yify::Response.new(data, :api_response)
|
118
256
|
end
|
119
257
|
|
120
|
-
# [
|
121
|
-
# See: https://yts.to/api#
|
258
|
+
# [GET] get_movie_bookmarks
|
259
|
+
# See: https://yts.to/api#get_movie_bookmarks
|
122
260
|
#
|
123
|
-
#
|
124
|
-
|
125
|
-
|
261
|
+
# Get all the current movies which have been bookmarked for a given user
|
262
|
+
#
|
263
|
+
# @params
|
264
|
+
# user_key: String (required)
|
265
|
+
# with_rt_rattings: Boolean
|
266
|
+
#
|
267
|
+
# @returns [Yify::Models::Bookmark]
|
268
|
+
|
269
|
+
def get_movie_bookmarks(params)
|
270
|
+
data = self.class.get("/get_movie_bookmarks", { query: params })
|
271
|
+
Yify::Response.new(data, :bookmarks)
|
272
|
+
end
|
273
|
+
|
274
|
+
# [POST] add_movie_bookmark
|
275
|
+
# See: https://yts.to/api#add_movie_bookmark
|
276
|
+
#
|
277
|
+
# Get all the current movies which have been bookmarked for a given user
|
278
|
+
#
|
279
|
+
# @params
|
280
|
+
# user_key: String (required)
|
281
|
+
# movie_id: Integer (required)
|
282
|
+
# application_key: String (required)
|
283
|
+
#
|
284
|
+
# @returns Yify::Models::Bookmark
|
285
|
+
|
286
|
+
def add_movie_bookmark(params)
|
287
|
+
data = self.class.post("/add_movie_bookmark", { body: params })
|
288
|
+
Yify::Response.new(data, :bookmark)
|
289
|
+
end
|
290
|
+
|
291
|
+
# [POST] delete_movie_bookmark
|
292
|
+
# See: https://yts.to/api#delete_movie_bookmark
|
293
|
+
#
|
294
|
+
# remove movies from the user's bookmarks
|
295
|
+
#
|
296
|
+
# @params
|
297
|
+
# user_key: String (required)
|
298
|
+
# movie_id: Integer (required)
|
299
|
+
# application_key: String (required)
|
300
|
+
#
|
301
|
+
# @returns Yify::Models::Bookmark
|
302
|
+
|
303
|
+
def delete_movie_bookmark(params)
|
304
|
+
data = self.class.post("/delete_movie_bookmark", { body: params })
|
126
305
|
Yify::Response.new(data, :api_response)
|
127
306
|
end
|
128
307
|
|
129
|
-
# [
|
130
|
-
# See: https://yts.to/api#
|
308
|
+
# [POST] make_comment
|
309
|
+
# See: https://yts.to/api#make_comment
|
310
|
+
#
|
311
|
+
# Add comment to a movie.
|
131
312
|
#
|
132
|
-
#
|
313
|
+
# @params
|
314
|
+
# user_key: String (required)
|
315
|
+
# movie_id: Integer (required)
|
316
|
+
# comment_text: String (required)
|
317
|
+
# application_key: String (required)
|
133
318
|
#
|
134
|
-
# @returns Yify::Models::
|
135
|
-
|
136
|
-
|
137
|
-
|
319
|
+
# @returns Yify::Models::ApiResponse
|
320
|
+
|
321
|
+
def make_comment(params)
|
322
|
+
data = self.class.post("/make_comment", { body: params })
|
323
|
+
Yify::Response.new(data, :api_response)
|
138
324
|
end
|
139
325
|
|
140
|
-
# [POST]
|
141
|
-
# See: https://yts.to/api#
|
326
|
+
# [POST] like_comment
|
327
|
+
# See: https://yts.to/api#like_comment
|
328
|
+
#
|
329
|
+
# Like a comment on a movie
|
142
330
|
#
|
143
|
-
#
|
331
|
+
# @params
|
332
|
+
# user_key: String (required)
|
333
|
+
# comment_id: Integer (required)
|
334
|
+
# application_key: String (required)
|
144
335
|
#
|
145
336
|
# @returns Yify::Models::ApiResponse
|
146
|
-
|
147
|
-
|
337
|
+
|
338
|
+
def like_comment(params)
|
339
|
+
data = self.class.post("/like_comment", { body: params })
|
148
340
|
Yify::Response.new(data, :api_response)
|
149
341
|
end
|
150
342
|
|
151
|
-
# [
|
152
|
-
# See: https://yts.to/api#
|
343
|
+
# [POST] report_comment
|
344
|
+
# See: https://yts.to/api#report_comment
|
345
|
+
#
|
346
|
+
# Report a comment on a movie
|
153
347
|
#
|
154
|
-
#
|
348
|
+
# @params
|
349
|
+
# user_key: String (required)
|
350
|
+
# comment_id: Integer (required)
|
351
|
+
# application_key: String (required)
|
155
352
|
#
|
156
|
-
# @returns
|
157
|
-
|
158
|
-
|
159
|
-
|
353
|
+
# @returns Yify::Models::ApiResponse
|
354
|
+
|
355
|
+
def report_comment(params)
|
356
|
+
data = self.class.post("/report_comment", { body: params })
|
357
|
+
Yify::Response.new(data, :api_response)
|
160
358
|
end
|
161
359
|
|
162
|
-
# [POST]
|
163
|
-
# See: https://yts.to/api#
|
360
|
+
# [POST] delete_comment
|
361
|
+
# See: https://yts.to/api#delete_comment
|
164
362
|
#
|
165
|
-
#
|
363
|
+
# Delete a comment on a movie
|
364
|
+
#
|
365
|
+
# @params
|
366
|
+
# user_key: String (required)
|
367
|
+
# comment_id: Integer (required)
|
368
|
+
# application_key: String (required)
|
166
369
|
#
|
167
370
|
# @returns Yify::Models::ApiResponse
|
168
|
-
|
169
|
-
|
371
|
+
|
372
|
+
def delete_comment(params)
|
373
|
+
data = self.class.post("/delete_comment", { body: params })
|
170
374
|
Yify::Response.new(data, :api_response)
|
171
375
|
end
|
172
376
|
|
173
|
-
# [POST]
|
174
|
-
# See: https://yts.to/api#
|
377
|
+
# [POST] make_request
|
378
|
+
# See: https://yts.to/api#make_request
|
175
379
|
#
|
176
|
-
#
|
380
|
+
# Request a movie to be added to Yify.
|
381
|
+
#
|
382
|
+
# @params
|
383
|
+
# user_key: String (required)
|
384
|
+
# movie_title: String (required)
|
385
|
+
# application_key: String (required)
|
386
|
+
# request_message: String
|
177
387
|
#
|
178
388
|
# @returns Yify::Models::ApiResponse
|
179
|
-
|
180
|
-
|
389
|
+
|
390
|
+
def make_request(params)
|
391
|
+
data = self.class.post("/make_request", { body: params })
|
181
392
|
Yify::Response.new(data, :api_response)
|
182
393
|
end
|
394
|
+
|
183
395
|
end
|
184
396
|
end
|