Class: Kurgan::GitHub

Inherits:
Object
  • Object
show all
Defined in:
lib/kurgan/github.rb

Constant Summary collapse

GITHUB_URL =
"https://api.github.com"
GITHUB_ORG =
"theonestack"

Class Method Summary collapse

Class Method Details

.get_releases(component) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/kurgan/github.rb', line 22

def self.get_releases(component)
  url = "#{GITHUB_URL}/repos/#{GITHUB_ORG}/hl-component-#{component}/releases"
  response = Faraday.get(url, {}, {'Accept' => 'Accept: application/vnd.github.v3+json'})
  
  if response.status != 200
    return nil
  end
  
  return JSON.parse(response.body, symbolize_names: true)
end

.get_reposObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/kurgan/github.rb', line 10

def self.get_repos
  url = "#{GITHUB_URL}/orgs/#{GITHUB_ORG}/repos"
  response = Faraday.get(url, {type: 'public', per_page: 100}, {'Accept' => 'Accept: application/vnd.github.v3+json'})

  if response.status != 200
    return nil
  end
  
  repos = JSON.parse(response.body, symbolize_names: true)
  return repos.select {|repo| repo[:name].start_with?('hl-component')}
end