Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Ruby Githubapi基于提交id从github获取提交树代码_Ruby_Github - Fatal编程技术网

使用Ruby Githubapi基于提交id从github获取提交树代码

使用Ruby Githubapi基于提交id从github获取提交树代码,ruby,github,Ruby,Github,我需要根据提交id从github获取代码。我正在使用github_api gem,我的应用程序使用github对用户进行身份验证 例如,如果用户提供提交id,我需要的是获取树url,从文件中获取代码并返回代码 提前感谢。我使用github_api实现了上述功能。下面是完成此功能的代码 git = Github.new github.git_data.trees.get 'username', 'repo', 'commit_sha' 这将提供json格式的数据,您可以根据需要获取参数的值 谢

我需要根据提交id从github获取代码。我正在使用github_api gem,我的应用程序使用github对用户进行身份验证

例如,如果用户提供提交id,我需要的是获取树url,从文件中获取代码并返回代码


提前感谢。

我使用github_api实现了上述功能。下面是完成此功能的代码

git = Github.new
github.git_data.trees.get  'username', 'repo', 'commit_sha'
这将提供json格式的数据,您可以根据需要获取参数的值

谢谢GithubAPI