Module: WebPurify::Constants

Defined in:
lib/web_purify/constants.rb

Overview

WebPurify::Constants

WebPurify::Constants holds all the static variables used to access the API.

Class Method Summary collapse

Class Method Details

.formatString

The response format

Returns:

  • (String)

    The format



39
40
41
# File 'lib/web_purify/constants.rb', line 39

def self.format
  return 'json'
end

.image_endpointString

The endpoint for the image moderation service

Returns:

  • (String)

    The endpoint



23
24
25
# File 'lib/web_purify/constants.rb', line 23

def self.image_endpoint
  return 'im-api1.webpurify.com'
end

.methodsHash

A hash for each API method

Returns:

  • (Hash)

    The method hash



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/web_purify/constants.rb', line 57

def self.methods
  return {
    :check                 => 'webpurify.live.check',
    :check_count           => 'webpurify.live.checkcount',
    :replace               => 'webpurify.live.replace',
    :return                => 'webpurify.live.return',
    :add_to_blacklist      => 'webpurify.live.addtoblacklist',
    :add_to_whitelist      => 'webpurify.live.addtowhitelist',
    :remove_from_blacklist => 'webpurify.live.removefromblacklist',
    :remove_from_whitelist => 'webpurify.live.removefromwhitelist',
    :get_blacklist         => 'webpurify.live.getblacklist',
    :get_whitelist         => 'webpurify.live.getwhitelist',
    :imgcheck              => 'webpurify.live.imgcheck',
    :imgstatus             => 'webpurify.live.imgstatus',
    :imgaccount            => 'webpurify.live.imgaccount'
  }
end

.rest_pathString

Path appended to the endpoint URI

Returns:

  • (String)

    The rest path



31
32
33
# File 'lib/web_purify/constants.rb', line 31

def self.rest_path
  return '/services/rest/'
end

.scheme(enterprise) ⇒ String

Returns either http or https depending on whether enterprise mode

is selected.

Parameters:

  • enterprise (Boolean)

    True if enterprise mode, false if not

Returns:

  • (String)

    The scheme, either http or https



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

def self.scheme(enterprise)
  return enterprise ? 'https' : 'http'
end

.text_endpointsHash

The endpoints for the text moderation service

Returns:

  • (Hash)

    A hash of endpoints



11
12
13
14
15
16
17
# File 'lib/web_purify/constants.rb', line 11

def self.text_endpoints
  return {
    :us => 'api1.webpurify.com',
    :eu => 'api1-eu.webpurify.com',
    :ap => 'api1-ap.webpurify.com'
  }
end