Sha256: f52c79397a2a2622ad1e0d0b39b5a69ad4d64af7c39aa6ccc99e25d0ffe5c586

Contents?: true

Size: 677 Bytes

Versions: 74

Compression:

Stored size: 677 Bytes

Contents

module Services
  module Hubspot
    module Contacts
      class GetPage
        def initialize(limit: 10)
          @limit = limit
        end

        def call
          basic_api = ::Hubspot::Crm::Contacts::BasicApi.new
          results = basic_api.get_page(auth_names: 'oauth2', limit: @limit).results
          results = add_fullnames(results)
        end

        private

        def add_fullnames(contacts)
          contacts.each do |contact|
            fullname = [contact.properties['firstname'], contact.properties['lastname']].reject(&:empty?).join(' ')
            contact.properties['fullname'] = fullname
          end
        end
      end
    end
  end
end

Version data entries

74 entries across 21 versions & 1 rubygems

Version Path
hubspot-api-client-9.0.0 sample-apps/search-result-paging-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-9.0.0 sample-apps/companies-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-9.0.0 sample-apps/contacts-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-9.0.0 sample-apps/oauth-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-8.0.1 sample-apps/contacts-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-8.0.1 sample-apps/search-result-paging-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-8.0.1 sample-apps/companies-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-8.0.1 sample-apps/oauth-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-8.0.0 sample-apps/contacts-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-8.0.0 sample-apps/oauth-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-8.0.0 sample-apps/search-result-paging-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-8.0.0 sample-apps/companies-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-7.3.0 sample-apps/companies-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-7.3.0 sample-apps/contacts-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-7.3.0 sample-apps/search-result-paging-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-7.3.0 sample-apps/oauth-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-7.2.0 sample-apps/companies-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-7.2.0 sample-apps/contacts-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-7.2.0 sample-apps/oauth-app/app/lib/services/hubspot/contacts/get_page.rb
hubspot-api-client-7.2.0 sample-apps/search-result-paging-app/app/lib/services/hubspot/contacts/get_page.rb