Class: Travis::Client::Repository::Key
- Inherits:
-
Object
- Object
- Travis::Client::Repository::Key
- Defined in:
- lib/travis/client/repository.rb
Instance Attribute Summary collapse
-
#fingerprint ⇒ Object
readonly
Returns the value of attribute fingerprint.
-
#to_s ⇒ Object
readonly
Returns the value of attribute to_s.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #encrypt(value) ⇒ Object
-
#initialize(data, fingerprint) ⇒ Key
constructor
A new instance of Key.
- #to_rsa ⇒ Object
- #to_ssh ⇒ Object
Constructor Details
#initialize(data, fingerprint) ⇒ Key
Returns a new instance of Key.
12 13 14 15 |
# File 'lib/travis/client/repository.rb', line 12 def initialize(data, fingerprint) @to_s = data @fingerprint = fingerprint end |
Instance Attribute Details
#fingerprint ⇒ Object (readonly)
Returns the value of attribute fingerprint.
10 11 12 |
# File 'lib/travis/client/repository.rb', line 10 def fingerprint @fingerprint end |
#to_s ⇒ Object (readonly)
Returns the value of attribute to_s.
10 11 12 |
# File 'lib/travis/client/repository.rb', line 10 def to_s @to_s end |
Instance Method Details
#==(other) ⇒ Object
30 31 32 |
# File 'lib/travis/client/repository.rb', line 30 def ==(other) other.to_s == self end |
#encrypt(value) ⇒ Object
17 18 19 20 |
# File 'lib/travis/client/repository.rb', line 17 def encrypt(value) encrypted = to_rsa.public_encrypt(value) Base64.encode64(encrypted).gsub(/\s+/, '') end |
#to_rsa ⇒ Object
22 23 24 |
# File 'lib/travis/client/repository.rb', line 22 def to_rsa Tools::SSLKey.public_rsa_key(to_s) end |