Class: MicrosoftComputerVision::Api::OCR

Inherits:
Object
  • Object
show all
Defined in:
lib/microsoft_computer_vision/api/ocr.rb

Constant Summary collapse

ENDPOINT =
'/ocr'

Instance Method Summary collapse

Constructor Details

#initialize(language, detect_orientation) ⇒ OCR

Returns a new instance of OCR.



6
7
8
9
# File 'lib/microsoft_computer_vision/api/ocr.rb', line 6

def initialize(language, detect_orientation)
  @language = language
  @detect_orientation = detect_orientation
end

Instance Method Details

#paramsObject



18
19
20
21
22
23
24
# File 'lib/microsoft_computer_vision/api/ocr.rb', line 18

def params
  data = {}
  data[:language] = @language if @language
  data[:detectOrientation] = @detect_orientation if @detect_orientation

  data
end

#uriObject



11
12
13
14
15
16
# File 'lib/microsoft_computer_vision/api/ocr.rb', line 11

def uri
  uri = URI("#{MicrosoftComputerVision::Client::API_BASE}#{ENDPOINT}")
  uri.query = URI.encode_www_form(params)

  uri
end