Class: WebPurify::Client
- Inherits:
-
Object
- Object
- WebPurify::Client
- Includes:
- Blacklist, ImageFilters, TextFilters, Whitelist
- Defined in:
- lib/web_purify/client.rb
Overview
WebPurify::Client
The WebPurify::Client class maintains state of the request parameters like api_key, endpoint, etc., and provides easy methods for accessing WebPurify
Instance Method Summary collapse
- #image_request_base ⇒ Object
-
#initialize(options) ⇒ Client
constructor
Initialize the class.
- #text_request_base ⇒ Object
Methods included from ImageFilters
#imgaccount, #imgcheck, #imgstatus
Methods included from Whitelist
#add_to_whitelist, #get_whitelist, #remove_from_whitelist
Methods included from Blacklist
#add_to_blacklist, #get_blacklist, #remove_from_blacklist
Methods included from TextFilters
#check, #check_count, #replace, #return
Constructor Details
#initialize(options) ⇒ Client
Initialize the class
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/web_purify/client.rb', line 19 def initialize() if .is_a? String @api_key = @endpoint = :us @enterprise = false elsif .is_a? Hash @api_key = [:api_key] @endpoint = [:endpoint] || :us @enterprise = [:enterprise] || false end @request_base = { :host => WebPurify::Constants.text_endpoints.fetch(@endpoint), :path => WebPurify::Constants.rest_path, :scheme => WebPurify::Constants.scheme(@enterprise) } @query_base = { :api_key => @api_key, :format => WebPurify::Constants.format } end |
Instance Method Details
#image_request_base ⇒ Object
46 47 48 |
# File 'lib/web_purify/client.rb', line 46 def image_request_base @request_base.merge(:host => WebPurify::Constants.image_endpoint) end |
#text_request_base ⇒ Object
42 43 44 |
# File 'lib/web_purify/client.rb', line 42 def text_request_base @request_base end |