Sha256: 591abb46f55b73e708e8120337cbe5fb14df10b103c7e94155d1046677247c76

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

module TwilioContactable
  class << self
    def numerize(numberish)
      numberish.to_s.scan(/\d+/).join
    end

    def internationalize(given_number)
      number = numerize(given_number)
      case number.size
      when 10
        "+1#{number}"
      when 11
        "+#{number}"
      when 12
        number =~ /\+\d(11)/ ? number : nil
      else
        nil
      end
    end

    def confirmation_message(confirmation_code)
      "Code: #{confirmation_code} Enter code on web to verify phone. Msg&data rates may apply. Freq set by u. T&C & support on web site. Txt HELP for help"
    end

    def generate_confirmation_code
      chars = (0..9).to_a + ('A'..'Z').to_a
      (0...6).collect { chars[Kernel.rand(chars.length)] }.join
    end
  end
end

gem 'twiliolib'
require 'twiliolib'

require File.expand_path(File.join(File.dirname(__FILE__), 'configuration'))
require File.expand_path(File.join(File.dirname(__FILE__), 'gateway'))
require File.expand_path(File.join(File.dirname(__FILE__), 'contactable'))
require File.expand_path(File.join(File.dirname(__FILE__), 'controller'))

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
twilio_contactable-0.8.3 lib/twilio_contactable.rb
twilio_contactable-0.8.2 lib/twilio_contactable.rb
twilio_contactable-0.8.1 lib/twilio_contactable.rb
twilio_contactable-0.8.0 lib/twilio_contactable.rb