Sha256: 9446d0a86eaf571fd1f8043859747b9866b4ef48f5857daf7a01bf83b3dfc6a5

Contents?: true

Size: 776 Bytes

Versions: 3

Compression:

Stored size: 776 Bytes

Contents

require 'ocr_space/file_post'

module OcrSpace
    class FromFile
        attr_reader :data
        def initialize(apikey: ENV['ocr_api_key'], language: 'eng', isOverlayRequired: false, files: nil)
            @file = File.new(files)
            @data = OcrSpace::FilePost.post('/parse/image',
                                            body: { apikey: apikey,
                                                    language: language,
                                                    isOverlayRequired: isOverlayRequired,
                                                    files: @file })
            @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_file.rb
ocr_space-0.2.8.3 lib/ocr_space/from_file.rb
ocr_space-0.2.8.2 lib/ocr_space/from_file.rb