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

#commit_changes(commit_id, limit: nil) ⇒ Object

Parameters:

  • limit (Integer) (defaults to: nil)

    the maximum number of commits to return Stash defaults to 25

See Also:



40
41
42
43
44
# File 'lib/stash_core_api/commits.rb', line 40

def commit_changes(commit_id, limit: nil)
  endpoint = "/commits/#{commit_id}/changes"
  endpoint = "#{endpoint}?limit=#{limit}" if limit
  perform_get(endpoint)
end

#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:



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

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