Class: PhoneConnect::RealPhoneValidation
- Inherits:
-
Object
- Object
- PhoneConnect::RealPhoneValidation
- Includes:
- HTTParty
- Defined in:
- lib/phone_connect/real_phone_validation.rb
Instance Attribute Summary collapse
-
#execution_time ⇒ Object
readonly
Returns the value of attribute execution_time.
-
#phone_number ⇒ Object
readonly
Returns the value of attribute phone_number.
Instance Method Summary collapse
- #connected? ⇒ Boolean
- #dnc_response ⇒ Object
-
#initialize(phone_number) ⇒ RealPhoneValidation
constructor
A new instance of RealPhoneValidation.
- #response ⇒ Object
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_time ⇒ Object (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_number ⇒ Object (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
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_response ⇒ Object
26 27 28 |
# File 'lib/phone_connect/real_phone_validation.rb', line 26 def dnc_response @parsed_response ||= dnc_validate end |
#response ⇒ Object
22 23 24 |
# File 'lib/phone_connect/real_phone_validation.rb', line 22 def response @parsed_response ||= validate end |