Sha256: edc452669991738b5d338dd15c0f42de2b80e00cc7efe23fc7ba8fa2e7beb116

Contents?: true

Size: 716 Bytes

Versions: 27

Compression:

Stored size: 716 Bytes

Contents

module Agilibox::SMS
  class << self
    def strategy=(value)
      @strategy = parse_strategy(value)
    end

    def strategy
      @strategy ||= default_strategy
    end

    attr_writer :default_from

    def default_from
      @default_from ||= Rails.application.class.to_s.chomp("::Application")
    end

    def parse_strategy(value)
      if value.is_a?(Symbol)
        "Agilibox::SMS::Strategies::#{value.to_s.camelcase}".constantize
      else
        value
      end
    end

    private

    def default_strategy
      if Rails.env.development? || Rails.env.test?
        Agilibox::SMS::Strategies::Test
      else
        Agilibox::SMS::Strategies::AmazonSNS
      end
    end
  end # class << self
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
agilibox-2.0.0 app/sms/agilibox/sms.rb
agilibox-1.11.0 app/sms/agilibox/sms.rb
agilibox-1.10.5 app/sms/agilibox/sms.rb
agilibox-1.10.2 app/sms/agilibox/sms.rb
agilibox-1.10.1 app/sms/agilibox/sms.rb
agilibox-1.10.0 app/sms/agilibox/sms.rb
agilibox-1.9.20 app/sms/agilibox/sms.rb
agilibox-1.9.19 app/sms/agilibox/sms.rb
agilibox-1.9.18 app/sms/agilibox/sms.rb
agilibox-1.9.17 app/sms/agilibox/sms.rb
agilibox-1.9.16 app/sms/agilibox/sms.rb
agilibox-1.9.15 app/sms/agilibox/sms.rb
agilibox-1.9.14 app/sms/agilibox/sms.rb
agilibox-1.9.13 app/sms/agilibox/sms.rb
agilibox-1.9.12 app/sms/agilibox/sms.rb
agilibox-1.9.11 app/sms/agilibox/sms.rb
agilibox-1.9.10 app/sms/agilibox/sms.rb
agilibox-1.9.9 app/sms/agilibox/sms.rb
agilibox-1.9.8 app/sms/agilibox/sms.rb
agilibox-1.9.7 app/sms/agilibox/sms.rb