Module: Pushing::Adapters

Extended by:
ActiveSupport::Autoload
Defined in:
lib/pushing/adapters.rb,
lib/pushing/adapters/test_adapter.rb,
lib/pushing/adapters/apn/apnotic_adapter.rb,
lib/pushing/adapters/apn/houston_adapter.rb,
lib/pushing/adapters/apn/lowdown_adapter.rb,
lib/pushing/adapters/fcm/andpush_adapter.rb,
lib/pushing/adapters/fcm/fcm_gem_adapter.rb

Defined Under Namespace

Classes: AndpushAdapter, ApnoticAdapter, FcmGemAdapter, HoustonAdapter, LowdownAdapter, TestAdapter

Class Method Summary collapse

Class Method Details

.instance(configuration) ⇒ Object

Provides an adapter instance specified in the configuration. If the adapter is not found in ADAPTER_INSTANCES, it’ll look up the adapter class and create a new instance using the configuration.



36
37
38
39
40
# File 'lib/pushing/adapters.rb', line 36

def instance(configuration)
  ADAPTER_INSTANCES[configuration.adapter] || MUTEX.synchronize do
    ADAPTER_INSTANCES[configuration.adapter] ||= lookup(configuration.adapter).new(configuration)
  end
end

.lookup(name) ⇒ Object

Returns the constant for the specified adapter name.

Pushing::Adapters.lookup(:apnotic)
# => Pushing::Adapters::ApnoticAdapter


28
29
30
# File 'lib/pushing/adapters.rb', line 28

def lookup(name)
  const_get("#{name.to_s.camelize}Adapter")
end