class CodecovApi::Api::Commits
Public Class Methods
new(owner, repo)
click to toggle source
# File lib/codecov_api/api/commits.rb, line 6 def initialize(owner, repo) @owner = owner @repo = repo end
Public Instance Methods
folder_totals(path, branch = 'master')
click to toggle source
# File lib/codecov_api/api/commits.rb, line 28 def folder_totals(path, branch = 'master') get_request("/tree/#{branch}/#{path}") end
get(sha)
click to toggle source
# File lib/codecov_api/api/commits.rb, line 24 def get(sha) get_request("/commit/#{sha}") end
list(from = nil, to = nil)
click to toggle source
# File lib/codecov_api/api/commits.rb, line 11 def list(from = nil, to = nil) uri = '/commits' params = { from: from, to: to }.map do |key, value| if value.instance_of?(Time) "#{key}=#{value.utc.strftime('%F %T')}" elsif !value.nil? raise 'not a valid time' end end.compact uri = "#{uri}/?#{params.join('&')}" unless params.empty? get_request(uri) end
Protected Instance Methods
base_path()
click to toggle source
# File lib/codecov_api/api/commits.rb, line 34 def base_path "/#{@owner}/#{@repo}" end