Class: Pipl::Phone
Instance Attribute Summary collapse
-
#country_code ⇒ Fixnum
International country calling code.
-
#display ⇒ String
Well formatted representation of this phone number for display purposes.
-
#display_international ⇒ String
Well formatted international representation of this phone number for display purposes.
-
#extension ⇒ String
Office extension.
-
#number ⇒ Fixnum
Actual phone number.
-
#raw ⇒ String
Unparsed phone number.
-
#type ⇒ String
Possible values are: mobile home_phone home_fax work_phone work_fax pager.
Attributes inherited from Field
#current, #inferred, #last_seen, #valid_since
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Phone
constructor
A new instance of Phone.
- #is_searchable? ⇒ Boolean
- #to_hash ⇒ Object
Methods inherited from Field
base_params_from_hash, from_hash
Methods included from Utils
alnum_chars, alpha_chars, date_to_str, extract_rate_limits, is_valid_url?, str_to_date, titleize, to_utf8
Constructor Details
#initialize(params = {}) ⇒ Phone
Returns a new instance of Phone.
227 228 229 230 231 232 233 234 235 236 |
# File 'lib/pipl/fields.rb', line 227 def initialize(params={}) super params @country_code = params[:country_code] @number = params[:number] @extension = params[:extension] @type = params[:type] @raw = params[:raw] @display = params[:display] @display_international = params[:display_international] end |
Instance Attribute Details
#country_code ⇒ Fixnum
Returns International country calling code.
225 226 227 |
# File 'lib/pipl/fields.rb', line 225 def country_code @country_code end |
#display ⇒ String
Returns Well formatted representation of this phone number for display purposes.
225 |
# File 'lib/pipl/fields.rb', line 225 attr_accessor :country_code, :number, :extension, :type, :raw, :display, :display_international |
#display_international ⇒ String
Returns Well formatted international representation of this phone number for display purposes.
225 |
# File 'lib/pipl/fields.rb', line 225 attr_accessor :country_code, :number, :extension, :type, :raw, :display, :display_international |
#extension ⇒ String
Returns Office extension.
225 |
# File 'lib/pipl/fields.rb', line 225 attr_accessor :country_code, :number, :extension, :type, :raw, :display, :display_international |
#number ⇒ Fixnum
Returns Actual phone number.
225 |
# File 'lib/pipl/fields.rb', line 225 attr_accessor :country_code, :number, :extension, :type, :raw, :display, :display_international |
#raw ⇒ String
Returns Unparsed phone number.
225 |
# File 'lib/pipl/fields.rb', line 225 attr_accessor :country_code, :number, :extension, :type, :raw, :display, :display_international |
#type ⇒ String
Possible values are:
mobile
home_phone
home_fax
work_phone
work_fax
pager
225 |
# File 'lib/pipl/fields.rb', line 225 attr_accessor :country_code, :number, :extension, :type, :raw, :display, :display_international |
Class Method Details
.extra_metadata ⇒ Object
238 239 240 |
# File 'lib/pipl/fields.rb', line 238 def self. [:display_international] end |
Instance Method Details
#is_searchable? ⇒ Boolean
247 248 249 |
# File 'lib/pipl/fields.rb', line 247 def is_searchable? (@raw and not @raw.empty?) or not @number.nil? end |
#to_hash ⇒ Object
242 243 244 245 |
# File 'lib/pipl/fields.rb', line 242 def to_hash {country_code: @country_code, number: @number, extension: @extension, raw: @raw} .reject { |_, value| value.nil? } end |