def prepare_and_invoke_api_call(path, options = {})
      api_call = prepare_api_call(path, options)
      data = invoke_api_call(api_call)

      parsed_data = case options[:format]
        when 'json' then JSON.parse(data)
        when 'xml' then REXML::Document.new(data)
        else JSON.parse(data) rescue REXML::Document.new(data) rescue data
      end
      RubyDesk.logger.info "Parsed data: #{parsed_data.inspect}"
      return parsed_data
    end
def prepare_and_invoke_api_call(path, options = {})
      api_call = prepare_api_call(path, options)
      data = invoke_api_call(api_call)

      parsed_data = case options[:format]
        when 'json' then JSON.parse(data)
        when 'xml' then REXML::Document.new(data)
        else JSON.parse(data) rescue REXML::Document.new(data) rescue data
      end
      RubyDesk.logger.info "Parsed data: #{parsed_data.inspect}"
      return parsed_data
    end
Prepares an API call with the given arguments then invokes it and returns its body