Sha256: 73a99d27238fcf5f711b614d76d6bae3246ef47d1765f9aa807a58bb497ca27b

Contents?: true

Size: 661 Bytes

Versions: 7

Compression:

Stored size: 661 Bytes

Contents

module Smess
  class Auto < Output

    attr_accessor :output_name

    def validate_config
    end

    def deliver
      out = output_for sms.to
      out.deliver.merge({sent_with: output_name})
    end

    def get_output_name_for_msisdn(msisdn)
      3.downto(0).each do |index|
        return Smess.config.output_by_country_code[msisdn[0..index]] if Smess.config.output_by_country_code.key? msisdn[0..index]
      end
      Smess.config.default_output
    end

    def output_for(msisdn)
      @output_name = get_output_name_for_msisdn(msisdn)
      output = Smess.named_output_instance( output_name )
      output.sms = sms
      output
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
smess-2.0.8 lib/smess/outputs/auto.rb
smess-2.0.7 lib/smess/outputs/auto.rb
smess-2.0.6 lib/smess/outputs/auto.rb
smess-2.0.5 lib/smess/outputs/auto.rb
smess-2.0.4 lib/smess/outputs/auto.rb
smess-2.0.3 lib/smess/outputs/auto.rb
smess-2.0.2 lib/smess/outputs/auto.rb