Sha256: 2068f183f90f494ef235c0f1b56018f5c41beea1085740f9949b9ed133ca0ab9

Contents?: true

Size: 1.78 KB

Versions: 6

Compression:

Stored size: 1.78 KB

Contents

require 'net/http'
require 'open-uri'
require 'active_record'

require 'google_safe_browsing/google_safe_browsing_railtie' if defined?(Rails)

require  'google_safe_browsing/version'

require  'google_safe_browsing/api_v2'
require  'google_safe_browsing/binary_helper'
require  'google_safe_browsing/canonicalize'
require  'google_safe_browsing/chunk_helper'
require  'google_safe_browsing/hash_helper'
require  'google_safe_browsing/http_helper'
require  'google_safe_browsing/response_helper'
require  'google_safe_browsing/top_level_domain'

require  'google_safe_browsing/add_shavar'
require  'google_safe_browsing/sub_shavar'
require  'google_safe_browsing/full_hash'

require  'google_safe_browsing/rescheduler'

module GoogleSafeBrowsing

  # Handles the configuration values for the module
  class Config
    attr_accessor :client, :app_ver, :p_ver, :host, :current_lists, :api_key

    def initialize
      @client         = 'api'
      @app_ver        = VERSION
      @p_ver          = '2.2'
      @host           = 'http://safebrowsing.clients.google.com/safebrowsing'
      @current_lists  = [ 'googpub-phish-shavar', 'goog-malware-shavar' ]
    end
  end

  # Returns of initializes the Module configuration
  def self.config
    @@config ||= Config.new
  end

  # Allows for setting config values via a block
  def self.configure
    yield self.config
  end

  # Adds the Rescheduler job to Resque
  def self.kick_off
    Resque.enqueue(Rescheduler)
  end


  # Converts the official Google list name into the name to return
  #
  # @param (String) list the 'official' list name
  # @return (String) the friendly list name
  def self.friendly_list_name(list)
    case list
    when 'goog-malware-shavar'
      'malware'
    when 'googpub-phish-shavar'
      'phishing'
    else
      nil
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
google_safe_browsing-0.4.2 lib/google_safe_browsing.rb
google_safe_browsing-0.4.1 lib/google_safe_browsing.rb
google_safe_browsing-0.4.0 lib/google_safe_browsing.rb
google_safe_browsing-0.3.9 lib/google_safe_browsing.rb
google_safe_browsing-0.3.8 lib/google_safe_browsing.rb
google_safe_browsing-0.3.7 lib/google_safe_browsing.rb