Sha256: a973523b24a6ad5140c11abcf97262449b3d190938b958bd51d233cbf53c3af6

Contents?: true

Size: 771 Bytes

Versions: 1

Compression:

Stored size: 771 Bytes

Contents

require 'ocr_space/file_post'

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

        def text_data
            data[0]['ParsedText'].delete("\n").delete("\r").strip
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ocr_space-1.0 lib/ocr_space/from_file.rb