class Car
Constants
- BROWSER_USER_AGENT
- USER_AGENT
Public Class Methods
Source
# File plugins/car.rb, line 39 def search(parsed, fetch:, fallback_fetch: nil, fetch_detail: nil) CarSearch.search(parsed, fetch: fetch, fallback_fetch: fallback_fetch, fetch_detail: fetch_detail) end
Public Instance Methods
Source
# File plugins/car.rb, line 63 def execute(m, args) parsed = self.class.parse_query(args) return themed_flood_safe_reply(m, parsed[:error]) if parsed[:error] themed_flood_safe_reply(m, search(parsed)) end
Source
# File plugins/car.rb, line 54 def fetch_brave_results(query) url = "#{CarSearch::BRAVE_SEARCH_URL}?q=#{CGI.escape(query)}" RabbotHttp.fetch(url, user_agent: BROWSER_USER_AGENT) end
Source
# File plugins/car.rb, line 59 def fetch_listing_details(url) RabbotHttp.fetch(url, user_agent: BROWSER_USER_AGENT) end
Source
# File plugins/car.rb, line 49 def fetch_results(query) url = "#{CarSearch::DDG_HTML_URL}?q=#{CGI.escape(query)}" RabbotHttp.fetch(url, user_agent: USER_AGENT) end
Source
# File plugins/car.rb, line 44 def search(parsed, fetch: method(:fetch_results), fallback_fetch: method(:fetch_brave_results), fetch_detail: method(:fetch_listing_details)) self.class.search(parsed, fetch: fetch, fallback_fetch: fallback_fetch, fetch_detail: fetch_detail) end