Class: Yify::Client
- Inherits:
-
Object
- Object
- Yify::Client
- Includes:
- HTTParty, Support::Utils
- Defined in:
- lib/yify/client.rb
Instance Attribute Summary collapse
-
#application_key ⇒ Object
Returns the value of attribute application_key.
Instance Method Summary collapse
-
#add_movie_bookmark(params) ⇒ Object
- POST
-
add_movie_bookmark See: yts.to/api#add_movie_bookmark.
-
#delete_comment(params) ⇒ Object
- POST
-
delete_comment See: yts.to/api#delete_comment.
-
#delete_movie_bookmark(params) ⇒ Object
- POST
-
delete_movie_bookmark See: yts.to/api#delete_movie_bookmark.
-
#get_movie_bookmarks(params) ⇒ Object
- GET
-
get_movie_bookmarks See: yts.to/api#get_movie_bookmarks.
-
#initialize(application_key = nil) ⇒ Client
constructor
A new instance of Client.
-
#like_comment(params) ⇒ Object
- POST
-
like_comment See: yts.to/api#like_comment.
-
#like_movie(params) ⇒ Object
- POST
-
like_movie See: yts.to/api#like_movie.
-
#list_movies(params) ⇒ Object
- GET
-
list_movies See: yts.to/api#list_movies.
-
#list_upcoming ⇒ Object
- GET
-
list_upcoming See: yts.to/api#list_upcoming.
-
#make_comment(params) ⇒ Object
- POST
-
make_comment See: yts.to/api#make_comment.
-
#make_request(params) ⇒ Object
- POST
-
make_request See: yts.to/api#make_request.
-
#movie_comments(movie_id) ⇒ Object
- GET
-
movie_comments See: yts.to/api#movie_comments.
-
#movie_details(params) ⇒ Object
- GET
-
movie_details See: yts.to/api#movie_details.
-
#movie_parental_guides(movie_id) ⇒ Object
- GET
-
movie_parental_guides See: yts.to/api#movie_parental_guides.
-
#movie_reviews(movie_id) ⇒ Object
- GET
-
movie_reviews See: yts.to/api#movie_reviews.
-
#movie_suggestions(movie_id) ⇒ Object
- GET
-
movie_suggestions See: yts.to/api#movie_suggestions.
-
#report_comment(params) ⇒ Object
- POST
-
report_comment See: yts.to/api#report_comment.
-
#user_details(params) ⇒ Object
- GET
-
user_details See: yts.to/api#user_details.
-
#user_edit_settings(params) ⇒ Object
- POST
-
user_edit_settings See: yts.to/api#user_edit_settings.
-
#user_forgot_password(params) ⇒ Object
- POST
-
user_forgot_password yts.to/api#user_forgot_password.
-
#user_get_key(params) ⇒ Object
- POST
-
get_user_key See: yts.to/api#get_user_key.
-
#user_profile(user_key) ⇒ Object
- GET
-
user_profile See: yts.to/api#user_profile.
-
#user_register(params) ⇒ Object
- POST
-
user_register See: yts.to/api#user_register.
-
#user_reset_password(params) ⇒ Object
- POST
-
user_reset_password See: yts.to/api#user_reset_password.
Methods included from Support::Utils
#map_class, #post_params, #symbolize_keys
Constructor Details
#initialize(application_key = nil) ⇒ Client
Returns a new instance of Client.
13 14 15 |
# File 'lib/yify/client.rb', line 13 def initialize(application_key = nil) @application_key = application_key || ENV["yify_application_key"] end |
Instance Attribute Details
#application_key ⇒ Object
Returns the value of attribute application_key.
8 9 10 |
# File 'lib/yify/client.rb', line 8 def application_key @application_key end |
Instance Method Details
#add_movie_bookmark(params) ⇒ Object
- POST
-
add_movie_bookmark
See: yts.to/api#add_movie_bookmark
Get all the current movies which have been bookmarked for a given user
294 295 296 297 |
# File 'lib/yify/client.rb', line 294 def add_movie_bookmark(params) data = self.class.post("/add_movie_bookmark", { body: post_params(params) }) Yify::Response.new(data, :bookmark) end |
#delete_comment(params) ⇒ Object
380 381 382 383 |
# File 'lib/yify/client.rb', line 380 def delete_comment(params) data = self.class.post("/delete_comment", { body: post_params(params) }) Yify::Response.new(data, :api_response) end |
#delete_movie_bookmark(params) ⇒ Object
- POST
-
delete_movie_bookmark
See: yts.to/api#delete_movie_bookmark
remove movies from the user’s bookmarks
311 312 313 314 |
# File 'lib/yify/client.rb', line 311 def delete_movie_bookmark(params) data = self.class.post("/delete_movie_bookmark", { body: post_params(params) }) Yify::Response.new(data, :api_response) end |
#get_movie_bookmarks(params) ⇒ Object
- GET
-
get_movie_bookmarks
See: yts.to/api#get_movie_bookmarks
Get all the current movies which have been bookmarked for a given user
277 278 279 280 |
# File 'lib/yify/client.rb', line 277 def get_movie_bookmarks(params) data = self.class.get("/get_movie_bookmarks", { query: params }) Yify::Response.new(data, :bookmarks) end |
#like_comment(params) ⇒ Object
346 347 348 349 |
# File 'lib/yify/client.rb', line 346 def like_comment(params) data = self.class.post("/like_comment", { body: post_params(params) }) Yify::Response.new(data, :api_response) end |
#like_movie(params) ⇒ Object
261 262 263 264 |
# File 'lib/yify/client.rb', line 261 def like_movie(params) data = self.class.post("/like_movie", { body: post_params(params) }) Yify::Response.new(data, :api_response) end |
#list_movies(params) ⇒ Object
- GET
-
list_movies
Get a list of movies, this method can be used to search or filter.
36 37 38 39 |
# File 'lib/yify/client.rb', line 36 def list_movies(params) data = self.class.get("/list_movies", { query: params }) Yify::Response.new(data, :movies) end |
#list_upcoming ⇒ Object
125 126 127 128 |
# File 'lib/yify/client.rb', line 125 def list_upcoming data = self.class.get("/list_upcoming") Yify::Response.new(data, :upcoming_movies) end |
#make_comment(params) ⇒ Object
329 330 331 332 |
# File 'lib/yify/client.rb', line 329 def make_comment(params) data = self.class.post("/make_comment", { body: post_params(params) }) Yify::Response.new(data, :api_response) end |
#make_request(params) ⇒ Object
398 399 400 401 |
# File 'lib/yify/client.rb', line 398 def make_request(params) data = self.class.post("/make_request", { body: post_params(params) }) Yify::Response.new(data, :api_response) end |
#movie_comments(movie_id) ⇒ Object
83 84 85 86 |
# File 'lib/yify/client.rb', line 83 def movie_comments(movie_id) data = self.class.get("/movie_comments", { query: { movie_id: movie_id } }) Yify::Response.new(data, :comments) end |
#movie_details(params) ⇒ Object
53 54 55 56 |
# File 'lib/yify/client.rb', line 53 def movie_details(params) data = self.class.get("/movie_details", { query: params }) Yify::Response.new(data, :movie) end |
#movie_parental_guides(movie_id) ⇒ Object
- GET
-
movie_parental_guides
See: yts.to/api#movie_parental_guides
Get parental guides for the desired movie
113 114 115 116 |
# File 'lib/yify/client.rb', line 113 def movie_parental_guides(movie_id) data = self.class.get("/movie_parental_guides", { query: { movie_id: movie_id } }) Yify::Response.new(data, :parental_guides) end |
#movie_reviews(movie_id) ⇒ Object
98 99 100 101 |
# File 'lib/yify/client.rb', line 98 def movie_reviews(movie_id) data = self.class.get("/movie_reviews", { query: { movie_id: movie_id } }) Yify::Response.new(data, :reviews) end |
#movie_suggestions(movie_id) ⇒ Object
- GET
-
movie_suggestions
See: yts.to/api#movie_suggestions
Returns 4 related movies as suggestions for the user
68 69 70 71 |
# File 'lib/yify/client.rb', line 68 def movie_suggestions(movie_id) data = self.class.get("/movie_suggestions", { query: { movie_id: movie_id } }) Yify::Response.new(data, :movie_suggestions) end |
#report_comment(params) ⇒ Object
363 364 365 366 |
# File 'lib/yify/client.rb', line 363 def report_comment(params) data = self.class.post("/report_comment", { body: post_params(params) }) Yify::Response.new(data, :api_response) end |
#user_details(params) ⇒ Object
141 142 143 144 |
# File 'lib/yify/client.rb', line 141 def user_details(params) data = self.class.get("/user_details", { query: params }) Yify::Response.new(data, :user) end |
#user_edit_settings(params) ⇒ Object
193 194 195 196 |
# File 'lib/yify/client.rb', line 193 def user_edit_settings(params) data = self.class.post("/user_edit_settings", { body: post_params(params) }) Yify::Response.new(data, :user) end |
#user_forgot_password(params) ⇒ Object
- POST
-
user_forgot_password
yts.to/api#user_forgot_password
Send a password reset email to the specified email address.
227 228 229 230 |
# File 'lib/yify/client.rb', line 227 def user_forgot_password(params) data = self.class.post("/user_forgot_password", { body: post_params(params) }) Yify::Response.new(data, :api_response) end |
#user_get_key(params) ⇒ Object
- POST
-
get_user_key
The same as logging in, if successful the returned data will include the user_key for later use of the API as a means of authentication
159 160 161 162 |
# File 'lib/yify/client.rb', line 159 def user_get_key(params) data = self.class.post("/user_get_key", { body: post_params(params) }) Yify::Response.new(data, :session) end |
#user_profile(user_key) ⇒ Object
174 175 176 177 |
# File 'lib/yify/client.rb', line 174 def user_profile(user_key) data = self.class.get("/user_profile", { query: { user_key: user_key } }) Yify::Response.new(data, :user) end |
#user_register(params) ⇒ Object
211 212 213 214 |
# File 'lib/yify/client.rb', line 211 def user_register(params) data = self.class.post("/user_register", { body: post_params(params) }) Yify::Response.new(data, :session) end |