Sha256: eeb9f86bd17baf6069c9f75fa138ac5e9eb32c4738f57f61124a993c5619e8d9

Contents?: true

Size: 920 Bytes

Versions: 7

Compression:

Stored size: 920 Bytes

Contents

module RingCentralSdk
  module REST
    module Request
      module Inflator
        # ContactInfo class will inflate contact info to array
        class ContactInfo
          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

          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
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ringcentral_sdk-3.1.0 lib/ringcentral_sdk/rest/request/inflator/contact_info.rb
ringcentral_sdk-3.0.1 lib/ringcentral_sdk/rest/request/inflator/contact_info.rb
ringcentral_sdk-3.0.0 lib/ringcentral_sdk/rest/request/inflator/contact_info.rb
ringcentral_sdk-2.3.0 lib/ringcentral_sdk/rest/request/inflator/contact_info.rb
ringcentral_sdk-2.2.3 lib/ringcentral_sdk/rest/request/inflator/contact_info.rb
ringcentral_sdk-2.2.2 lib/ringcentral_sdk/rest/request/inflator/contact_info.rb
ringcentral_sdk-2.2.1 lib/ringcentral_sdk/rest/request/inflator/contact_info.rb