Class: Olam::Api

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

Instance Method Summary collapse

Instance Method Details

#search(term) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/olam.rb', line 5

def search(term)
  request_body = {timestampajax: Time.now.to_i, seq: 6, ajax_type: 'definition', word: term}

  response = HTTParty.post('http://mashithantu.com/dictionary/ajaxdict.php', body: request_body)
  str = sanitize(response.to_s)
  (str.scan(/&nbsp;(\w+)<br>/) + str.scan(/&nbsp;(\w+)<br \/>/)).join('|')
end