Class: Bookbinder::Config::CfCredentials
- Inherits:
-
Object
- Object
- Bookbinder::Config::CfCredentials
- Defined in:
- lib/bookbinder/config/cf_credentials.rb
Constant Summary collapse
- REQUIRED_KEYS =
%w(username password api_endpoint organization app_name)
- CredentialKeyError =
Class.new(RuntimeError)
Instance Method Summary collapse
- #==(other) ⇒ Object
- #flat_routes ⇒ Object
-
#initialize(cf_cred_hash, environment) ⇒ CfCredentials
constructor
A new instance of CfCredentials.
- #routes ⇒ Object
- #space ⇒ Object
Constructor Details
#initialize(cf_cred_hash, environment) ⇒ CfCredentials
Returns a new instance of CfCredentials.
7 8 9 10 |
# File 'lib/bookbinder/config/cf_credentials.rb', line 7 def initialize(cf_cred_hash, environment) @creds = cf_cred_hash @environment = environment end |
Instance Method Details
#==(other) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/bookbinder/config/cf_credentials.rb', line 18 def ==(other) [@creds, @environment] == [ other.instance_variable_get(:@creds), other.instance_variable_get(:@environment) ] end |
#flat_routes ⇒ Object
29 30 31 |
# File 'lib/bookbinder/config/cf_credentials.rb', line 29 def flat_routes routes.flat_map { |(domain, apps)| apps.map { |app| [domain, app] } } end |
#routes ⇒ Object
25 26 27 |
# File 'lib/bookbinder/config/cf_credentials.rb', line 25 def routes fetch('host') if correctly_formatted_domain_and_routes? end |
#space ⇒ Object
33 34 35 |
# File 'lib/bookbinder/config/cf_credentials.rb', line 33 def space fetch('space') end |