class Hatefreeweb::Client

Attributes

api_key[R]

Public Class Methods

new(api_key = nil) click to toggle source

Get a free api_key @ www.hatefreeweb.org

# File lib/hatefreeweb/client.rb, line 11
def initialize(api_key = nil)
  @api_key = api_key
  @api_key ||= Hatefreeweb.api_key
  @api_path = ""
end

Public Instance Methods

detect(body, lang) click to toggle source
# File lib/hatefreeweb/client.rb, line 17
def detect(body, lang)
  options = {:body => {:body => body, :lang => lang}, :query => self.default_options}
  results = Mash.new(self.class.post("/detection", options))
  detection = results.message
end

Protected Instance Methods

default_options() click to toggle source
# File lib/hatefreeweb/client.rb, line 25
def default_options
  {:api_key => @api_key}
end