yify 0.0.1
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 +7 -0
- data/.gitignore +23 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +276 -0
- data/Rakefile +31 -0
- data/lib/yify.rb +20 -0
- data/lib/yify/client.rb +184 -0
- data/lib/yify/models/api_response.rb +8 -0
- data/lib/yify/models/base.rb +10 -0
- data/lib/yify/models/comment.rb +15 -0
- data/lib/yify/models/movie.rb +54 -0
- data/lib/yify/models/profile.rb +10 -0
- data/lib/yify/models/requested_movie.rb +17 -0
- data/lib/yify/models/session.rb +10 -0
- data/lib/yify/models/upcoming_movie.rb +15 -0
- data/lib/yify/models/user.rb +19 -0
- data/lib/yify/response.rb +60 -0
- data/lib/yify/support/utils.rb +30 -0
- data/lib/yify/version.rb +3 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_add_a_request.yml +43 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_edit_a_profile.yml +42 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_a_profile.yml +44 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_movie_comments.yml +89 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_movie_details.yml +60 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_requests_list.yml +52 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_upcoming_movies.yml +188 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_get_user_details.yml +48 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_list_by_imdb_id.yml +55 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_list_movies.yml +45 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_login_a_user.yml +42 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_post_a_comment.yml +42 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_recover_passwords.yml +42 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_register_a_user.yml +42 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_reset_a_password.yml +42 -0
- data/spec/fixtures/vcr_cassettes/Yify_Client/should_vote_on_requests.yml +42 -0
- data/spec/models/api_response_spec.rb +6 -0
- data/spec/models/comment_spec.rb +13 -0
- data/spec/models/movie_spec.rb +53 -0
- data/spec/models/profile_spec.rb +21 -0
- data/spec/models/requested_movie_spec.rb +20 -0
- data/spec/models/session_spec.rb +8 -0
- data/spec/models/upcoming_movie_spec.rb +13 -0
- data/spec/models/user_spec.rb +17 -0
- data/spec/response_spec.rb +43 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/support/utils_spec.rb +30 -0
- data/spec/yify_spec.rb +103 -0
- data/yify.gemspec +32 -0
- metadata +260 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d979512449ef590614706d2f76342aca3142e2b5
|
4
|
+
data.tar.gz: 5ea8fd1e035bc1c3b3050c590560ce5d6b7a499b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4eedc326e2b9d72049582ec9952d81e2a779a4c758d4395c8d7fa42c832980cb346b2eeea7a59029ab9c6b33f261bdc90b7dbb402f6947219170227267e82448
|
7
|
+
data.tar.gz: 5e510d4fc9eb94465e60d0f22bbc920045a622d0c5c52569f52ecf4a79a3a9a4374d8a799bef3688d439bf5e569afb936516d1360fcebe40489e98aee826897f
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
.env
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Jon Lunsford
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,276 @@
|
|
1
|
+
# Yify
|
2
|
+
|
3
|
+
A Ruby wrapper for the [Yify torrenst API](http://yify-torrents.com/api/)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'yify'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install yify
|
18
|
+
|
19
|
+
## Usage;
|
20
|
+
|
21
|
+
Require Yify in your project:
|
22
|
+
|
23
|
+
require 'yify'
|
24
|
+
|
25
|
+
This gem translates the raw JSON coming back from Yify into full fledged Ruby objects. This means you can access properties like this:
|
26
|
+
|
27
|
+
client = Yify::Client.new
|
28
|
+
=> #<Yify::Client:0x007f9b14321ef8>
|
29
|
+
|
30
|
+
movie = client.movie(353).result
|
31
|
+
=> #<Yify::Models::Movie:0x007f9b14360130>
|
32
|
+
|
33
|
+
movie.movie_title
|
34
|
+
=> "We Were Soldiers (2002)"
|
35
|
+
|
36
|
+
A `Yify::Response` will always return an untouched hash as well, like this:
|
37
|
+
|
38
|
+
movie = client.movie(353).response
|
39
|
+
=> {"MovieID"=>"353",
|
40
|
+
"MovieUrl"=>"http://yts.re/movie/We_Were_Soldiers_2002",
|
41
|
+
"DateUploaded"=>"2011-08-31 01:04:02",
|
42
|
+
... }
|
43
|
+
|
44
|
+
movie["MovieID"]
|
45
|
+
=> "353"
|
46
|
+
|
47
|
+
#### Upcoming Movies, [yify docs](http://yify-torrents.com/api/#upcomingDocs)
|
48
|
+
|
49
|
+
Get a list of all upcoming movies.
|
50
|
+
|
51
|
+
client = Yify::Client.new
|
52
|
+
movies = client.upcoming.result
|
53
|
+
|
54
|
+
#### List Movies, [yify docs](http://yify-torrents.com/api/#listDocs)
|
55
|
+
|
56
|
+
Get a list of movies, this can also be used to search or filter all movies on Yify.
|
57
|
+
|
58
|
+
params = { limit: 50, quality: 720 }
|
59
|
+
client = Yify::Client.new
|
60
|
+
movies = client.list(params).result
|
61
|
+
|
62
|
+
Available request parameters:
|
63
|
+
|
64
|
+
Parameter |required | Default | Description
|
65
|
+
----------|---------|---------|----
|
66
|
+
`limit` | **no** |20 |Determines the max amount of movie results
|
67
|
+
`set` | **no** |1 |Used to see the next set of movies, eg limit=15 and set=2 will show you movies 15-30
|
68
|
+
`quality` | **no** |ALL |Ability to select a quality type to filter by
|
69
|
+
`rating` | **no** |0 |Sets minimum movie rating for display
|
70
|
+
`keywords`| **no** | |Matching keywords title search, IMDB code, Actor Name/IMDB code or Director Name/IMDB code
|
71
|
+
`genre` | **no** | ALL |Display movies from chosen type genre
|
72
|
+
`sort` | **no** | date |Sorts the results by choose method
|
73
|
+
`order` | **no** | desc |Orders the results with either ascending or descending
|
74
|
+
|
75
|
+
#### List Movies By IMDB ID, [yify docs](http://yify-torrents.com/api/#listimdbDocs)
|
76
|
+
|
77
|
+
Get a list of movies based on IMDB IDs.
|
78
|
+
|
79
|
+
params = { imdb_id: ["tt0111161", "tt0068646"] }
|
80
|
+
client = Yify::Client.new
|
81
|
+
movies = client.list_imdb(params).result
|
82
|
+
|
83
|
+
Available request parameters:
|
84
|
+
|
85
|
+
Parameter |required | Default | Description
|
86
|
+
----------|----------|---------|----
|
87
|
+
`imdb_id` | **yes** | |he input IMDB IDs to retrieve the movies for
|
88
|
+
|
89
|
+
#### Movie Details, [yify docs](http://yify-torrents.com/api/#movieDocs)
|
90
|
+
|
91
|
+
Get an individual movie.
|
92
|
+
|
93
|
+
client = Yify::Client.new
|
94
|
+
movie = client.movie(353).result
|
95
|
+
|
96
|
+
Available request parameters:
|
97
|
+
|
98
|
+
Parameter |required | Default | Description
|
99
|
+
----------|----------|---------|----
|
100
|
+
`id` | **yes** | |View full details of specified MovieID
|
101
|
+
|
102
|
+
#### Movie Comments, [yify docs](http://yify-torrents.com/api/#commentDocs)
|
103
|
+
|
104
|
+
Get all comments related to a movie.
|
105
|
+
|
106
|
+
client = Yify::Client.new
|
107
|
+
comments = client.comments(353).results
|
108
|
+
|
109
|
+
Available request parameters:
|
110
|
+
|
111
|
+
Parameter |required | Default | Description
|
112
|
+
----------|----------|---------|----
|
113
|
+
`movieid` | **yes** | |View full list of comments for specified film
|
114
|
+
|
115
|
+
#### User Details, [yify docs](http://yify-torrents.com/api/#userDocs)
|
116
|
+
|
117
|
+
Get details for specified user.
|
118
|
+
|
119
|
+
client = Yify::Client.new
|
120
|
+
user = client.user(16).results
|
121
|
+
|
122
|
+
Available request parameters:
|
123
|
+
|
124
|
+
Parameter |required | Default | Description
|
125
|
+
----------|----------|---------|----
|
126
|
+
`id` | **yes** | |The unique userID that we want to see the info for
|
127
|
+
|
128
|
+
#### Registration, [yify docs](http://yify-torrents.com/api/#registerDocs)
|
129
|
+
|
130
|
+
Register a new user. Upon successful registration a confirmation email will be sent.
|
131
|
+
|
132
|
+
params = { username: "my_user", password: "test1234", email: "me@me.com" }
|
133
|
+
client = Yify::Client.new
|
134
|
+
client.register(params)
|
135
|
+
|
136
|
+
Available request parameters:
|
137
|
+
|
138
|
+
Parameter |required | Description
|
139
|
+
----------|----------|-------------
|
140
|
+
`username`| **yes** |The username of the desired account
|
141
|
+
`password`| **yes** |The username of the desired account
|
142
|
+
`email` | **yes** |The email address for verification
|
143
|
+
|
144
|
+
#### Password Recovery, [yify docs](http://yify-torrents.com/api/#passRecoveryDoc)
|
145
|
+
|
146
|
+
Ask Yify for a password recovery email.
|
147
|
+
|
148
|
+
client = Yify::Client.new
|
149
|
+
client.send_password_reset("me@me.com")
|
150
|
+
|
151
|
+
Available request parameters:
|
152
|
+
|
153
|
+
Parameter |required | Description
|
154
|
+
----------|----------|-------------
|
155
|
+
`email` | **yes** |The email address that was registered with the account to send recovery code to
|
156
|
+
|
157
|
+
#### Resetting Password, [yify docs](http://yify-torrents.com/api/#resetPasswordDocs)
|
158
|
+
|
159
|
+
Send the new password to Yify.
|
160
|
+
|
161
|
+
params = { code: "xxxxxxxxxx", newpassword: "MyPassword" }
|
162
|
+
client = Yify::Client.new
|
163
|
+
client.reset_password(params)
|
164
|
+
|
165
|
+
Available request parameters:
|
166
|
+
|
167
|
+
Parameter |required | Description
|
168
|
+
-------------|----------|-------------
|
169
|
+
`code` | **yes** |The password reset code from email
|
170
|
+
`newpassword`| **yes** |The new desired password for the account
|
171
|
+
|
172
|
+
#### Login, [yify docs](http://yify-torrents.com/api/#loginDocs)
|
173
|
+
|
174
|
+
Login a user.
|
175
|
+
|
176
|
+
params = { username: "username", password: "password" }
|
177
|
+
client = Yify::Client.new
|
178
|
+
client.login(params)
|
179
|
+
|
180
|
+
The result of this call will be a Yify::Models::Session object that will store the returned user hash from Yify.
|
181
|
+
|
182
|
+
Available request parameters:
|
183
|
+
|
184
|
+
Parameter |required | Description
|
185
|
+
----------|----------|-------------
|
186
|
+
`username`| **yes** |The username of the desired account
|
187
|
+
`password`| **yes** |The username of the desired account
|
188
|
+
|
189
|
+
#### Profile, [yify docs](https://yts.re/api#profileDocs)
|
190
|
+
|
191
|
+
Get details about a users' profile.
|
192
|
+
|
193
|
+
client = Yify::Client.new
|
194
|
+
profile = client.profile(hash_returned_from_the_login_call)
|
195
|
+
|
196
|
+
Available request parameters:
|
197
|
+
|
198
|
+
Parameter |required | Description
|
199
|
+
----------|----------|-------------
|
200
|
+
`hash` | **yes** |The unique hash that will be used as a means of authentication
|
201
|
+
|
202
|
+
#### Edit Profile, [yify docs](https://yts.re/api#editProfileDocs)
|
203
|
+
|
204
|
+
Edit a users' profile.
|
205
|
+
|
206
|
+
params = { hash: hash_returned_from_the_login_call, about: "RUBY FTW!" }
|
207
|
+
client = Yify::Client.new
|
208
|
+
client.update_profile(params)
|
209
|
+
|
210
|
+
Available request parameters:
|
211
|
+
|
212
|
+
Parameter |required | Description
|
213
|
+
--------------|----------|-------------
|
214
|
+
`hash` | **yes** |The unique hash that will be used as a means of authentication
|
215
|
+
`active` | **no** |By default all profiles are showing and active(1), 0 will make them hidden
|
216
|
+
`about` | **no** |Text describing the user in a short paragraph
|
217
|
+
`new password` | **no** |The new desired password (required 'oldpassword' for confirmation)
|
218
|
+
`old password` | **no** |The old password as confirmation
|
219
|
+
`avatar` | **no** |This will be the newest avatar image for the user
|
220
|
+
|
221
|
+
#### Requests, [yify docs](https://yts.re/api#requestsDocs)
|
222
|
+
|
223
|
+
Get a list of all currently requested movies.
|
224
|
+
|
225
|
+
params = { page: "confirmed", limit: 2 }
|
226
|
+
client = Yifi::Client.new
|
227
|
+
requests = client.requests(params)
|
228
|
+
|
229
|
+
|
230
|
+
Available request parameters:
|
231
|
+
|
232
|
+
Parameter |required | Description
|
233
|
+
--------------|----------|-------------
|
234
|
+
`page` | **yes** |'accepted' or 'confirmed'. Gives the choice to view the currently open movies for voting and the confirmed movies to be done
|
235
|
+
`limit` | **no** |Determines the max amount of request results
|
236
|
+
`set` | **no** |set to see the next set of movies, eg limit=15 and set=2 will show you movies 15-30
|
237
|
+
`sort` | **no** |Sorts the results by choose method
|
238
|
+
`order` | **no** |Orders the results with either ascending or descending
|
239
|
+
|
240
|
+
#### Make Request, [yify docs](https://yts.re/api#makerequestsDocs)
|
241
|
+
|
242
|
+
Send a movie request to Yify.
|
243
|
+
|
244
|
+
params = { hash: hash_returned_from_the_login_call, request: "tt0111161" }
|
245
|
+
client - Yify::Client.new
|
246
|
+
client.make_request(params)
|
247
|
+
|
248
|
+
Available request parameters:
|
249
|
+
|
250
|
+
Parameter |required | Description
|
251
|
+
--------------|----------|-------------
|
252
|
+
`hash` | **yes** |The unique hash that will be used as a means of authentication
|
253
|
+
`request` | **yes** |Request input can be: Movie name or IMDB Code or IMDB URL
|
254
|
+
|
255
|
+
#### Vote, [yify docs](https://yts.re/api#voteDocs)
|
256
|
+
|
257
|
+
Vote for a requested movie.
|
258
|
+
|
259
|
+
params = { hash: hash_returned_from_the_login_call, requestid: 1169 }
|
260
|
+
client = Yify::Client.new
|
261
|
+
client.vote(params)
|
262
|
+
|
263
|
+
Available request parameters:
|
264
|
+
|
265
|
+
Parameter |required | Description
|
266
|
+
--------------|----------|-------------
|
267
|
+
`hash` | **yes** |The unique hash that will be used as a means of authentication
|
268
|
+
`requested` | **yes** |The request ID you wish to vote on
|
269
|
+
|
270
|
+
## Contributing
|
271
|
+
|
272
|
+
1. Fork it ( https://github.com/jonlunsford/yify/fork )
|
273
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
274
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
275
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
276
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'dotenv/tasks'
|
4
|
+
|
5
|
+
# Helper Functions
|
6
|
+
def name
|
7
|
+
@name ||= Dir['*.gemspec'].first.split('.').first
|
8
|
+
end
|
9
|
+
|
10
|
+
def version
|
11
|
+
line = File.read("lib/#{name}/version.rb")[/^\s*VERSION\s*=\s*.*/]
|
12
|
+
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
13
|
+
end
|
14
|
+
|
15
|
+
# Standard tasks
|
16
|
+
RSpec::Core::RakeTask.new(:spec)
|
17
|
+
task :test => :spec
|
18
|
+
task :default => :spec
|
19
|
+
|
20
|
+
require 'rdoc/task'
|
21
|
+
Rake::RDocTask.new do |rdoc|
|
22
|
+
rdoc.rdoc_dir = 'rdoc'
|
23
|
+
rdoc.title = "#{name} #{version}"
|
24
|
+
rdoc.rdoc_files.include('README*')
|
25
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "Open an irb session preloaded with this library"
|
29
|
+
task :console => :dotenv do
|
30
|
+
sh "pry -Ilib -r #{name}.rb"
|
31
|
+
end
|
data/lib/yify.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'dotenv'
|
3
|
+
require 'yify/support/utils.rb'
|
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'
|
8
|
+
require 'yify/models/comment.rb'
|
9
|
+
require 'yify/models/user.rb'
|
10
|
+
require 'yify/models/profile.rb'
|
11
|
+
require 'yify/models/api_response.rb'
|
12
|
+
require 'yify/models/session.rb'
|
13
|
+
require 'yify/response'
|
14
|
+
require 'yify/client'
|
15
|
+
|
16
|
+
Dotenv.load
|
17
|
+
|
18
|
+
module Yify
|
19
|
+
autoload :VERSION, File.join(File.dirname(__FILE__), 'yify/version');
|
20
|
+
end
|
data/lib/yify/client.rb
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
# A ruby wrapper for the YIFY Torrents API (https://yts.re/api)
|
2
|
+
|
3
|
+
module Yify
|
4
|
+
class Client
|
5
|
+
include HTTParty
|
6
|
+
base_uri 'http://yts.re/api'
|
7
|
+
format :json
|
8
|
+
|
9
|
+
# [GET] upcoming
|
10
|
+
# See: https://yts.re/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.re/api#listDocs
|
22
|
+
#
|
23
|
+
# Get a list of movies, this method can be used to search
|
24
|
+
# or filter.
|
25
|
+
#
|
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.re/api#listimdbDocs
|
34
|
+
#
|
35
|
+
# Get a list of movies using a desired list of IMDB IDs.
|
36
|
+
#
|
37
|
+
# @returns [Yify::Models::Movie]
|
38
|
+
def list_imdb(options)
|
39
|
+
data = self.class.get("/listimdb", { query: options })
|
40
|
+
Yify::Response.new(data, :movie_list)
|
41
|
+
end
|
42
|
+
|
43
|
+
# [GET] movie
|
44
|
+
# See: https://yts.re/api#movieDocs
|
45
|
+
#
|
46
|
+
# Get movie details.
|
47
|
+
#
|
48
|
+
# @returns Yify::Models::Movie
|
49
|
+
def movie(id)
|
50
|
+
data = self.class.get("/movie", { query: { id: id } })
|
51
|
+
Yify::Response.new(data, :movie)
|
52
|
+
end
|
53
|
+
|
54
|
+
# [GET] comments
|
55
|
+
# See: https://yts.re/api#commentDocs
|
56
|
+
#
|
57
|
+
# Get comments for the desired movie
|
58
|
+
#
|
59
|
+
# @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)
|
63
|
+
end
|
64
|
+
|
65
|
+
# [POST] post_comment
|
66
|
+
# See: https://yts.re/api#commentpostDocs
|
67
|
+
#
|
68
|
+
# Add comment to a movie.
|
69
|
+
#
|
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)
|
74
|
+
end
|
75
|
+
|
76
|
+
# [GET] user
|
77
|
+
# See: https://yts.re/api#userDocs
|
78
|
+
#
|
79
|
+
# Get desired users' details.
|
80
|
+
#
|
81
|
+
# @returns Yify::Models::User
|
82
|
+
def user(user_id)
|
83
|
+
data = self.class.get("/user", { query: { id: user_id } })
|
84
|
+
Yify::Response.new(data, :user)
|
85
|
+
end
|
86
|
+
|
87
|
+
# [POST] register
|
88
|
+
# See: https://yts.re/api#registerDocs
|
89
|
+
#
|
90
|
+
# Register a new user with Yify.
|
91
|
+
#
|
92
|
+
# @returns Yify::Models::ApiResponse
|
93
|
+
def register(options)
|
94
|
+
data = self.class.post("/register", { body: options })
|
95
|
+
Yify::Response.new(data, :api_response)
|
96
|
+
end
|
97
|
+
|
98
|
+
# [POST] login
|
99
|
+
# See: https://yts.re/api#loginDocs
|
100
|
+
#
|
101
|
+
# Login a Yify user.
|
102
|
+
#
|
103
|
+
# @returns Yify::Models::Session
|
104
|
+
def login(options)
|
105
|
+
data = self.class.post("/login", { body: options })
|
106
|
+
Yify::Response.new(data, :session)
|
107
|
+
end
|
108
|
+
|
109
|
+
# [POST] send_password_reset
|
110
|
+
# https://yts.re/api#passRecoveryDoc
|
111
|
+
#
|
112
|
+
# Send a password reset email to the specified email address.
|
113
|
+
#
|
114
|
+
# @returns Yify::Models::ApiResponse
|
115
|
+
def send_password_reset(email)
|
116
|
+
data = self.class.post("/sendresetpass", { body: { email: email } })
|
117
|
+
Yify::Response.new(data, :api_response)
|
118
|
+
end
|
119
|
+
|
120
|
+
# [POST] reset_password
|
121
|
+
# See: https://yts.re/api#resetPasswordDocs
|
122
|
+
#
|
123
|
+
# Reset the users' password.
|
124
|
+
def reset_password(options)
|
125
|
+
data = self.class.post("/resetpassconfirm", { body: options })
|
126
|
+
Yify::Response.new(data, :api_response)
|
127
|
+
end
|
128
|
+
|
129
|
+
# [GET] profile
|
130
|
+
# See: https://yts.re/api#profileDocs
|
131
|
+
#
|
132
|
+
# Get a logged in users' profile.
|
133
|
+
#
|
134
|
+
# @returns Yify::Models::Profile
|
135
|
+
def profile(hash)
|
136
|
+
data = self.class.get("/profile", { query: { hash: hash } })
|
137
|
+
Yify::Response.new(data, :profile)
|
138
|
+
end
|
139
|
+
|
140
|
+
# [POST] update_profile
|
141
|
+
# See: https://yts.re/api#editProfileDocs
|
142
|
+
#
|
143
|
+
# update a logged in users' profile.
|
144
|
+
#
|
145
|
+
# @returns Yify::Models::ApiResponse
|
146
|
+
def update_profile(options)
|
147
|
+
data = self.class.post("/editprofile", { body: options })
|
148
|
+
Yify::Response.new(data, :api_response)
|
149
|
+
end
|
150
|
+
|
151
|
+
# [GET] requests
|
152
|
+
# See: https://yts.re/api#requestsDocs
|
153
|
+
#
|
154
|
+
# Get a list of all requested movies.
|
155
|
+
#
|
156
|
+
# @returns [Yify::Models::RequestedMovie]
|
157
|
+
def requests(options)
|
158
|
+
data = self.class.get("/requests", { query: options })
|
159
|
+
Yify::Response.new(data, :request_list)
|
160
|
+
end
|
161
|
+
|
162
|
+
# [POST] make_request
|
163
|
+
# See: https://yts.re/api#makerequestsDocs
|
164
|
+
#
|
165
|
+
# Request a movie to be added to Yify.
|
166
|
+
#
|
167
|
+
# @returns Yify::Models::ApiResponse
|
168
|
+
def make_request(options)
|
169
|
+
data = self.class.post("/makerequest", { body: options })
|
170
|
+
Yify::Response.new(data, :api_response)
|
171
|
+
end
|
172
|
+
|
173
|
+
# [POST] vote
|
174
|
+
# See: https://yts.re/api#voteDocs
|
175
|
+
#
|
176
|
+
# Vote for a requested movie.
|
177
|
+
#
|
178
|
+
# @returns Yify::Models::ApiResponse
|
179
|
+
def vote(options)
|
180
|
+
data = self.class.post("/vote", { body: options })
|
181
|
+
Yify::Response.new(data, :api_response)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|