Class: Paratrooper::LocalApiKeyExtractor
- Inherits:
-
Object
- Object
- Paratrooper::LocalApiKeyExtractor
- Defined in:
- lib/paratrooper/local_api_key_extractor.rb
Defined Under Namespace
Classes: NetrcFileDoesNotExist
Instance Attribute Summary collapse
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#netrc_klass ⇒ Object
readonly
Returns the value of attribute netrc_klass.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ LocalApiKeyExtractor
constructor
A new instance of LocalApiKeyExtractor.
- #read_credentials ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ LocalApiKeyExtractor
Returns a new instance of LocalApiKeyExtractor.
14 15 16 17 |
# File 'lib/paratrooper/local_api_key_extractor.rb', line 14 def initialize( = {}) @netrc_klass = [:netrc_klass] || Netrc @file_path = [:file_path] || netrc_klass.default_path end |
Instance Attribute Details
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
8 9 10 |
# File 'lib/paratrooper/local_api_key_extractor.rb', line 8 def file_path @file_path end |
#netrc_klass ⇒ Object (readonly)
Returns the value of attribute netrc_klass.
8 9 10 |
# File 'lib/paratrooper/local_api_key_extractor.rb', line 8 def netrc_klass @netrc_klass end |
Class Method Details
.get_credentials ⇒ Object
10 11 12 |
# File 'lib/paratrooper/local_api_key_extractor.rb', line 10 def self.get_credentials new.read_credentials end |
Instance Method Details
#read_credentials ⇒ Object
19 20 21 |
# File 'lib/paratrooper/local_api_key_extractor.rb', line 19 def read_credentials ENV['HEROKU_API_KEY'] || read_credentials_for('api.heroku.com') end |