Class: Herokenv::Client
- Inherits:
-
Object
- Object
- Herokenv::Client
- Defined in:
- lib/herokenv/client.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
-
#oauth_token ⇒ Object
Returns the value of attribute oauth_token.
Instance Method Summary collapse
- #heroku ⇒ Object
-
#initialize(oauth_token:, app:) ⇒ Client
constructor
A new instance of Client.
- #populate_env_from_app(only: nil, except: nil) ⇒ Object
Constructor Details
#initialize(oauth_token:, app:) ⇒ Client
Returns a new instance of Client.
7 8 9 10 |
# File 'lib/herokenv/client.rb', line 7 def initialize(oauth_token:, app:) @oauth_token = oauth_token @app = app end |
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
6 7 8 |
# File 'lib/herokenv/client.rb', line 6 def app @app end |
#oauth_token ⇒ Object
Returns the value of attribute oauth_token.
5 6 7 |
# File 'lib/herokenv/client.rb', line 5 def oauth_token @oauth_token end |
Instance Method Details
#heroku ⇒ Object
25 26 27 |
# File 'lib/herokenv/client.rb', line 25 def heroku @heroku ||= PlatformAPI.connect_oauth(oauth_token) end |
#populate_env_from_app(only: nil, except: nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/herokenv/client.rb', line 12 def populate_env_from_app(only: nil, except: nil) configs = heroku.config_var.info_for_app(app) configs.each_pair do |var, value| if except && except.include?(var) next end if only && !only.include?(var) next end ENV[var] = value end end |