Module: GoogleSafeBrowsing

Defined in:
lib/google_safe_browsing.rb,
lib/google_safe_browsing/api_v2.rb,
lib/generators/install_generator.rb,
lib/google_safe_browsing/version.rb,
lib/google_safe_browsing/full_hash.rb,
lib/google_safe_browsing/add_shavar.rb,
lib/google_safe_browsing/key_helper.rb,
lib/google_safe_browsing/sub_shavar.rb,
lib/google_safe_browsing/hash_helper.rb,
lib/google_safe_browsing/http_helper.rb,
lib/google_safe_browsing/rescheduler.rb,
lib/google_safe_browsing/canonicalize.rb,
lib/google_safe_browsing/chunk_helper.rb,
lib/google_safe_browsing/binary_helper.rb,
lib/google_safe_browsing/response_helper.rb,
lib/google_safe_browsing/top_level_domain.rb,
lib/google_safe_browsing/google_safe_browsing_railtie.rb

Defined Under Namespace

Classes: APIv2, AddShavar, BinaryHelper, Canonicalize, ChunkHelper, Config, FullHash, GoogleSafeBrowsingRailtie, HashHelper, HttpHelper, InstallGenerator, KeyHelper, Rescheduler, ResponseHelper, SubShavar, TopLevelDomain

Constant Summary collapse

VERSION =
"0.5.1"

Class Method Summary collapse

Class Method Details

.configObject

Returns of initializes the Module configuration



49
50
51
# File 'lib/google_safe_browsing.rb', line 49

def self.config
  @@config ||= Config.new
end

.configure {|self.config| ... } ⇒ Object

Allows for setting config values via a block

Yields:



54
55
56
# File 'lib/google_safe_browsing.rb', line 54

def self.configure
  yield self.config
end

.friendly_list_name(list) ⇒ String

Converts the official Google list name into the name to return

Parameters:

  • list (String)

    the ‘official’ list name

Returns:

  • (String)

    the friendly list name



68
69
70
71
72
73
74
75
76
77
# File 'lib/google_safe_browsing.rb', line 68

def self.friendly_list_name(list)
  case list
  when 'goog-malware-shavar'
    'malware'
  when 'googpub-phish-shavar'
    'phishing'
  else
    nil
  end
end

.kick_offObject

Adds the Rescheduler job to Resque



59
60
61
# File 'lib/google_safe_browsing.rb', line 59

def self.kick_off
  Resque.enqueue(Rescheduler)
end