Module: Fog::Core::DeprecatedConnectionAccessors

Included in:
Fog::Collection, Model
Defined in:
lib/fog/core/deprecated_connection_accessors.rb

Overview

This module covers the shared code used by models and collections that deprecates the confusing usage of ‘connection’ which was actually intended to be an instance of Fog::Service

Instance Method Summary collapse

Instance Method Details

#connectionFog::Service

Deprecated.

#connection is deprecated due to confusing name, use #service instead

Returns the Service the collection is part of



22
23
24
25
# File 'lib/fog/core/deprecated_connection_accessors.rb', line 22

def connection
  Fog::Logger.deprecation("#connection is deprecated, use #service instead [light_black](#{caller.first})[/]")
  @service
end

#connection=(service) ⇒ Object

Deprecated.

The connection name was wrong and confusing since it refered to the service

Sets the Service but using the wrong name!



12
13
14
15
# File 'lib/fog/core/deprecated_connection_accessors.rb', line 12

def connection=(service)
  Fog::Logger.deprecation("#connection= is deprecated, pass :service in at creation [light_black](#{caller.first})[/]")
  @service = service
end

#prepare_service_value(attributes) ⇒ Fog::Service

Note:

Intended for use where the service is required before the normal initializer runs. The logic is run there with deprecation warnings.

Prepares the value of the service based on the passed attributes



35
36
37
# File 'lib/fog/core/deprecated_connection_accessors.rb', line 35

def prepare_service_value(attributes)
  @service = attributes[:service] || attributes[:connection]
end