Class: Nzbs::NZB
- Inherits:
-
Object
- Object
- Nzbs::NZB
- Defined in:
- lib/sites/nzbs/nzb.rb
Constant Summary collapse
- URL =
'http://www.nzbs.org'
- DAYS_BY_PAGE =
5
Instance Attribute Summary collapse
-
#agent ⇒ Object
Returns the value of attribute agent.
-
#nzbs ⇒ Object
Returns the value of attribute nzbs.
Instance Method Summary collapse
- #download(movie) ⇒ Object
-
#initialize(options = {}) ⇒ NZB
constructor
A new instance of NZB.
Constructor Details
#initialize(options = {}) ⇒ NZB
Returns a new instance of NZB.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/sites/nzbs/nzb.rb', line 18 def initialize( = {}) @options = @options[:age] ||= DAYS_BY_PAGE @options[:pages] ||= ((@options[:age].to_f + DAYS_BY_PAGE) / DAYS_BY_PAGE).ceil @nzb_urls = [] @nzbs = [] (1..(@options[:pages].to_i)).each do |page| @nzb_urls << "#{URL}/index.php?action=browse&catid=4&page=#{(page)}" end login parse_nzbs end |
Instance Attribute Details
#agent ⇒ Object
Returns the value of attribute agent.
16 17 18 |
# File 'lib/sites/nzbs/nzb.rb', line 16 def agent @agent end |
#nzbs ⇒ Object
Returns the value of attribute nzbs.
16 17 18 |
# File 'lib/sites/nzbs/nzb.rb', line 16 def nzbs @nzbs end |
Instance Method Details
#download(movie) ⇒ Object
34 35 36 |
# File 'lib/sites/nzbs/nzb.rb', line 34 def download(movie) @agent.get_file(movie.nzb_link) end |