Class: Backends::Dummy::Base

Inherits:
Object
  • Object
show all
Includes:
Helpers::ExtensionsHelper, Helpers::JsonCollectionHelper
Defined in:
lib/backends/dummy/base.rb

Direct Known Subclasses

Compute, Network, Storage

Constant Summary collapse

API_VERSION =
'1.0.0'
FIXTURES =
[:compute, :network, :storage].freeze
FIXTURES_TPL =
[:os_tpl, :resource_tpl].freeze

Instance Method Summary collapse

Methods included from Helpers::ExtensionsHelper

#read_extensions

Methods included from Helpers::JsonCollectionHelper

#read_from_json

Constructor Details

#initialize(delegated_user, options, server_properties, logger, dalli_cache) ⇒ Base

Returns a new instance of Base


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/backends/dummy/base.rb', line 11

def initialize(delegated_user, options, server_properties, logger, dalli_cache)
  @delegated_user = Hashie::Mash.new(delegated_user)
  @options = Hashie::Mash.new(options)
  @server_properties = Hashie::Mash.new(server_properties)
  @logger = logger || Rails.logger
  @dalli_cache = dalli_cache
  @other_backends = {}

  path = @options.fixtures_dir || ''
  read_fixtures(path)
end

Instance Method Details

#add_other_backend(backend_type, backend_instance) ⇒ Object


23
24
25
26
# File 'lib/backends/dummy/base.rb', line 23

def add_other_backend(backend_type, backend_instance)
  fail 'Type and instance must be provided!' unless backend_type && backend_instance
  @other_backends[backend_type] = backend_instance
end