Sha256: daab229df99707cf0b9b44ff1a38ee75fd3188fcd36c75789dd9c32c55cc0ffa

Contents?: true

Size: 741 Bytes

Versions: 1

Compression:

Stored size: 741 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('https://api.ocr.space/parse/image',
                                  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

1 entries across 1 versions & 1 rubygems

Version Path
ocr_space-0.2.8.1 lib/ocr_space/from_url.rb