def create_entity(file, io = nil, properties = {})
      params = { deviceid: @device_id, serviceid: @service_id, filename: file.name, type: file.type }.merge(properties)
      params[:parentid] = file.parent_id unless file.parent_id.nil?

      if params[:properties]
        params[:properties] = params[:properties].to_json
      end

      file_handle = unless file.id
        response = get('/createFile', params)
        File.from_json(response.body['file'])
      else
        file
      end

      if io
        HttpHelper.send_file(files_url, @token, @device_id, @service_id, file_handle, io, @logger)
        file_handle.size = io.size
      end

      file_handle
    end
def create_entity(file, io = nil, properties = {})
      params = { deviceid: @device_id, serviceid: @service_id, filename: file.name, type: file.type }.merge(properties)
      params[:parentid] = file.parent_id unless file.parent_id.nil?

      if params[:properties]
        params[:properties] = params[:properties].to_json
      end

      file_handle = unless file.id
        response = get('/createFile', params)
        File.from_json(response.body['file'])
      else
        file
      end

      if io
        HttpHelper.send_file(files_url, @token, @device_id, @service_id, file_handle, io, @logger)
        file_handle.size = io.size
      end

      file_handle
    end
Creates a file handle and optionally attach an io.
 The provided file argument is expected to contain at minimum
 a name, type and parent_id. If it has a mimetype that will be assumed to
 match the mimetype of the io.