Class: SupportOps::GitLab::Commits
- Defined in:
- lib/support_ops_gitlab/gitlab/commits.rb
Overview
Document attributes
Stuff at docs.gitlab.com/api/commits/
Defines the class Commits within the module SupportOps::GitLab.
Instance Attribute Summary collapse
-
#actions ⇒ Array
An array of action hashes to commit as a batch; see API documentation on gitlab for more information (create only).
-
#author_email ⇒ String
The current value of author_email.
-
#author_name ⇒ String
The current value of author_name.
-
#authored_date ⇒ String
The current value of authored_date.
-
#commit_message ⇒ String
The current value of commit_message.
-
#committed_date ⇒ String
The current value of committed_date.
-
#committer_email ⇒ String
The current value of committer_email.
-
#committer_name ⇒ String
The current value of committer_name.
-
#created_at ⇒ String
The current value of created_at.
-
#extended_trailers ⇒ Hash
The current value of extended_trailers.
-
#force ⇒ Boolean
The current value of force.
-
#id ⇒ String
The current value of id.
-
#last_pipeline ⇒ Hash
The current value of last_pipeline.
-
#message ⇒ String
The current value of message.
-
#parent_ids ⇒ Array
The current value of parent_ids.
-
#project_id ⇒ Integer
The current value of project_id.
-
#short_id ⇒ String
The current value of short_id.
-
#start_branch ⇒ String
The current value of start_branch.
-
#start_project ⇒ Integer
The current value of start_project.
-
#start_sha ⇒ String
The current value of start_sha.
-
#stats ⇒ Hash
The current value of stats.
-
#status ⇒ String
The current value of status.
-
#title ⇒ String
The current value of title.
-
#trailers ⇒ Boolean
Git trailers for a commit.
-
#web_url ⇒ String
The current value of web_url.
Class Method Summary collapse
-
.list(key: value) ⇒ Array
List repository commits.
Instance Method Summary collapse
-
#save! ⇒ Object
Creates a commit.
Methods inherited from Base
#activate!, #approve!, attributes, #badges, #ban!, #block!, client, #client=, #commits, configure, #contributors, #create_support_pin!, #deactivate!, define_attributes, #delete!, #diffs, #disable_2fa!, #discussions, #emails, #encoded_path, #events, #find, #find!, #gpg_keys, #hard_delete!, #impersonations, #initialize, #issues, #jobs, #latest_pipeline, #members, #memberships, #merge_requests, #move!, #notes, #paid?, #pats, #pipeline_variables, #pipelines, #preferences, #projects, readonly_attributes, #reject!, #revoke!, #rotate!, #ssh_keys, #store_original_attributes, #subscribe!, #support_pin, to_hash, #tokens, #unban!, #unblock!, #unsubscribe!, #webhooks
Constructor Details
This class inherits a constructor from SupportOps::GitLab::Base
Instance Attribute Details
#actions ⇒ Array
An array of action hashes to commit as a batch; see API documentation on gitlab for more information (create only)
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def actions @actions end |
#author_email ⇒ String
Returns the current value of author_email.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def @author_email end |
#author_name ⇒ String
Returns the current value of author_name.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def @author_name end |
#authored_date ⇒ String
Returns the current value of authored_date.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def @authored_date end |
#commit_message ⇒ String
Returns the current value of commit_message.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def @commit_message end |
#committed_date ⇒ String
Returns the current value of committed_date.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def committed_date @committed_date end |
#committer_email ⇒ String
Returns the current value of committer_email.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def committer_email @committer_email end |
#committer_name ⇒ String
Returns the current value of committer_name.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def committer_name @committer_name end |
#created_at ⇒ String
Returns the current value of created_at.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def created_at @created_at end |
#extended_trailers ⇒ Hash
Returns the current value of extended_trailers.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def extended_trailers @extended_trailers end |
#force ⇒ Boolean
Returns the current value of force.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def force @force end |
#id ⇒ String
Returns the current value of id.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def id @id end |
#last_pipeline ⇒ Hash
Returns the current value of last_pipeline.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def last_pipeline @last_pipeline end |
#message ⇒ String
Returns the current value of message.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def @message end |
#parent_ids ⇒ Array
Returns the current value of parent_ids.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def parent_ids @parent_ids end |
#project_id ⇒ Integer
Returns the current value of project_id.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def project_id @project_id end |
#short_id ⇒ String
Returns the current value of short_id.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def short_id @short_id end |
#start_branch ⇒ String
Returns the current value of start_branch.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def start_branch @start_branch end |
#start_project ⇒ Integer
Returns the current value of start_project.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def start_project @start_project end |
#start_sha ⇒ String
Returns the current value of start_sha.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def start_sha @start_sha end |
#stats ⇒ Hash
Returns the current value of stats.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def stats @stats end |
#status ⇒ String
Returns the current value of status.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def status @status end |
#title ⇒ String
Returns the current value of title.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def title @title end |
#trailers ⇒ Boolean
Git trailers for a commit
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def trailers @trailers end |
#web_url ⇒ String
Returns the current value of web_url.
39 40 41 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 39 def web_url @web_url end |
Class Method Details
.list(key: value) ⇒ Array
List repository commits
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 129 def self.list(**args) args[:project_id] = nil unless args[:project_id] raise 'You have to provide a project_id' if args[:project_id].nil? args[:all] = nil unless args[:all] args[:author] = nil unless args[:author] args[:first_parent] = nil unless args[:first_parent] args[:order] = nil unless args[:order] args[:path] = nil unless args[:path] args[:ref_name] = nil unless args[:ref_name] args[:since] = nil unless args[:since] args[:until] = nil unless args[:until] args[:limit] = 0 unless args[:limit] params = 'with_stats=true&trailers=true&' params += "all=#{args[:all]}&" unless args[:all].nil? params += "author=#{args[:author]}&" unless args[:author].nil? params += "first_parent=#{args[:first_parent]}&" unless args[:first_parent].nil? params += "order=#{args[:order]}&" unless args[:order].nil? params += "path=#{args[:path]}&" unless args[:path].nil? params += "ref_name=#{args[:ref_name]}&" unless args[:ref_name].nil? params += "since=#{args[:since]}&" unless args[:since].nil? params += "until=#{args[:until]}&" unless args[:until].nil? array = [] page = 1 loop do response = client.connection.get("projects/#{args[:project_id]}/repository/commits?#{params}&page=#{page}&per_page=100") body = Oj.load(response.body) array += body.map do |c| c['project_id'] = args[:project_id] Commits.new(c) end break if args[:limit].to_i.positive? && array.count >= args[:limit].to_i break if body.count < 100 page += 1 end return array if args[:limit].to_i.zero? array.first(args[:limit].to_i) end |
Instance Method Details
#save! ⇒ Object
This is inherited from Base#save!
Creates a commit
34 |
# File 'lib/support_ops_gitlab/gitlab/commits.rb', line 34 def save!; end |