Class: Cherrypicker::Fileserve

Inherits:
Object
  • Object
show all
Defined in:
lib/cherrypicker/plugins/fileserve.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(link, opts = {}) ⇒ 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.follow_meta_refresh = true
     page = agent.get('http://www.fileserve.com/login.php')
         
     form = .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_urlObject

Returns the value of attribute download_url.



10
11
12
# File 'lib/cherrypicker/plugins/fileserve.rb', line 10

def download_url
  @download_url
end

#filenameObject

Returns the value of attribute filename.



10
11
12
# File 'lib/cherrypicker/plugins/fileserve.rb', line 10

def filename
  @filename
end

Returns the value of attribute link.



10
11
12
# File 'lib/cherrypicker/plugins/fileserve.rb', line 10

def link
  @link
end

#locationObject

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

#downloadObject



48
49
50
# File 'lib/cherrypicker/plugins/fileserve.rb', line 48

def download
 # Cherrypicker::download_file(@download_url, :location => @location, :filename => @filename)
end