Class: Oddb2xml::Downloader
- Inherits:
-
Object
- Object
- Oddb2xml::Downloader
- Defined in:
- lib/oddb2xml/downloader.rb
Direct Known Subclasses
BagXmlDownloader, EphaDownloader, FirstbaseDownloader, LppvDownloader, MedregbmDownloader, MigelDownloader, RefdataDownloader, SwissmedicDownloader, SwissmedicInfoDownloader, ZurroseDownloader
Instance Attribute Summary collapse
-
#agent ⇒ Object
readonly
Returns the value of attribute agent.
-
#file2save ⇒ Object
readonly
Returns the value of attribute file2save.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #init ⇒ Object
-
#initialize(options = {}, url = nil) ⇒ Downloader
constructor
A new instance of Downloader.
- #report_download(url, file) ⇒ Object
Constructor Details
#initialize(options = {}, url = nil) ⇒ Downloader
Returns a new instance of Downloader.
42 43 44 45 46 47 48 49 |
# File 'lib/oddb2xml/downloader.rb', line 42 def initialize( = {}, url = nil) @options = @url = url @retry_times = 3 HTTPI.log = false # disable httpi warning Oddb2xml.log "Downloader from #{@url} for #{self.class}" init end |
Instance Attribute Details
#agent ⇒ Object (readonly)
Returns the value of attribute agent.
41 42 43 |
# File 'lib/oddb2xml/downloader.rb', line 41 def agent @agent end |
#file2save ⇒ Object (readonly)
Returns the value of attribute file2save.
41 42 43 |
# File 'lib/oddb2xml/downloader.rb', line 41 def file2save @file2save end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
41 42 43 |
# File 'lib/oddb2xml/downloader.rb', line 41 def type @type end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
41 42 43 |
# File 'lib/oddb2xml/downloader.rb', line 41 def url @url end |
Instance Method Details
#init ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/oddb2xml/downloader.rb', line 58 def init @agent = Mechanize.new @agent.user_agent = "Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20100101 Firefox/16.0" @agent.redirect_ok = true @agent.redirection_limit = 5 @agent. = true if RUBY_PLATFORM =~ (/mswin|mingw|bccwin|cygwin/i) && ENV["SSL_CERT_FILE"].nil? cert_store = OpenSSL::X509::Store.new cert_store.add_file(File.("../../../tools/cacert.pem", __FILE__)) @agent.cert_store = cert_store end @agent.verify_mode = OpenSSL::SSL::VERIFY_NONE end |