Module: NetProspex::Api::HasPhones

Included in:
Organization, Person
Defined in:
lib/netprospex/api/sub_objects.rb

Instance Method Summary collapse

Instance Method Details

#initialize(*args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/netprospex/api/sub_objects.rb', line 3

def initialize(*args)
  super(*args)
  self.phones ||= []
  self.phones.map! do |phone|
    if phone.is_a? Hash
      if phone[:national_number] && !phone[:national_number].empty?
        NetProspex::Api::Phone.new(phone)
      else
        nil
      end
    else
      phone
    end
  end
  self.phones.compact!
end