Class: Cherrypicker::Fileserve
- Inherits:
-
Object
- Object
- Cherrypicker::Fileserve
- Defined in:
- lib/cherrypicker/plugins/fileserve.rb
Instance Attribute Summary collapse
-
#download_url ⇒ Object
Returns the value of attribute download_url.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#link ⇒ Object
Returns the value of attribute link.
-
#location ⇒ Object
Returns the value of attribute location.
Class Method Summary collapse
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize(link, opts = {}) ⇒ Fileserve
constructor
A new instance of Fileserve.
Constructor Details
#initialize(link, opts = {}) ⇒ Fileserve
Returns a new instance of Fileserve.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/cherrypicker/plugins/fileserve.rb', line 16 def initialize(link, opts={}) o = { :location => nil, :username => nil, :password => nil, }.merge(opts) @link = link @filename = "" @location = o[:location] @download_url = "" hostname = "http://www.fileserve.com/file/JmcsvYZ/Thor.2011.TS.READNFO.XViD-IMAGiNE.avi" a = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' agent. = true page = agent.get('http://www.fileserve.com/login.php') form = signin_page.form_with(:name => 'login_form') do |form| form.loginUserName = o[:username] form.loginUserPassword = o[:password] end.submit page = agent.get('http://www.fileserve.com/login.php') } #@download_url = reply.response['location'] end |
Instance Attribute Details
#download_url ⇒ Object
Returns the value of attribute download_url.
10 11 12 |
# File 'lib/cherrypicker/plugins/fileserve.rb', line 10 def download_url @download_url end |
#filename ⇒ Object
Returns the value of attribute filename.
10 11 12 |
# File 'lib/cherrypicker/plugins/fileserve.rb', line 10 def filename @filename end |
#link ⇒ Object
Returns the value of attribute link.
10 11 12 |
# File 'lib/cherrypicker/plugins/fileserve.rb', line 10 def link @link end |
#location ⇒ Object
Returns the value of attribute location.
10 11 12 |
# File 'lib/cherrypicker/plugins/fileserve.rb', line 10 def location @location end |
Class Method Details
.matches_provider?(url) ⇒ Boolean
12 13 14 |
# File 'lib/cherrypicker/plugins/fileserve.rb', line 12 def self.matches_provider?(url) url.include?("fileserve.com") end |
Instance Method Details
#download ⇒ Object
48 49 50 |
# File 'lib/cherrypicker/plugins/fileserve.rb', line 48 def download # Cherrypicker::download_file(@download_url, :location => @location, :filename => @filename) end |