# For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-ruby
require 'aspose_cells_cloud'

class OLEObject

  include AsposeCellsCloud

  def initialize
     #Get client_id and client_secret from https://cloud.aspose.com
   
    @instance =  AsposeCellsCloud::CellsApi.new($client_id,$client_secret,$api_version,$baseurl) 
  end

  # Add OLE object
  def add_ole_object
    name = $BOOK1
    sheet_name = $SHEET6
    ole_object = nil
    upper_left_row = 1
    upper_left_column = 1
    height = 100
    width = 80
    ole_file = 'OLEDoc.docx'
    image_file = 'word.jpg'
    folder = $TEMPFOLDER
    result = @instance.upload_file( folder+"/"+name,  ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) })
    result = @instance.upload_file( folder+"/"+ole_file,  ::File.open(File.expand_path("data/"+ole_file),"r") {|io| io.read(io.size) })
    result = @instance.upload_file( folder+"/"+image_file,  ::File.open(File.expand_path("data/"+image_file),"r") {|io| io.read(io.size) })
    expect(result.uploaded.size).to  be > 0
    result = @instance.cells_ole_objects_put_worksheet_ole_object(name, sheet_name, {  :ole_object=>ole_object, :upper_left_row=>upper_left_row, :upper_left_column=>upper_left_column, :height=>height, :width=>width, :ole_file=> (folder+"/"+ole_file), :image_file=> (folder+"/"+image_file),:folder=>folder})
    expect(result.code).to eql(200)
  end

end

oleObject = OLEObject.new()
puts oleObject.add_ole_object