Sha256: fe858f4b3116271a106fd1f05495d2c419b022c5240a4e1f02c34c7417e736e3
Contents?: true
Size: 817 Bytes
Versions: 2
Compression:
Stored size: 817 Bytes
Contents
module PhishTank class FeedRequest attr_accessor :etag def initialize(etag = nil) @etag = etag || PhishTank.configuration.etag end def update? return true if @etag.nil? response = head(update_uri, :headers => {"ETag" => @etag}) response.headers_hash['Etag'] != "\"#{@etag}\"" end def get_update response = get(update_uri) file = File.new("#{PhishTank.configuration.temp_directory}/online-valid.xml", 'w') file.puts response.body file.close end def update_uri "#{BASE_URI}/data/#{PhishTank.configuration.api_key}/online-valid.xml" end def head(uri, opts = {}) Typhoeus::Request.head(uri, opts) end def get(uri, opts = {}) Typhoeus::Request.get(uri, opts) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
phishtank-0.1.2 | lib/phishtank/feed_request.rb |
phishtank-0.1.1 | lib/phishtank/feed_request.rb |