yify 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -229
  3. data/lib/yify.rb +7 -3
  4. data/lib/yify/client.rb +307 -95
  5. data/lib/yify/models/actor.rb +6 -0
  6. data/lib/yify/models/api_response.rb +0 -2
  7. data/lib/yify/models/base.rb +18 -0
  8. data/lib/yify/models/bookmark.rb +6 -0
  9. data/lib/yify/models/comment.rb +1 -9
  10. data/lib/yify/models/director.rb +6 -0
  11. data/lib/yify/models/movie.rb +0 -48
  12. data/lib/yify/models/parental_guide.rb +6 -0
  13. data/lib/yify/models/profile.rb +1 -5
  14. data/lib/yify/models/review.rb +6 -0
  15. data/lib/yify/models/session.rb +0 -4
  16. data/lib/yify/models/torrent.rb +6 -0
  17. data/lib/yify/models/user.rb +1 -13
  18. data/lib/yify/response.rb +1 -12
  19. data/lib/yify/support/utils.rb +24 -1
  20. data/lib/yify/version.rb +1 -1
  21. data/spec/fixtures/vcr_cassettes/Yify_Client/should_add_a_movie_bookmark.yml +59 -0
  22. data/spec/fixtures/vcr_cassettes/Yify_Client/should_delete_a_comment.yml +59 -0
  23. data/spec/fixtures/vcr_cassettes/Yify_Client/should_delete_a_movie_bookmark.yml +59 -0
  24. data/spec/fixtures/vcr_cassettes/Yify_Client/should_edit_a_user_profile.yml +61 -0
  25. data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_a_user_key.yml +59 -0
  26. data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_a_user_profile.yml +56 -0
  27. data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_movie_bookmarks.yml +59 -0
  28. data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_movie_comments.yml +106 -60
  29. data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_movie_details.yml +42 -29
  30. data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_movie_parental_guides.yml +106 -0
  31. data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_movie_reviews.yml +285 -0
  32. data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_movie_suggestions.yml +69 -0
  33. data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_upcoming_movies.yml +31 -159
  34. data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_user_details.yml +35 -16
  35. data/spec/fixtures/vcr_cassettes/Yify_Client/should_like_a_comment.yml +59 -0
  36. data/spec/fixtures/vcr_cassettes/Yify_Client/should_like_a_movie.yml +59 -0
  37. data/spec/fixtures/vcr_cassettes/Yify_Client/should_list_movies.yml +36 -14
  38. data/spec/fixtures/vcr_cassettes/Yify_Client/should_make_a_comment.yml +60 -0
  39. data/spec/fixtures/vcr_cassettes/Yify_Client/should_make_a_request.yml +60 -0
  40. data/spec/fixtures/vcr_cassettes/Yify_Client/should_recover_forgotten_passwords.yml +59 -0
  41. data/spec/fixtures/vcr_cassettes/Yify_Client/should_register_a_user.yml +29 -12
  42. data/spec/fixtures/vcr_cassettes/Yify_Client/should_report_a_comment.yml +59 -0
  43. data/spec/fixtures/vcr_cassettes/Yify_Client/should_reset_a_password.yml +29 -12
  44. data/spec/models/base_spec.rb +21 -0
  45. data/spec/response_spec.rb +7 -11
  46. data/spec/spec_helper.rb +8 -4
  47. data/spec/yify_spec.rb +97 -57
  48. data/yify.gemspec +1 -1
  49. metadata +44 -38
  50. data/lib/yify/models/requested_movie.rb +0 -17
  51. data/lib/yify/models/upcoming_movie.rb +0 -15
  52. data/spec/fixtures/vcr_cassettes/Yify_Client/should_add_a_request.yml +0 -43
  53. data/spec/fixtures/vcr_cassettes/Yify_Client/should_edit_a_profile.yml +0 -42
  54. data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_a_profile.yml +0 -44
  55. data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_requests_list.yml +0 -52
  56. data/spec/fixtures/vcr_cassettes/Yify_Client/should_login_a_user.yml +0 -42
  57. data/spec/fixtures/vcr_cassettes/Yify_Client/should_post_a_comment.yml +0 -42
  58. data/spec/fixtures/vcr_cassettes/Yify_Client/should_recover_passwords.yml +0 -42
  59. data/spec/fixtures/vcr_cassettes/Yify_Client/should_vote_on_requests.yml +0 -42
  60. data/spec/models/api_response_spec.rb +0 -6
  61. data/spec/models/comment_spec.rb +0 -13
  62. data/spec/models/movie_spec.rb +0 -53
  63. data/spec/models/profile_spec.rb +0 -21
  64. data/spec/models/requested_movie_spec.rb +0 -20
  65. data/spec/models/session_spec.rb +0 -8
  66. data/spec/models/upcoming_movie_spec.rb +0 -13
  67. data/spec/models/user_spec.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c77d1e69e4e5daff8c3e3c8cff2c2e71c0e5de6c
4
- data.tar.gz: 6877a4665e7894606465fde4277bd8fb5c4e67a1
3
+ metadata.gz: 444df3202b63cbb563862f2f46f4ec751d91c0ca
4
+ data.tar.gz: a6f427e5350de1647a29f7a02ea32d7dae927dc7
5
5
  SHA512:
