Module: WebPurify::Whitelist

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

Overview

WebPurify::Whitelist

Handles all methods related to the WebPurify whitelist

Instance Method Summary collapse

Instance Method Details

#add_to_whitelist(word) ⇒ Boolean

Add a word to the whitelist

Parameters:

  • word (String)

    The word to add to the whitelist

Returns:

  • (Boolean)

    True if successful, false if not



12
13
14
15
16
17
18
19
# File 'lib/web_purify/methods/whitelist.rb', line 12

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

#get_whitelistArray

Get the whitelist

Returns:

  • (Array)

    An array of words in the whitelist



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/web_purify/methods/whitelist.rb', line 39

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

#remove_from_whitelist(word) ⇒ Boolean

Remove a word from the whitelist

Parameters:

  • word (String)

    The word to remove from the whitelist

Returns:

  • (Boolean)

    True if successful, false if not



26
27
28
29
30
31
32
33
# File 'lib/web_purify/methods/whitelist.rb', line 26

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