Class: Yify::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/yify/client.rb

Instance Method Summary collapse

Instance Method Details

#comments(movie_id) ⇒ Object

GET

comments

See: yts.to/api#commentDocs

Get comments for the desired movie



60
61
62
63
# File 'lib/yify/client.rb', line 60

def comments(movie_id)
  data = self.class.get("/comments", { query: { movieid: movie_id } })
  Yify::Response.new(data, :comment)
end

#list(options) ⇒ Object

GET

list

See: yts.to/api#listDocs

Get a list of movies, this method can be used to search or filter.



27
28
29
30
# File 'lib/yify/client.rb', line 27

def list(options)
  data = self.class.get("/list", { query: options })
  Yify::Response.new(data, :movie_list)
end

#list_imdb(options) ⇒ Object

GET

list_imbd

See: yts.to/api#listimdbDocs

Get a list of movies using a desired list of IMDB IDs.



38
39
40
41
# File 'lib/yify/client.rb', line 38

def list_imdb(options)
  data = self.class.get("/listimdb", { query: options })
  Yify::Response.new(data, :movie_list)
end

#login(options) ⇒ Object

POST

login

See: yts.to/api#loginDocs

Login a Yify user.



104
105
106
107
# File 'lib/yify/client.rb', line 104

def (options)
  data = self.class.post("/login", { body: options })
  Yify::Response.new(data, :session)
end

#make_request(options) ⇒ Object

POST

make_request

See: yts.to/api#makerequestsDocs

Request a movie to be added to Yify.



168
169
170
171
# File 'lib/yify/client.rb', line 168

def make_request(options)
  data = self.class.post("/makerequest", { body: options })
  Yify::Response.new(data, :api_response)
end

#movie(id) ⇒ Object

GET

movie

See: yts.to/api#movieDocs

Get movie details.



49
50
51
52
# File 'lib/yify/client.rb', line 49

def movie(id)
  data = self.class.get("/movie", { query: { id: id } })
  Yify::Response.new(data, :movie)
end

#post_comment(options) ⇒ Object

POST

post_comment

See: yts.to/api#commentpostDocs

Add comment to a movie.



71
72
73
74
# File 'lib/yify/client.rb', line 71

def post_comment(options)
  data = self.class.post("/commentpost", { body: options })
  Yify::Response.new(data, :api_response)
end

#profile(hash) ⇒ Object

GET

profile

See: yts.to/api#profileDocs

Get a logged in users’ profile.



135
136
137
138
# File 'lib/yify/client.rb', line 135

def profile(hash)
  data = self.class.get("/profile", { query: { hash: hash } })
  Yify::Response.new(data, :profile)
end

#register(options) ⇒ Object

POST

register

See: yts.to/api#registerDocs

Register a new user with Yify.



93
94
95
96
# File 'lib/yify/client.rb', line 93

def register(options)
  data = self.class.post("/register", { body: options })
  Yify::Response.new(data, :api_response)
end

#requests(options) ⇒ Object

GET

requests

See: yts.to/api#requestsDocs

Get a list of all requested movies.



157
158
159
160
# File 'lib/yify/client.rb', line 157

def requests(options)
  data = self.class.get("/requests", { query: options })
  Yify::Response.new(data, :request_list)
end

#reset_password(options) ⇒ Object

POST

reset_password

See: yts.to/api#resetPasswordDocs

Reset the users’ password.



124
125
126
127
# File 'lib/yify/client.rb', line 124

def reset_password(options)
  data = self.class.post("/resetpassconfirm", { body: options })
  Yify::Response.new(data, :api_response)
end

#send_password_reset(email) ⇒ Object

POST

send_password_reset

yts.to/api#passRecoveryDoc

Send a password reset email to the specified email address.



115
116
117
118
# File 'lib/yify/client.rb', line 115

def send_password_reset(email)
  data = self.class.post("/sendresetpass", { body: { email: email } })
  Yify::Response.new(data, :api_response)
end

#upcomingObject

GET

upcoming

See: yts.to/api#upcomingDocs

A list of all upcoming movies.



15
16
17
18
# File 'lib/yify/client.rb', line 15

def upcoming
  data = self.class.get("/upcoming")
  Yify::Response.new(data, :upcoming_movie)
end

#update_profile(options) ⇒ Object

POST

update_profile

See: yts.to/api#editProfileDocs

update a logged in users’ profile.



146
147
148
149
# File 'lib/yify/client.rb', line 146

def update_profile(options)
  data = self.class.post("/editprofile", { body: options })
  Yify::Response.new(data, :api_response)
end

#user(user_id) ⇒ Object

GET

user

See: yts.to/api#userDocs

Get desired users’ details.



82
83
84
85
# File 'lib/yify/client.rb', line 82

def user(user_id)
  data = self.class.get("/user", { query: { id: user_id } })
  Yify::Response.new(data, :user)
end

#vote(options) ⇒ Object

POST

vote

See: yts.to/api#voteDocs

Vote for a requested movie.



179
180
181
182
# File 'lib/yify/client.rb', line 179

def vote(options)
  data = self.class.post("/vote", { body: options })
  Yify::Response.new(data, :api_response)
end