Class: EVSS::PCIU::PhoneNumberResponse
- Inherits:
-
Response
- Object
- Common::Base
- Response
- EVSS::PCIU::PhoneNumberResponse
- Defined in:
- lib/evss/pciu/phone_number_response.rb
Overview
Model for PCIU phone number response
Constant Summary
Constants included from Common::Client::Concerns::ServiceStatus
Common::Client::Concerns::ServiceStatus::RESPONSE_STATUS
Instance Attribute Summary collapse
-
#country_code ⇒ String
The country code at the beginning of the phone number.
-
#effective_date ⇒ String
Date at which the number was known to be valid.
-
#extension ⇒ String
The extension at the end of the phone number.
-
#number ⇒ String
The main phone number.
Attributes inherited from Common::Base
Instance Method Summary collapse
-
#initialize(status, response = nil) ⇒ PhoneNumberResponse
constructor
A new instance of PhoneNumberResponse.
- #to_s ⇒ Object
Methods inherited from Response
#cache?, #metadata, #ok?, #response_status
Methods inherited from Common::Base
#changed, #changed?, #changes, default_sort, filterable_attributes, max_per_page, per_page, sortable_attributes
Constructor Details
#initialize(status, response = nil) ⇒ PhoneNumberResponse
Returns a new instance of PhoneNumberResponse.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/evss/pciu/phone_number_response.rb', line 28 def initialize(status, response = nil) attributes = { country_code: response&.body&.dig('cnp_phone', 'country_code'), number: response&.body&.dig('cnp_phone', 'number'), extension: response&.body&.dig('cnp_phone', 'extension'), effective_date: response&.body&.dig('cnp_phone', 'effective_date') } super(status, attributes) end |
Instance Attribute Details
#country_code ⇒ String
Returns The country code at the beginning of the phone number.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/evss/pciu/phone_number_response.rb', line 22 class PhoneNumberResponse < EVSS::Response attribute :country_code, String attribute :number, String attribute :extension, String attribute :effective_date, String def initialize(status, response = nil) attributes = { country_code: response&.body&.dig('cnp_phone', 'country_code'), number: response&.body&.dig('cnp_phone', 'number'), extension: response&.body&.dig('cnp_phone', 'extension'), effective_date: response&.body&.dig('cnp_phone', 'effective_date') } super(status, attributes) end def to_s "#{country_code}#{number}#{extension}".gsub(/[^\d]/, '') end end |
#effective_date ⇒ String
Returns Date at which the number was known to be valid.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/evss/pciu/phone_number_response.rb', line 22 class PhoneNumberResponse < EVSS::Response attribute :country_code, String attribute :number, String attribute :extension, String attribute :effective_date, String def initialize(status, response = nil) attributes = { country_code: response&.body&.dig('cnp_phone', 'country_code'), number: response&.body&.dig('cnp_phone', 'number'), extension: response&.body&.dig('cnp_phone', 'extension'), effective_date: response&.body&.dig('cnp_phone', 'effective_date') } super(status, attributes) end def to_s "#{country_code}#{number}#{extension}".gsub(/[^\d]/, '') end end |
#extension ⇒ String
Returns The extension at the end of the phone number.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/evss/pciu/phone_number_response.rb', line 22 class PhoneNumberResponse < EVSS::Response attribute :country_code, String attribute :number, String attribute :extension, String attribute :effective_date, String def initialize(status, response = nil) attributes = { country_code: response&.body&.dig('cnp_phone', 'country_code'), number: response&.body&.dig('cnp_phone', 'number'), extension: response&.body&.dig('cnp_phone', 'extension'), effective_date: response&.body&.dig('cnp_phone', 'effective_date') } super(status, attributes) end def to_s "#{country_code}#{number}#{extension}".gsub(/[^\d]/, '') end end |
#number ⇒ String
Returns The main phone number.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/evss/pciu/phone_number_response.rb', line 22 class PhoneNumberResponse < EVSS::Response attribute :country_code, String attribute :number, String attribute :extension, String attribute :effective_date, String def initialize(status, response = nil) attributes = { country_code: response&.body&.dig('cnp_phone', 'country_code'), number: response&.body&.dig('cnp_phone', 'number'), extension: response&.body&.dig('cnp_phone', 'extension'), effective_date: response&.body&.dig('cnp_phone', 'effective_date') } super(status, attributes) end def to_s "#{country_code}#{number}#{extension}".gsub(/[^\d]/, '') end end |
Instance Method Details
#to_s ⇒ Object
39 40 41 |
# File 'lib/evss/pciu/phone_number_response.rb', line 39 def to_s "#{country_code}#{number}#{extension}".gsub(/[^\d]/, '') end |