Class: Intercom::DeprecatedLeadsCollectionProxy
- Inherits:
-
ClientCollectionProxy
- Object
- BaseCollectionProxy
- ClientCollectionProxy
- Intercom::DeprecatedLeadsCollectionProxy
- Defined in:
- lib/intercom/deprecated_leads_collection_proxy.rb
Instance Attribute Summary
Attributes inherited from BaseCollectionProxy
#resource_class, #resource_name, #url
Instance Method Summary collapse
Methods inherited from ClientCollectionProxy
Methods inherited from BaseCollectionProxy
Constructor Details
This class inherits a constructor from Intercom::BaseCollectionProxy
Instance Method Details
#fetch(next_page) ⇒ Object
5 6 7 8 9 10 11 12 |
# 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) ⇒ Object
14 15 16 17 18 19 20 |
# 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 |