Module: Telesign

Defined in:
lib/telesign.rb,
lib/telesign/phone.rb,
lib/telesign/api/default.rb,
lib/telesign/api_request.rb,
lib/telesign/lib/country.rb,
lib/telesign/sms/request.rb,
lib/telesign/api_response.rb,
lib/telesign/call/request.rb,
lib/telesign/lib/language.rb,
lib/telesign/sms/response.rb,
lib/telesign/call/response.rb,
lib/telesign/lib/exceptions.rb,
lib/telesign/lib/phone_type.rb,
lib/telesign/status/request.rb,
lib/telesign/status/response.rb,
lib/telesign/phone_id/request.rb,
lib/telesign/phone_id/response.rb,
lib/telesign/api/defaultMappingRegistry.rb,
lib/telesign/phone_verification/request.rb,
lib/telesign/phone_verification/response.rb

Defined Under Namespace

Modules: API, Call, Country, Exceptions, Language, PhoneID, PhoneType, PhoneVerification, SMS, Status Classes: ApiRequest, ApiResponse, Phone

Class Method Summary collapse

Class Method Details

.call(phone, verification_code) {|request| ... } ⇒ Object

Yields:

  • (request)


9
10
11
12
13
14
# File 'lib/telesign.rb', line 9

def self.call(phone, verification_code)
  request = Call::Request.new(phone)
  request.verification_code = verification_code
  yield(request) if block_given?
  Call::Response.new(request.call)
end

.identify(phone) {|request| ... } ⇒ Object

Yields:

  • (request)


3
4
5
6
7
# File 'lib/telesign.rb', line 3

def self.identify(phone)
  request = PhoneID::Request.new(phone)
  yield(request) if block_given?
  PhoneID::Response.new(request.call)
end

.sms(phone, verification_code) {|request| ... } ⇒ Object

Yields:

  • (request)


16
17
18
19
20
21
# File 'lib/telesign.rb', line 16

def self.sms(phone, verification_code)
  request = SMS::Request.new(phone)
  request.verification_code = verification_code
  yield(request) if block_given?
  SMS::Response.new(request.call)
end

.status(reference_id, verification_code = nil) {|request| ... } ⇒ Object

Yields:

  • (request)


23
24
25
26
27
28
# File 'lib/telesign.rb', line 23

def self.status(reference_id, verification_code = nil)
  request = Status::Request.new(reference_id)
  request.verification_code = verification_code
  yield(request) if block_given?
  Status::Response.new(request.call)
end

.verification_codeObject

Generates a random 3 digit integer without leading zeroes.



32
33
34
# File 'lib/telesign.rb', line 32

def self.verification_code
  rand(899) + 100
end