Sha256: 723978e8c66bd30a9ba699cce4a869372e2cf445e740158f1bc529e536554db6
Contents?: true
Size: 1.1 KB
Versions: 6
Compression:
Stored size: 1.1 KB
Contents
# unpack phone # Reader - ADIwg JSON V1 to internal data structure # History: # Stan Smith 2013-12-16 original script # Stan Smith 2014-05-14 combine phone service types module Adiwg_Phone def self.unpack(hPhone) # instance classes needed in script intMetadataClass = InternalMetadata.new aPhones = Array.new # create a separate phone for each phone service type # if service is missing, default service to 'voice' if hPhone.has_key?('service') aService = hPhone['service'] else aService = ['voice'] end if aService.empty? aService = ['voice'] end # if service is nil, default service to 'voice' aService.each do |phService| intPhone = intMetadataClass.newPhone # phone - service intPhone[:phoneServiceType] = phService # phone - name if hPhone.has_key?('phoneName') s = hPhone['phoneName'] unless s.nil? intPhone[:phoneName] = s end end # phone - number if hPhone.has_key?('phoneNumber') s = hPhone['phoneNumber'] unless s.nil? intPhone[:phoneNumber] = s end end aPhones << intPhone end return aPhones end end
Version data entries
6 entries across 6 versions & 1 rubygems