Class: Travis::Client::Repository::Key

Inherits:
Object
  • Object
show all
Defined in:
lib/travis/client/repository.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, fingerprint) ⇒ Key

Returns a new instance of Key.



10
11
12
13
# File 'lib/travis/client/repository.rb', line 10

def initialize(data, fingerprint)
  @to_s = data
  @fingerprint = fingerprint
end

Instance Attribute Details

#fingerprintObject (readonly)

Returns the value of attribute fingerprint.



8
9
10
# File 'lib/travis/client/repository.rb', line 8

def fingerprint
  @fingerprint
end

#to_sObject (readonly)

Returns the value of attribute to_s.



8
9
10
# File 'lib/travis/client/repository.rb', line 8

def to_s
  @to_s
end

Instance Method Details

#==(other) ⇒ Object



28
29
30
# File 'lib/travis/client/repository.rb', line 28

def ==(other)
  other.to_s == self
end

#encrypt(value) ⇒ Object



15
16
17
18
# File 'lib/travis/client/repository.rb', line 15

def encrypt(value)
  encrypted = to_rsa.public_encrypt(value)
  Base64.encode64(encrypted).gsub(/\s+/, "")
end

#to_rsaObject



20
21
22
# File 'lib/travis/client/repository.rb', line 20

def to_rsa
  Tools::SSLKey.public_rsa_key(to_s)
end

#to_sshObject



24
25
26
# File 'lib/travis/client/repository.rb', line 24

def to_ssh
  Tools::SSLKey.rsa_ssh(to_rsa)
end