Sha256: 39dcb38d05eacb6ae3823e5df84c919a00e97c3126fb64e8a503863c33d85db7

Contents?: true

Size: 1.84 KB

Versions: 9

Compression:

Stored size: 1.84 KB

Contents

# based on information from http://en.wikipedia.org/wiki/Telephone_numbers_in_Singapore
module  Faker
  module PhoneNumberSG
    extend ModuleUtils
    extend self

	# Number Ranges
	# 3xxx xxxx - Voice Over IP services
	# 6xxx xxxx - Fixed Line services inclusive of Fixed Line Voice Over IP services
	#                        like StarHub Digital Voice and SingTel mio Voice
	# 8xxx xxxx - Mobile phone services
	# 9xxx xxxx - Mobile phone services Includes Paging Services like SUNPAGE
	# 800 xxx xxxx - Toll-Free International services
	# 1800 xxx xxxx - Toll-Free line services
	# 1900 xxx xxxx - Premium Service

    # Generates a voip phone number
    #  3xxx xxxx
    #
    def voip_number
      Faker.numerify("3### ####")
    end

    # Generates a fixed line phone number
    #  6xxx xxxx
    #
    def fixed_line_number 
      Faker.numerify("6### ####")
    end

    # Generates a fixed mobile phone number
    #  8xxx xxxx
    #
    def mobile_number
      Faker.numerify("8### ####")
    end

    # Generates a fixed mobile phone number or pager service number
    #  9xxx xxxx
    #
    def mobile_or_pager_number
      Faker.numerify("9### ####")
    end

    # Generates an international toll-free number
    #  800 xxx xxxx
    #
    def international_toll_free_number
      Faker.numerify("800 ### ####")
    end

    # Generates an toll-free number
    #  1800 xxx xxxx
    #
    def toll_free_number
      Faker.numerify("1800 ### ####")
    end

    # Generates a premium service number
    #  (1900) xxx xxxx
    #
    def premium_service_number
      Faker.numerify("1900 ### ####")
    end


    # generates mobile or home/work number
    def phone_number
      case rand(3)
      when 0 then fixed_line_number
      when 1 then mobile_number
      when 2 then mobile_or_pager_number
      end
    end

    def country_code
      "+65"
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ffaker-1.21.0 lib/ffaker/phone_number_sg.rb
ffaker-1.20.0 lib/ffaker/phone_number_sg.rb
ffaker-1.19.0 lib/ffaker/phone_number_sg.rb
ffaker-1.18.0 lib/ffaker/phone_number_sg.rb
ffaker-1.17.0 lib/ffaker/phone_number_sg.rb
ffaker-1.16.2 lib/ffaker/phone_number_sg.rb
ffaker-1.16.1 lib/ffaker/phone_number_sg.rb
ffaker-1.16.0 lib/ffaker/phone_number_sg.rb
ffaker-1.15.0 lib/ffaker/phone_number_sg.rb