Module: Octokit::Client::Traffic

Included in:
Octokit::Client
Defined in:
lib/octokit/client/traffic.rb

Overview

Methods for the Traffic API

Instance Method Summary collapse

Instance Method Details

#clones(repo, options = {}) ⇒ Sawyer::Resource

Get the total number of clones and breakdown per day or week for the last 14 days

Examples:

Clones per day

@client.clones('octokit/octokit.rb')

Clones per week

@client.clones('octokit/octokit.rb', per: 'week')

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub Repository

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :per (String) — default: 'day'

    Views per. day or week

Returns:

  • (Sawyer::Resource)

    Breakdown of clone stats

See Also:



59
60
61
# File 'lib/octokit/client/traffic.rb', line 59

def clones(repo, options = {})
  get "#{Repository.path repo}/traffic/clones", options
end

#top_paths(repo, options = {}) ⇒ Array<Sawyer::Resource>

Get the top 10 popular contents over the last 14 days

Examples:

@client.top_paths('octokit/octokit.rb')

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

Returns:

  • (Array<Sawyer::Resource>)

    List of popular contents

See Also:



27
28
29
# File 'lib/octokit/client/traffic.rb', line 27

def top_paths(repo, options = {})
  get "#{Repository.path repo}/traffic/popular/paths", options
end

#top_referrers(repo, options = {}) ⇒ Array<Sawyer::Resource>

Get the top 10 referrers over the last 14 days

Examples:

@client.top_referrers('octokit/octokit.rb')

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

Returns:

  • (Array<Sawyer::Resource>)

    List of referrers and stats

See Also:



16
17
18
# File 'lib/octokit/client/traffic.rb', line 16

def top_referrers(repo, options = {})
  get "#{Repository.path repo}/traffic/popular/referrers", options
end

#views(repo, options = {}) ⇒ Sawyer::Resource

Get the total number of views and breakdown per day or week for the last 14 days

Examples:

Views per day

@client.views('octokit/octokit.rb')

Views per week

@client.views('octokit/octokit.rb', per: 'week')

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub Repository

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :per (String) — default: 'day'

    Views per. day or week

Returns:

  • (Sawyer::Resource)

    Breakdown of view stats

See Also:



43
44
45
# File 'lib/octokit/client/traffic.rb', line 43

def views(repo, options = {})
  get "#{Repository.path repo}/traffic/views", options
end