module Octokit::Client::Traffic
Methods for the Traffic
API
Public Instance Methods
Get the total number of clones and breakdown per day or week for the last 14 days
@param repo [Integer, String, Repository
, Hash] A GitHub Repository
@option options [String] :per ('day') Views per. day
or
<tt>week</tt>
@return [Sawyer::Resource] Breakdown of clone stats @see developer.github.com/v3/repos/traffic/#clones @example Clones per day
@client.clones('octokit/octokit.rb')
@example Clones per week
@client.clones('octokit/octokit.rb', per: 'week')
# File lib/octokit/client/traffic.rb, line 62 def clones(repo, options = {}) opts = ensure_api_media_type(:traffic, options) get "#{Repository.path repo}/traffic/clones", opts end
Get the top 10 popular contents over the last 14 days
@param repo [Integer, String, Repository
, Hash] A GitHub repository @return [Array<Sawyer::Resource>] List of popular contents @see developer.github.com/v3/repos/traffic/#list-paths @example
@client.top_paths('octokit/octokit.rb')
# File lib/octokit/client/traffic.rb, line 28 def top_paths(repo, options = {}) opts = ensure_api_media_type(:traffic, options) get "#{Repository.path repo}/traffic/popular/paths", opts end
Get the top 10 referrers over the last 14 days
@param repo [Integer, String, Repository
, Hash] A GitHub repository @return [Array<Sawyer::Resource>] List of referrers and stats @see developer.github.com/v3/repos/traffic/#list-referrers @example
@client.top_referrers('octokit/octokit.rb')
# File lib/octokit/client/traffic.rb, line 16 def top_referrers(repo, options = {}) opts = ensure_api_media_type(:traffic, options) get "#{Repository.path repo}/traffic/popular/referrers", opts end
Get the total number of views and breakdown per day or week for the last 14 days
@param repo [Integer, String, Repository
, Hash] A GitHub Repository
@option options [String] :per ('day') Views per. day
or
<tt>week</tt>
@return [Sawyer::Resource] Breakdown of view stats @see developer.github.com/v3/repos/traffic/#views @example Views per day
@client.views('octokit/octokit.rb')
@example Views per week
@client.views('octokit/octokit.rb', per: 'week')
# File lib/octokit/client/traffic.rb, line 45 def views(repo, options = {}) opts = ensure_api_media_type(:traffic, options) get "#{Repository.path repo}/traffic/views", opts end