Class: Dude::Gitlab
Constant Summary
Constants included from Settings
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #estimate_time(duration) ⇒ Object
-
#initialize(options = {}) ⇒ Gitlab
constructor
A new instance of Gitlab.
- #issue_info ⇒ Object
- #issue_title ⇒ Object
- #move_issue ⇒ Object
- #my_issues ⇒ Object
Methods included from Settings
Constructor Details
#initialize(options = {}) ⇒ Gitlab
Returns a new instance of Gitlab.
11 12 13 14 15 16 17 |
# File 'lib/dude/gitlab.rb', line 11 def initialize( = {}) @options = ::Gitlab.configure do |config| config.endpoint = settings['GITLAB_ENDPOINT'] config.private_token = settings['GITLAB_TOKEN'] end end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
9 10 11 |
# File 'lib/dude/gitlab.rb', line 9 def @options end |
Instance Method Details
#estimate_time(duration) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/dude/gitlab.rb', line 28 def estimate_time(duration) test_input_data ::Gitlab.estimate_time_of_issue(project_id, [:issue_id], duration) time = ::Gitlab.issue(project_id, [:issue_id]). to_h['time_stats']['human_time_estimate'] Interface.new.draw_time_estimate(time) end |
#issue_info ⇒ Object
36 37 38 39 40 |
# File 'lib/dude/gitlab.rb', line 36 def issue_info test_input_data issue_info = ::Gitlab.issue(project_id, [:issue_id]).to_h Interface.new.draw_issue_info(issue_info) end |
#issue_title ⇒ Object
19 20 21 22 |
# File 'lib/dude/gitlab.rb', line 19 def issue_title test_input_data ::Gitlab.issue(project_id, [:issue_id]).title end |
#move_issue ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/dude/gitlab.rb', line 42 def move_issue test_input_data labels = ::Gitlab.issue(project_id, [:issue_id]).labels labels = labels.reject {|e| ['To Do', 'Doing', 'To Verify'].include?(e)}. push([:label]).join(',') ::Gitlab.edit_issue(project_id, [:issue_id], { labels: labels }) end |
#my_issues ⇒ Object
24 25 26 |
# File 'lib/dude/gitlab.rb', line 24 def my_issues all_issues_on_project.select {|a| a.last.eql?(user.id) } end |