Sha256: f5319dd9906e314a4ccfdd9e59207fc86af3a6987cc06f96040573d906ad1e88
Contents?: true
Size: 715 Bytes
Versions: 3
Compression:
Stored size: 715 Bytes
Contents
require 'httparty' module OcrSpace class FromUrl attr_reader :data def initialize(apikey: ENV['ocr_api_key'], language: 'eng', isOverlayRequired: false, url: nil, ocr_space: 'https://api.ocr.space/parse/image') @data = HTTParty.post(ocr_space, body: { apikey: apikey, language: language, isOverlayRequired: isOverlayRequired, url: url }) @data = @data.parsed_response['ParsedResults'] end def text_data data[0]['ParsedText'].delete("\n").delete("\r").strip end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ocr_space-0.2.8.4 | lib/ocr_space/from_url.rb |
ocr_space-0.2.8.3 | lib/ocr_space/from_url.rb |
ocr_space-0.2.8.2 | lib/ocr_space/from_url.rb |