6
- metadata.gz: 344a85a4bd8a8f51da22e64abc918748b1fbef5f50c54be3fd92a3a7b33c2592a4fdb071f6383d0dcdce5c70def1e08a8ab2da2ae61c28571ad07f1b03a53089
7
- data.tar.gz: 23489e91340310d2e790038e74ef6dbf8f48e21fdcd29e7825f18ebc9c7e14439d24fa20ca59086eca78154d754bc1a346bff40856588af56be917be8b8518ff
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](http://yify-torrents.com/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.movie(353).result
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.movie(353).response
41
- => {"MovieID"=>"353",
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
- #### Registration, [yify docs](http://yify-torrents.com/api/#registerDocs)
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
- Send a movie request to Yify.
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
- #### Vote, [yify docs](https://yts.to/api#voteDocs)
52
+ #### API Documentation
258
53
 
259
- Vote for a requested movie.
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
- params = { hash: hash_returned_from_the_login_call, requestid: 1169 }
262
- client = Yify::Client.new
263
- client.vote(params)
264
-
265
- Available request parameters:
58
+ ## Change Log
266
59
 
267
- Parameter |required | Description
268
- --------------|----------|-------------
269
- `hash` | **yes** |The unique hash that will be used as a means of authentication
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
 
@@ -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/movie.rb'
6
- require 'yify/models/upcoming_movie.rb'
7
- require 'yify/models/requested_movie.rb'
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
 
@@ -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] upcoming
10
- # See: https://yts.to/api#upcomingDocs
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
- # @returns [Yify::Models::Movie]
27
- def list(options)
28
- data = self.class.get("/list", { query: options })
29
- Yify::Response.new(data, :movie_list)
30
- end
31
-
32
- # [GET] list_imbd
33
- # See: https://yts.to/api#listimdbDocs
34
- #
35
- # Get a list of movies using a desired list of IMDB IDs.
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
- def list_imdb(options)
39
- data = self.class.get("/listimdb", { query: options })
40
- Yify::Response.new(data, :movie_list)
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] movie
44
- # See: https://yts.to/api#movieDocs
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
- def movie(id)
50
- data = self.class.get("/movie", { query: { id: id } })
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] comments
55
- # See: https://yts.to/api#commentDocs
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
- def comments(movie_id)
61
- data = self.class.get("/comments", { query: { movieid: movie_id } })
62
- Yify::Response.new(data, :comment)
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
- # [POST] post_comment
66
- # See: https://yts.to/api#commentpostDocs
80
+ # [GET] movie_reviews
81
+ # See: https://yts.to/api#movie_reviews
67
82
  #
68
- # Add comment to a movie.
83
+ # Get reviews for the desired movie
69
84
  #
70
- # @returns Yify::Models::ApiResponse
71
- def post_comment(options)
72
- data = self.class.post("/commentpost", { body: options })
73
- Yify::Response.new(data, :api_response)
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] user
77
- # See: https://yts.to/api#userDocs
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
- def user(user_id)
83
- data = self.class.get("/user", { query: { id: user_id } })
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] register
88
- # See: https://yts.to/api#registerDocs
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
- def register(options)
94
- data = self.class.post("/register", { body: options })
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] login
99
- # See: https://yts.to/api#loginDocs
224
+ # [POST] user_reset_password
225
+ # See: https://yts.to/api#user_reset_password
226
+ #
227
+ # Reset the users' password.
100
228
  #
101
- # Login a Yify user.
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
- def login(options)
105
- data = self.class.post("/login", { body: options })
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] send_password_reset
110
- # https://yts.to/api#passRecoveryDoc
241
+ # [POST] like_movie
242
+ # See: https://yts.to/api#like_movie
111
243
  #
112
- # Send a password reset email to the specified email address.
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
- def send_password_reset(email)
116
- data = self.class.post("/sendresetpass", { body: { email: email } })
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
- # [POST] reset_password
121
- # See: https://yts.to/api#resetPasswordDocs
258
+ # [GET] get_movie_bookmarks
259
+ # See: https://yts.to/api#get_movie_bookmarks
122
260
  #
123
- # Reset the users' password.
124
- def reset_password(options)
125
- data = self.class.post("/resetpassconfirm", { body: options })
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
- # [GET] profile
130
- # See: https://yts.to/api#profileDocs
308
+ # [POST] make_comment
309
+ # See: https://yts.to/api#make_comment
310
+ #
311
+ # Add comment to a movie.
131
312
  #
132
- # Get a logged in users' profile.
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::Profile
135
- def profile(hash)
136
- data = self.class.get("/profile", { query: { hash: hash } })
137
- Yify::Response.new(data, :profile)
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] update_profile
141
- # See: https://yts.to/api#editProfileDocs
326
+ # [POST] like_comment
327
+ # See: https://yts.to/api#like_comment
328
+ #
329
+ # Like a comment on a movie
142
330
  #
143
- # update a logged in users' profile.
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
- def update_profile(options)
147
- data = self.class.post("/editprofile", { body: options })
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
- # [GET] requests
152
- # See: https://yts.to/api#requestsDocs
343
+ # [POST] report_comment
344
+ # See: https://yts.to/api#report_comment
345
+ #
346
+ # Report a comment on a movie
153
347
  #
154
- # Get a list of all requested movies.
348
+ # @params
349
+ # user_key: String (required)
350
+ # comment_id: Integer (required)
351
+ # application_key: String (required)
155
352
  #
156
- # @returns [Yify::Models::RequestedMovie]
157
- def requests(options)
158
- data = self.class.get("/requests", { query: options })
159
- Yify::Response.new(data, :request_list)
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] make_request
163
- # See: https://yts.to/api#makerequestsDocs
360
+ # [POST] delete_comment
361
+ # See: https://yts.to/api#delete_comment
164
362
  #
165
- # Request a movie to be added to Yify.
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
- def make_request(options)
169
- data = self.class.post("/makerequest", { body: options })
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] vote
174
- # See: https://yts.to/api#voteDocs
377
+ # [POST] make_request
378
+ # See: https://yts.to/api#make_request
175
379
  #
176
- # Vote for a requested movie.
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
- def vote(options)
180
- data = self.class.post("/vote", { body: options })
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