Class: Sitefull::Cloud::Provider
- Inherits:
-
Object
- Object
- Sitefull::Cloud::Provider
- Includes:
- Mock
- Defined in:
- lib/sitefull-cloud/provider.rb
Constant Summary collapse
- PROVIDERS =
%w(amazon azure google)
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #auth ⇒ Object
-
#initialize(type, options = {}) ⇒ Provider
constructor
A new instance of Provider.
Methods included from Mock
Constructor Details
#initialize(type, options = {}) ⇒ Provider
Returns a new instance of Provider.
11 12 13 14 15 |
# File 'lib/sitefull-cloud/provider.rb', line 11 def initialize(type, = {}) @type = type || 'base' extend(provider_module) = respond_to?(:process) ? process() : end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/sitefull-cloud/provider.rb', line 9 def end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/sitefull-cloud/provider.rb', line 9 def type @type end |
Class Method Details
.all_required_options ⇒ Object
18 19 20 |
# File 'lib/sitefull-cloud/provider.rb', line 18 def PROVIDERS.map { |type| (type) }.flatten end |
.provider_class(type) ⇒ Object
26 27 28 29 |
# File 'lib/sitefull-cloud/provider.rb', line 26 def provider_class(type) require "sitefull-cloud/provider/#{type}" Kernel.const_get "Sitefull::Provider::#{type.capitalize}" end |
.required_options_for(type) ⇒ Object
22 23 24 |
# File 'lib/sitefull-cloud/provider.rb', line 22 def (type) provider_class(type).const_get(:REQUIRED_OPTIONS) end |
Instance Method Details
#auth ⇒ Object
32 33 34 |
# File 'lib/sitefull-cloud/provider.rb', line 32 def auth @auth ||= Sitefull::Cloud::Auth.new(type, ) end |