Class: SupportOps::GitLab::RepositoryFiles
- Defined in:
- lib/support_ops_gitlab/gitlab/repository_files.rb
Overview
Document attribute meaning
Stuff at docs.gitlab.com/api/repository_files/
Defines the class RepositoryFiles within the module SupportOps::GitLab.
Instance Attribute Summary collapse
-
#blob_id ⇒ String
The current value of blob_id.
-
#commit_id ⇒ String
The current value of commit_id.
-
#content ⇒ String
The current value of content.
-
#content_sha256 ⇒ String
The current value of content_sha256.
-
#encoding ⇒ String
The current value of encoding.
-
#execute_filemode ⇒ Boolean
The current value of execute_filemode.
-
#file_name ⇒ String
The current value of file_name.
-
#file_path ⇒ String
The current value of file_path.
-
#last_commit_id ⇒ String
The current value of last_commit_id.
-
#ref ⇒ String
The current value of ref.
-
#size ⇒ Integer
The current value of size.
Class Method Summary collapse
-
.get(project_id, path, ref = 'HEAD') ⇒ Object
Get file from repository.
-
.get_raw(project_id, path, ref = 'HEAD', lfs = false) ⇒ Object
Get raw file from repository.
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!, #save!, #ssh_keys, #status, #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
#blob_id ⇒ String
Returns the current value of blob_id.
25 26 27 |
# File 'lib/support_ops_gitlab/gitlab/repository_files.rb', line 25 def blob_id @blob_id end |
#commit_id ⇒ String
Returns the current value of commit_id.
25 26 27 |
# File 'lib/support_ops_gitlab/gitlab/repository_files.rb', line 25 def commit_id @commit_id end |
#content ⇒ String
Returns the current value of content.
25 26 27 |
# File 'lib/support_ops_gitlab/gitlab/repository_files.rb', line 25 def content @content end |
#content_sha256 ⇒ String
Returns the current value of content_sha256.
25 26 27 |
# File 'lib/support_ops_gitlab/gitlab/repository_files.rb', line 25 def content_sha256 @content_sha256 end |
#encoding ⇒ String
Returns the current value of encoding.
25 26 27 |
# File 'lib/support_ops_gitlab/gitlab/repository_files.rb', line 25 def encoding @encoding end |
#execute_filemode ⇒ Boolean
Returns the current value of execute_filemode.
25 26 27 |
# File 'lib/support_ops_gitlab/gitlab/repository_files.rb', line 25 def execute_filemode @execute_filemode end |
#file_name ⇒ String
Returns the current value of file_name.
25 26 27 |
# File 'lib/support_ops_gitlab/gitlab/repository_files.rb', line 25 def file_name @file_name end |
#file_path ⇒ String
Returns the current value of file_path.
25 26 27 |
# File 'lib/support_ops_gitlab/gitlab/repository_files.rb', line 25 def file_path @file_path end |
#last_commit_id ⇒ String
Returns the current value of last_commit_id.
25 26 27 |
# File 'lib/support_ops_gitlab/gitlab/repository_files.rb', line 25 def last_commit_id @last_commit_id end |
#ref ⇒ String
Returns the current value of ref.
25 26 27 |
# File 'lib/support_ops_gitlab/gitlab/repository_files.rb', line 25 def ref @ref end |
#size ⇒ Integer
Returns the current value of size.
25 26 27 |
# File 'lib/support_ops_gitlab/gitlab/repository_files.rb', line 25 def size @size end |
Class Method Details
.get(project_id, path, ref = 'HEAD') ⇒ Object
Get file from repository
59 60 61 62 63 64 65 |
# File 'lib/support_ops_gitlab/gitlab/repository_files.rb', line 59 def self.get(project_id, path, ref = 'HEAD') response = client.connection.get("projects/#{project_id}/repository/files/#{ERB::Util.url_encode(path)}?ref=#{ref}") body = Oj.load(response.body) return nil unless response.status == 200 RepositoryFiles.new(body) end |
.get_raw(project_id, path, ref = 'HEAD', lfs = false) ⇒ Object
Get raw file from repository
92 93 94 95 96 97 |
# File 'lib/support_ops_gitlab/gitlab/repository_files.rb', line 92 def self.get_raw(project_id, path, ref = 'HEAD', lfs = false) response = client.connection.get("projects/#{project_id}/repository/files/#{ERB::Util.url_encode(path)}/raw?ref=#{ref}") return nil unless response.status == 200 response.body end |