class Intercom::DeprecatedLeadsCollectionProxy

Public Instance Methods

fetch(next_page) click to toggle source
# File lib/intercom/deprecated_leads_collection_proxy.rb, line 5
def fetch(next_page)
  response_hash = if next_page
                    @client.get(next_page, {})
                  else
                    @client.get(@url, @params)
                  end
  transform(response_hash)
end
transform(response_hash) click to toggle source
# File lib/intercom/deprecated_leads_collection_proxy.rb, line 14
def transform(response_hash)
  response_hash['type'] = 'lead.list'
  leads_list = response_hash.delete('contacts')
  leads_list.each { |lead| lead['type'] = 'lead' }
  response_hash['leads'] = leads_list
  response_hash
end