Last active
August 29, 2015 14:01
-
-
Save roktas/50af220017b3f191b16f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
description: ok | |
--- | |
# head | |
- foo | |
- bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# encoding: utf-8 | |
# Kurulum | |
# | |
# $ sudo apt-get install ruby-octokit | |
# $ https://github.com/settings/tokens/new ile org izinli token oluştur | |
# Sertifika hatası alırsanız şu şekilde çalıştırın | |
# | |
# $ wget https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt -O ~/.cacert.pem | |
# $ SSL_CERT_FILE=~/.cacert.pem ./org | |
require 'octokit' | |
class Org | |
TOKEN_FILE = File.join ENV['HOME'], '.github_token' | |
@client = Octokit::Client.new access_token: IO.read(TOKEN_FILE) | |
@client.user.login | |
class << self | |
attr_reader :client | |
end | |
attr_reader :org | |
def initialize(org) | |
@org = org | |
end | |
def client | |
self.class.client | |
end | |
def team_members(team_name) | |
team = client.org_teams(org).find { |t| t[:name] == team_name } | |
client.team_members(team[:id]).map(&:login) | |
rescue | |
$stderr.puts 'oops' | |
end | |
end | |
org = Org.new '19' | |
puts org.team_members 'admin' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment