Class: Bookbinder::Configuration::CfCredentials
- Inherits:
-
Object
- Object
- Bookbinder::Configuration::CfCredentials
- Defined in:
- lib/bookbinder/configuration.rb
Constant Summary collapse
- REQUIRED_KEYS =
%w(api_endpoint organization app_name).freeze
- OPTIONAL_KEYS =
%w(username password production_space production_host staging_space staging_host).freeze
Instance Method Summary collapse
- #flat_routes ⇒ Object
-
#initialize(cred_hash, is_production) ⇒ CfCredentials
constructor
A new instance of CfCredentials.
- #routes ⇒ Object
- #space ⇒ Object
Constructor Details
#initialize(cred_hash, is_production) ⇒ CfCredentials
Returns a new instance of CfCredentials.
42 43 44 45 |
# File 'lib/bookbinder/configuration.rb', line 42 def initialize(cred_hash, is_production) @creds = cred_hash @is_production = is_production end |
Instance Method Details
#flat_routes ⇒ Object
64 65 66 67 68 69 |
# File 'lib/bookbinder/configuration.rb', line 64 def flat_routes routes.reduce([]) do |all_routes, domain_apps| domain, apps = domain_apps all_routes + apps.map { |app| [domain, app] } end end |
#routes ⇒ Object
59 60 61 62 |
# File 'lib/bookbinder/configuration.rb', line 59 def routes key = is_production ? 'production_host' : 'staging_host' fetch(key) if correctly_formatted_domain_and_routes?(key) end |
#space ⇒ Object
71 72 73 74 |
# File 'lib/bookbinder/configuration.rb', line 71 def space key = is_production ? 'production_space' : 'staging_space' fetch(key) end |