Class: Geet::Github::Issue

Inherits:
AbstractIssue show all
Defined in:
lib/geet/github/issue.rb

Instance Attribute Summary

Attributes inherited from AbstractIssue

#link, #number, #title

Class Method Summary collapse

Methods inherited from AbstractIssue

#add_labels, #assign_users, #edit, #initialize

Constructor Details

This class inherits a constructor from Geet::Github::AbstractIssue

Class Method Details

.create(title, description, api_interface) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/geet/github/issue.rb', line 9

def self.create(title, description, api_interface)
  api_path = 'issues'
  request_data = { title: title, body: description, base: 'master' }

  response = api_interface.send_request(api_path, data: request_data)

  issue_number, title, link = response.fetch_values('number', 'title', 'html_url')

  new(issue_number, api_interface, title, link)
end

.list(api_interface) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/geet/github/issue.rb', line 22

def self.list(api_interface)
  api_path = 'issues'

  response = api_interface.send_request(api_path, multipage: true)

  response.each_with_object([]) do |issue_data, result|
    if !issue_data.key?('pull_request')
      number = issue_data.fetch('number')
      title = issue_data.fetch('title')
      link = issue_data.fetch('html_url')

      result << new(number, api_interface, title, link)
    end
  end
end