Sha256: f38499f4acacf965562c3c41a908a04575d583968da2532ab2250f388a69c78b
Contents?: true
Size: 1017 Bytes
Versions: 1
Compression:
Stored size: 1017 Bytes
Contents
module Onebox module Engine class GithubCommitOnebox include Engine include JSON matches do http maybe("www.") domain("github") tld("com") anything with("/commit/") end def url "https://api.github.com/repos/#{match[:owner]}/#{match[:repo]}/commits/#{match[:number]}" end private def match @url.match(/github\.com\/(?<owner>[^\/]+)\/(?<repo>[^\/]+)\/commit\/(?<number>[^\/]+)/) end def data { url: @url, owner: match[:owner], repo: match[:repo], sha: raw["sha"], gravatar: raw["author"]["avatar_url"], message: raw["commit"]["message"], author: raw["author"]["login"], time_date: raw["commit"]["committer"]["date"], files_changed: raw["files"].length, additions: raw["stats"]["additions"], deletions: raw["stats"]["deletions"] } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
onebox-1.1.0 | lib/onebox/engine/github_commit_onebox.rb |