Class: RingCentralSdk::REST::Request::Inflator::ContactInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/ringcentral_sdk/rest/request/inflator/contact_info.rb

Overview

ContactInfo class will inflate contact info to array

Instance Method Summary collapse

Instance Method Details

#inflate_to_array(any = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ringcentral_sdk/rest/request/inflator/contact_info.rb', line 7

def inflate_to_array(any = nil)
  contacts = []
  if any.is_a?(Array)
    any.each do |contact|
      contacts.push inflate_to_object(contact)
    end
  elsif any.is_a?(Hash)
    contacts = [any]
  elsif any.is_a?(String) || any.is_a?(Integer)
    contacts = [{ phoneNumber: any }]
  end
  contacts
end

#inflate_to_object(any = nil) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/ringcentral_sdk/rest/request/inflator/contact_info.rb', line 21

def inflate_to_object(any = nil)
  contact = {}
  if any.is_a?(Hash)
    contact = any
  elsif any.is_a?(String) || any.is_a?(Integer)
    contact = { phoneNumber: any }
  end
  contact
end