Module: WebPurify::Blacklist

Included in:
Client
Defined in:
lib/web_purify/methods/blacklist.rb

Overview

WebPurify::Blacklist

Handles all methods related to the WebPurify Blacklist

Instance Method Summary collapse

Instance Method Details

#add_to_blacklist(word, deep_search = 0) ⇒ Boolean

Add a word to the blacklist

Parameters:

  • word (String)

    The word to add to the blacklist

  • deep_search (Integer) (defaults to: 0)

    1 if deep search on word, otherwise 0 for not (default 0)

Returns:

  • (Boolean)

    True if successful, false if not



13
14
15
16
17
18
19
20
21
# File 'lib/web_purify/methods/blacklist.rb', line 13

def add_to_blacklist(word, deep_search=0)
  params = {
    :method => WebPurify::Constants.methods[:add_to_blacklist],
    :word   => word,
    :ds     => deep_search
  }
  parsed = WebPurify::Request.query(@request_base, @query_base, params)
  return parsed[:success]=='1'
end

#get_blacklistArray

Get the blacklist

Returns:

  • (Array)

    An array of words in the blacklist



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/web_purify/methods/blacklist.rb', line 41

def get_blacklist
  params = {
    :method => WebPurify::Constants.methods[:get_blacklist]
  }
  parsed = WebPurify::Request.query(@request_base, @query_base, params)
  if parsed[:word]
    return [] << parsed[:word]
  else
    return []
  end
end

#remove_from_blacklist(word) ⇒ Boolean

Remove a word from the blacklist

Parameters:

  • word (String)

    The word to remove from the blacklist

Returns:

  • (Boolean)

    True if successful, false if not



28
29
30
31
32
33
34
35
# File 'lib/web_purify/methods/blacklist.rb', line 28

def remove_from_blacklist(word)
  params = {
    :method => WebPurify::Constants.methods[:remove_from_blacklist],
    :word   => word
  }
  parsed = WebPurify::Request.query(@request_base, @query_base, params)
  return parsed[:success]=='1'
end