Sha256: cca7f72a6bf442b49537280ed4516b381fe46133d23e7763a771a138c5cda3f4

Contents?: true

Size: 995 Bytes

Versions: 21

Compression:

Stored size: 995 Bytes

Contents

module ActionSmser::DeliveryMethods

  # Default delivery method for test environments.
  # Saves delivered sms to ActionSmser::DeliveryMethods::TestArray.deliveries to help test your own software
  # Normal array, see sms by 'ActionSmser::DeliveryMethods::TestArray.deliveries' and
  # clear it between tests by 'ActionSmser::DeliveryMethods::TestArray.deliveries.clear'
  class TestArray
    @@deliveries = []
    def self.deliveries
      @@deliveries
    end

    def self.deliver(sms)
      ActionSmser::Logger.info "ActionSmser::DeliveryMethods::TestArray.deliveries added message, no real delivery."
      self.deliveries << sms

      if sms.delivery_options[:save_delivery_reports]
        delivery_reports = []
        sms.to_numbers_array.each do |to|
          delivery_reports << ActionSmser::DeliveryReport.create_from_sms(sms, to, "test_array_id_#{rand(99999999)}")
        end
        delivery_reports
      else
        return sms.to_numbers_array
      end

    end

  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
action_smser-3.4.1 lib/action_smser/delivery_methods/test_array.rb
action_smser-3.4.0 lib/action_smser/delivery_methods/test_array.rb
action_smser-3.3.0 lib/action_smser/delivery_methods/test_array.rb
action_smser-3.2.0 lib/action_smser/delivery_methods/test_array.rb
action_smser-3.1.2 lib/action_smser/delivery_methods/test_array.rb
action_smser-3.1.1 lib/action_smser/delivery_methods/test_array.rb
action_smser-3.1.0 lib/action_smser/delivery_methods/test_array.rb
action_smser-3.0.0 lib/action_smser/delivery_methods/test_array.rb
action_smser-2.2.0 lib/action_smser/delivery_methods/test_array.rb
action_smser-2.1.2 lib/action_smser/delivery_methods/test_array.rb
action_smser-2.1.1 lib/action_smser/delivery_methods/test_array.rb
action_smser-2.1.0 lib/action_smser/delivery_methods/test_array.rb
action_smser-2.0.2 lib/action_smser/delivery_methods/test_array.rb
action_smser-2.0.1 lib/action_smser/delivery_methods/test_array.rb
action_smser-2.0.0 lib/action_smser/delivery_methods/test_array.rb
action_smser-1.2.1 lib/action_smser/delivery_methods/test_array.rb
action_smser-1.2.0 lib/action_smser/delivery_methods/test_array.rb
action_smser-1.1.1 lib/action_smser/delivery_methods/test_array.rb
action_smser-1.1.0 lib/action_smser/delivery_methods/test_array.rb
action_smser-1.0.1 lib/action_smser/delivery_methods/test_array.rb