Class: BadWordFilter::ApiCaller

Inherits:
Object
  • Object
show all
Defined in:
lib/bad_word_filter.rb

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ ApiCaller

Returns a new instance of ApiCaller.



15
16
17
# File 'lib/bad_word_filter.rb', line 15

def initialize(url)
  @url = url
end

Instance Method Details

#call(content, censor_character = '*') ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/bad_word_filter.rb', line 18

def call(content,censor_character='*')
  RestClient.post(@url, {'content':content.to_s, 'censor-character': censor_character},
                  'X-RapidAPI-Host': 'neutrinoapi-bad-word-filter.p.rapidapi.com',
                  'X-RapidAPI-Key': '93b5b963b7msh8c32d7f238b220ep17fe54jsn544b3021e726',
                  'Content-Type': 'application/x-www-form-urlencoded'

  )
end