class PopcorntimeSearch::MovieResult
Attributes
imdb[RW]
imdb_id[RW]
kind[R]
title[RW]
year[RW]
Public Class Methods
new(result)
click to toggle source
# File lib/popcorntime_search/movie_result.rb, line 11 def initialize(result) @title = result['title'] @year = result['year'] @imdb_id = result['imdb_id'] @kind = :movie end
Public Instance Methods
links()
click to toggle source
# File lib/popcorntime_search/movie_result.rb, line 22 def links @links ||= build_links end
to_s()
click to toggle source
# File lib/popcorntime_search/movie_result.rb, line 18 def to_s "#{title} (#{year})" end
Private Instance Methods
build_links()
click to toggle source
# File lib/popcorntime_search/movie_result.rb, line 28 def build_links self.class.get("/#{@imdb_id}")['torrents'].each_with_object([]) do |(language, links), links_list| links.each do |quality, info| links_list << Link.new(title: @title, imdb_id: imdb_id, size: info['filesize'], magnet: info['url'], seeders: info['seed'], leechers: info['peer'], language: language, quality: quality, provider: info['provider']) end end end