我本质上使用的是docs here提供的示例代码,但出现读取ArgumentError - unknown keyword: snippet的错误。还有其他人也有这个问题吗?我不确定这是否是一个有效的错误,但是从直观上讲,他们提供的示例代码应该正确吗?

properties = {
                'snippet.parentId': '123',
                'snippet.textOriginal': message
            }
            resource = create_resource(properties)
            response = service.insert_comment('snippet', resource)

最佳答案

深入研究实际的库之后,我发现传递代码段部分的方式如下:

snippet = Google::Apis::YoutubeV3::CommentSnippet.new(parent_id: parent_id, text_original: message)
comment = Google::Apis::YoutubeV3::Comment.new(snippet: snippet)

response = service.insert_comment('snippet', comment)

希望这可以使某人免于必须仔细阅读文档的巨大麻烦

关于ruby - Youtube API V3插入评论问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44769985/

10-12 07:15