Sha256: f958f9d22b5d1220b57498f20d6dbe690aa0bd3c0db9b14eab5f913d4e72f1ed

Contents?: true

Size: 786 Bytes

Versions: 3

Compression:

Stored size: 786 Bytes

Contents

require 'ocr_space/file_post'
require 'fileutils'

module OcrSpace
    class FromFile
        attr_reader :data
        def initialize(apikey: ENV['ocr_api_key'], language: 'eng', isOverlayRequired: false, files: nil, ocr_space: 'https://api.ocr.space/parse/image')
            @file = File.new(files)
            @data = OcrSpace::FilePost.post('/parse/image',
                                            body: { apikey: apikey,
                                                    language: language,
                                                    isOverlayRequired: isOverlayRequired,
                                                    files: @file })
        end

        def text_data
            data.parsed_response['ParsedResults'][0]['ParsedText']
        end
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ocr_space-0.2.7.3 lib/ocr_space/from_file.rb
ocr_space-0.2.7.2 lib/ocr_space/from_file.rb
ocr_space-0.2.7.1 lib/ocr_space/from_file.rb