Class: Alvid::Github

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_endpoint, access_token) ⇒ Github

Returns a new instance of Github.



7
8
9
10
11
12
13
# File 'lib/alvid/github.rb', line 7

def initialize(api_endpoint, access_token)
  Octokit.configure do |c|
      c.api_endpoint = api_endpoint
  end

  @client = Octokit::Client.new(access_token: access_token)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/alvid/github.rb', line 5

def client
  @client
end

Instance Method Details

#create_repository(repo_name, organization) ⇒ Object



16
17
18
19
20
21
# File 'lib/alvid/github.rb', line 16

def create_repository(repo_name, organization)
  @client.create_repository(repo_name, {:organization=>organization})
  keypair = Alvid::Keypair.new
  @client.add_deploy_key( "#{organization}/#{repo_name}" , "#{repo_name}-dk", keypair.pub)
  keypair.pri
end