Method: Aspose::Cloud::Barcode::Reader#readr

Defined in:
lib/Barcode/reader.rb

#readr(remote_image_name, remote_folder = '', symbology = '', format = '', storage_type = 'Aspose', storage_name = '') ⇒ Object

Read Barcode from Aspose Cloud Storage

@param string remote_image_name Name of the image.
@param string symbology Type of barcode.
@param string format Returns an image in specified format.


47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/Barcode/reader.rb', line 47

def readr(remote_image_name, remote_folder='', symbology='', format='', storage_type='Aspose', storage_name='')
  raise 'remote image file not provided.' if remote_image_name.empty?

  str_uri = "#{Aspose::Cloud::Common::Product.product_uri}/barcode/#{remote_image_name}/recognize"
  str_uri = "#{str_uri}?type=#{symbology}" unless symbology.empty?
  str_uri = "#{str_uri}?format=#{format}" unless format.empty?
  str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,remote_folder,storage_name,storage_type)

  signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
  response = RestClient.get(signed_uri, :accept => 'application/json')
  json = JSON.parse(response)
  json['Code'] == 200 ? json['Barcodes'] : nil
end