lib/codestatus/repositories/github_repository.rb in codestatus-0.1.2 vs lib/codestatus/repositories/github_repository.rb in codestatus-0.1.3
- old
+ new
@@ -1,30 +1,30 @@
require "octokit"
module Codestatus
module Repositories
- class GitHubRepository
- def initialize(slug)
- # 'influitive/apartment'
- @repo = slug
- end
-
+ class GitHubRepository < Base
# combined status on github
# https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref
def status(ref = default_branch)
- response = client.combined_status(@repo, ref)
+ response = client.combined_status(slug, ref)
BuildStatus.new(sha: response.sha, status: response.state)
end
+ # https://github.com/meganemura/codestatus
+ def html_url
+ repository['html_url']
+ end
+
private
def default_branch
repository['default_branch']
end
def repository
- @repository ||= client.repository(@repo)
+ @repository ||= client.repository(slug)
end
def client
@client ||= Octokit::Client.new(access_token: access_token)
end