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.
13 14 15 16 |
# File 'lib/paratrooper/local_api_key_extractor.rb', line 13 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.
7 8 9 |
# File 'lib/paratrooper/local_api_key_extractor.rb', line 7 def file_path @file_path end |
#netrc_klass ⇒ Object (readonly)
Returns the value of attribute netrc_klass.
7 8 9 |
# File 'lib/paratrooper/local_api_key_extractor.rb', line 7 def netrc_klass @netrc_klass end |
Class Method Details
.get_credentials ⇒ Object
9 10 11 |
# File 'lib/paratrooper/local_api_key_extractor.rb', line 9 def self.get_credentials new.read_credentials end |
Instance Method Details
#read_credentials ⇒ Object
18 19 20 |
# File 'lib/paratrooper/local_api_key_extractor.rb', line 18 def read_credentials ENV['HEROKU_API_KEY'] || read_credentials_for('api.heroku.com') end |