class Scanr

Public Class Methods

new(token, lang = 'eng') click to toggle source
# File lib/scanr.rb, line 5
def initialize(token, lang = 'eng')
  @token = token
  @lang = lang
end

Public Instance Methods

ocr(path) click to toggle source
# File lib/scanr.rb, line 10
def ocr(path)
  params = {}
  if path.start_with?('http')
    params[:url] = path
  else
    params[:file] = File.new(path, 'rb')
  end
  JSON.parse RestClient.post(url, params)
end