Sha256: 8aa0000f4d85a535834732aac8e4efd77ac4e7337bf055f7be0cd417c2228408
Contents?: true
Size: 828 Bytes
Versions: 42
Compression:
Stored size: 828 Bytes
Contents
module Services module Hubspot module Contacts class Export PROPERTIES_TO_EXPORT = %w[email firstname lastname].freeze def initialize(max_pages: 10) @max_pages = max_pages end def call convert_to_csv(contacts) end private def contacts basic_api = ::Hubspot::Crm::Contacts::BasicApi.new basic_api.get_all(auth_names: 'oauth2') end def convert_to_csv(contacts, properties: PROPERTIES_TO_EXPORT) CSV.generate(headers: true) do |csv| csv << [:id, *properties] contacts.each do |contact| csv << [contact.id, *properties.map { |property| contact.properties[property] }] end csv end end end end end end
Version data entries
42 entries across 21 versions & 1 rubygems