Class: Alvid::Github
- Inherits:
-
Object
- Object
- Alvid::Github
- Defined in:
- lib/alvid/github.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #create_repository(repo_name, organization) ⇒ Object
-
#initialize(api_endpoint, access_token) ⇒ Github
constructor
A new instance of Github.
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
#client ⇒ Object (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 |