module PlateRecognizer
Constants
- VERSION
Public Class Methods
process(image_path)
click to toggle source
# File lib/plate_recognizer.rb, line 115 def self.process(image_path) raise 'Plate Recognizer API must be set!' if PlateRecognizer.api_key.blank? url = URI.parse('https://api.platerecognizer.com/v1/plate-reader') req = Net::HTTP::Post.new(url.path) req['Accept'] = 'application/json' req['Authorization'] = "TOKEN #{PlateRecognizer.api_key}" form_data = [['upload', File.open(image_path)]] req.set_form form_data, 'multipart/form-data' sock = Net::HTTP.new(url.host, url.port) sock.use_ssl = true response = sock.start { |http| http.request(req) } begin Output.new(JSON.parse(response.body)) rescue nil end end
setup() { |self| ... }
click to toggle source
# File lib/plate_recognizer.rb, line 111 def self.setup yield self end