Class: LabClient::Commit

Inherits:
Klass show all
Includes:
ClassHelpers
Defined in:
lib/labclient/commits/commit.rb

Overview

Inspect Helper

Instance Attribute Summary

Attributes inherited from Klass

#client

Attributes inherited from LabStruct

#response, #table

Instance Method Summary collapse

Methods included from ClassHelpers

#has?, #keys, #raw

Methods inherited from Klass

#api_methods, #collect_project_id, #collect_release_id, #collect_repository_id, date_time_attrs, #format_time?, #group_name, #help, #initialize, #klass, #quiet?, #success?, #to_json, #update_self, user_attrs, #valid_group_project_levels, #verbose

Methods included from Docs

#demo, #desc, #doc, docs, #example, #group_name, #help, json, #markdown, #navigation, #option, #result, #subtitle, #title

Methods included from CurlHelper

#curl

Methods included from Logger

#logger, logger, logger_setup

Methods inherited from LabStruct

#[], #[]=, #as_json, #client, #initialize, #key?, #keys, #method_missing, #respond_to_missing?, #slice, #success?, #to_h

Constructor Details

This class inherits a constructor from LabClient::Klass

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class LabClient::LabStruct

Instance Method Details

#cherry_pick(branch_name) ⇒ Object



18
19
20
21
22
23
# File 'lib/labclient/commits/commit.rb', line 18

def cherry_pick(branch_name)
  # If from List Project ID isn't stored
  project_id = collect_project_id if project_id.nil?

  client.commits.cherry_pick(project_id, id, branch_name)
end

#comment(query) ⇒ Object



53
54
55
56
57
58
# File 'lib/labclient/commits/commit.rb', line 53

def comment(query)
  # If from List Project ID isn't stored
  project_id = collect_project_id if project_id.nil?

  client.commits.comment_create(project_id, id, query)
end

#commentsObject



46
47
48
49
50
51
# File 'lib/labclient/commits/commit.rb', line 46

def comments
  # If from List Project ID isn't stored
  project_id = collect_project_id if project_id.nil?

  client.commits.comments(project_id, id)
end

#diffObject



32
33
34
35
36
37
# File 'lib/labclient/commits/commit.rb', line 32

def diff
  # If from List Project ID isn't stored
  project_id = collect_project_id if project_id.nil?

  client.commits.diff(project_id, id)
end

#inspectObject



7
8
9
# File 'lib/labclient/commits/commit.rb', line 7

def inspect
  "#<Commit title: #{title}, sha: #{short_id}>"
end

#merge_requestsObject



39
40
41
42
43
44
# File 'lib/labclient/commits/commit.rb', line 39

def merge_requests
  # If from List Project ID isn't stored
  project_id = collect_project_id if project_id.nil?

  client.commits.merge_requests(project_id, id)
end

#projectObject



60
61
62
63
64
65
# File 'lib/labclient/commits/commit.rb', line 60

def project
  # If from List Project ID isn't stored
  project_id = collect_project_id if project_id.nil?

  client.projects.show(project_id)
end

#refs(scope = :all) ⇒ Object



11
12
13
14
15
16
# File 'lib/labclient/commits/commit.rb', line 11

def refs(scope = :all)
  # If from List Project ID isn't stored
  project_id = collect_project_id if project_id.nil?

  client.commits.refs(project_id, id, scope)
end

#revert(branch_name) ⇒ Object



25
26
27
28
29
30
# File 'lib/labclient/commits/commit.rb', line 25

def revert(branch_name)
  # If from List Project ID isn't stored
  project_id = collect_project_id if project_id.nil?

  client.commits.revert(project_id, id, branch_name)
end

#status(query = {}) ⇒ Object



71
72
73
74
75
76
# File 'lib/labclient/commits/commit.rb', line 71

def status(query = {})
  # If from List Project ID isn't stored
  project_id = collect_project_id if project_id.nil?

  client.commits.status(project_id, id, query)
end

#status_update(query = {}) ⇒ Object



78
79
80
81
82
83
# File 'lib/labclient/commits/commit.rb', line 78

def status_update(query = {})
  # If from List Project ID isn't stored
  project_id = collect_project_id if project_id.nil?

  client.commits.status_update(project_id, id, query)
end

#web_urlObject



67
68
69
# File 'lib/labclient/commits/commit.rb', line 67

def web_url
  "#{project.web_url}/-/commit/#{id}"
end