Module: GoogleSafeBrowsing

Defined in:
lib/google_safe_browsing.rb,
lib/google_safe_browsing/api_v2.rb,
lib/google_safe_browsing/shavar.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/chunk_list.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

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

Constant Summary collapse

VERSION =
"0.6.5"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject

Returns the value of attribute logger.



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

def logger
  @logger
end

Class Method Details

.configObject

Returns of initializes the Module configuration



57
58
59
# File 'lib/google_safe_browsing.rb', line 57

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

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

Allows for setting config values via a block

Yields:



62
63
64
# File 'lib/google_safe_browsing.rb', line 62

def configure
  yield 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



75
76
77
78
79
80
81
82
83
84
# File 'lib/google_safe_browsing.rb', line 75

def 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



67
68
69
# File 'lib/google_safe_browsing.rb', line 67

def kick_off
  Resque.enqueue(Rescheduler)
end