Ad requirement 4
I have no idea how this requirement shall be implemented at the end, but at first step, the tiss_crawler.rb lib checks if the search_term is an empty string and returns an error msg if found otherwise it returns the result, but appended to 'content' key
This commit is contained in:
@@ -10,10 +10,15 @@ class TissCrawler
|
||||
search_parameter = params[:search_parameter]
|
||||
search_term = params[:search_term].parameterize(separator: '+')
|
||||
url = host + api + '?' + search_parameter + '=' + search_term
|
||||
puts(url)
|
||||
puts('generated url:', url)
|
||||
|
||||
if search_term == ""
|
||||
{'error': 'Dare you try! Empty searches are not allowed!'}
|
||||
else
|
||||
response = HTTParty.get(url)
|
||||
{'content': JSON.parse(response.body)['results']}
|
||||
end
|
||||
|
||||
response = HTTParty.get(url)
|
||||
JSON.parse(response.body)['results']
|
||||
end
|
||||
|
||||
def self.get_details(params)
|
||||
|
||||
Reference in New Issue
Block a user