Sha256: 8f2f5a15731c2c7763d82f9e4cd70cf41acfa3864c79c70cddfb0eaab014ba32
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require 'nokogiri' require 'ostruct' module PhishTank class Data attr_reader :file, :doc, :entries def initialize(data_file_path = nil) @file = data_file_path || "#{PhishTank.configuration.temp_directory}/online-valid.xml" raise "Data File Not Found!" unless File.exists?(@file) @doc = parse_data_file @entries = [] process_data_file end def process_data_file @doc.xpath("//entry").each do |entry_item| entry = OpenStruct.new entry.url = entry_item.at("url").text entry.phish_id = entry_item.at("phish_id").text entry.phish_detail_url = entry_item.at("phish_detail_url").text entry.ip_address = entry_item.at("ip_address").text entry.submission_time = entry_item.at("submission_time").text entry.verified = entry_item.at("verified").text entry.verification_time = entry_item.at("verification_time").text entry.online_status = entry_item.at("online").text entry.target = entry_item.at("target").text @entries.push entry end end def parse_data_file Nokogiri::XML(File.read(@file)) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
phishtank-0.1.0 | lib/phishtank/data.rb |