module Fog::Core::DeprecatedConnectionAccessors

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

Public Instance Methods

connection() click to toggle source

Returns the Service the collection is part of

@deprecated connection is deprecated due to confusing name, use service instead @return [Fog::Service]

# 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) click to toggle source

Sets the Service but using the wrong name!

@deprecated The connection name was wrong and confusing since it refered to the service @param [Fog::Service] service An instance of a Fog service this collection is for

# 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) click to toggle source

Prepares the value of the service based on the passed attributes

@note Intended for use where the service is required before the normal

initializer runs. The logic is run there with deprecation warnings.

@param [Hash] attributes @return [Fog::Service]

# File lib/fog/core/deprecated_connection_accessors.rb, line 35
def prepare_service_value(attributes)
  @service = attributes[:service] || attributes[:connection]
end