Ruby And The YIFY Torrents API
Install the Yify gem
gem install yify
Require Yify in your project:
require 'yify'
This gem translates the raw JSON coming back from Yify into full fledged Ruby objects. This means you can access properties like this:
client = Yify::Client.new
=> #<Yify::Client:0x007f9b14321ef8>
movie = client.movie(353).result
=> #<Yify::Models::Movie:0x007f9b14360130>
movie.movie_title
=> "We Were Soldiers (2002)"
A Yify::Response
will always return an untouched hash as well, like this:
movie = client.movie(353).response
=> {"MovieID"=>"353",
"MovieUrl"=>"http://yts.re/movie/We_Were_Soldiers_2002",
"DateUploaded"=>"2011-08-31 01:04:02",
... }
movie["MovieID"]
=> "353"
Written by Jon Lunsford
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#