Class: PhoneConnect::RealPhoneValidation

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/phone_connect/real_phone_validation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(phone_number) ⇒ RealPhoneValidation

Returns a new instance of RealPhoneValidation.



10
11
12
13
# File 'lib/phone_connect/real_phone_validation.rb', line 10

def initialize(phone_number)
  @phone_number = phone_number
  normalize!
end

Instance Attribute Details

#execution_timeObject (readonly)

Returns the value of attribute execution_time.



8
9
10
# File 'lib/phone_connect/real_phone_validation.rb', line 8

def execution_time
  @execution_time
end

#phone_numberObject (readonly)

Returns the value of attribute phone_number.



8
9
10
# File 'lib/phone_connect/real_phone_validation.rb', line 8

def phone_number
  @phone_number
end

Instance Method Details

#connected?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
# File 'lib/phone_connect/real_phone_validation.rb', line 15

def connected?
  status = response['status']
  return false unless status

  !!status.match(/^(connected|connected-75|busy|pending)$/i)
end

#dnc_responseObject



26
27
28
# File 'lib/phone_connect/real_phone_validation.rb', line 26

def dnc_response
  @parsed_response ||= dnc_validate
end

#responseObject



22
23
24
# File 'lib/phone_connect/real_phone_validation.rb', line 22

def response
  @parsed_response ||= validate
end