Module: StashCoreAPI::Commits

Includes:
Utils
Included in:
StashCoreAPI
Defined in:
lib/stash_core_api/commits.rb

Overview

Interfaces with commits endpoints of Stash CoreAPI API

Instance Method Summary collapse

Instance Method Details

#commits(path: nil, since: nil, until_: nil, limit: nil, with_counts: nil) ⇒ Object

Parameters:

  • path (String) (defaults to: nil)

    an optional path to filter commits by

  • since (String) (defaults to: nil)

    the commit ID or ref (exclusively) to retrieve commits after

  • until (String)

    the commit ID (SHA1) or ref (inclusively) to retrieve commits before if until is unspecified, the tip of the repository’s default branch is assumed

  • limit (Integer) (defaults to: nil)

    the maximum number of commits to return Stash defaults to 25

  • withCounts (Boolean)

    optionally include the total number of commits and total number of unique authors

See Also:



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/stash_core_api/commits.rb', line 20

def commits(path: nil, since: nil, until_: nil, limit: nil,
  with_counts: nil)
  endpoint = '/commits'
  if path || since || until_ || limit || with_counts
    endpoint = "#{endpoint}?"
    endpoint = "#{endpoint}path=#{sanitized_path(path)}&" if path
    endpoint = "#{endpoint}since=#{since}&" if since
    endpoint = "#{endpoint}until=#{until_}&" if until_
    endpoint = "#{endpoint}limit=#{limit}&" if limit
    endpoint = "#{endpoint}withCounts=#{with_counts}&" if with_counts
  end
  perform_get(endpoint)
end