Class: UsersKeys

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(github) ⇒ UsersKeys

Returns a new instance of UsersKeys.



4
5
6
# File 'lib/github/users/users_keys.rb', line 4

def initialize(github)
  @github = github
end

Instance Attribute Details

#githubObject

Returns the value of attribute github.



2
3
4
# File 'lib/github/users/users_keys.rb', line 2

def github
  @github
end

Instance Method Details

#createPublicKey(title, key) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/github/users/users_keys.rb', line 16

def createPublicKey(title, key)
  params = {
      :title => title,
      :key => key
  }
  data = params.to_json
  @github.post('user/keys', data)
end

#deletePublicKey(id) ⇒ Object



34
35
36
# File 'lib/github/users/users_keys.rb', line 34

def deletePublicKey(id)
  @github.delete('user/keys/%s' % id)
end

#getPublicKey(id) ⇒ Object



12
13
14
# File 'lib/github/users/users_keys.rb', line 12

def getPublicKey(id)
  @github.get('user/keys/%s' % id)
end

#listPublicKeysObject



8
9
10
# File 'lib/github/users/users_keys.rb', line 8

def listPublicKeys()
  @github.get('user/keys')
end

#updatePublicKey(id, title, key) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/github/users/users_keys.rb', line 25

def updatePublicKey(id, title, key)
  params = {
      :title => title,
      :key => key
  }
  data = params.to_json
  @github.patch('user/keys/%s' % id, data)
end