Sha256: 2dfcbcfa632add4996d2c822ecf2481e62aa78d32088a54acca6bcdc5cd1dbc1

Contents?: true

Size: 1.12 KB

Versions: 56

Compression:

Stored size: 1.12 KB

Contents

module Hubspot
  module Helpers
    module GetAllHelper
      MAX_PAGE_SIZE = 100
      # List
      # Read all contacts. Control what is returned via the `properties` query param.
      # @param [Hash] opts the optional parameters
      # @option opts [Array<String>] :properties A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored.
      # @option opts [Array<String>] :associations A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored.
      # @option opts [Boolean] :archived Whether to return only results that have been archived. (default to false)
      # @return Array
      def get_all(opts = {})
        after = nil
        objects = []
        loop do
          page_opts = opts.merge(limit: MAX_PAGE_SIZE, after: after)
          page = get_page(page_opts)
          objects.concat(page.results)
          break objects if page.paging.nil?

          after = page.paging._next.after
        end

      end
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
hubspot-api-client-16.3.0 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-16.2.1 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-16.2.0 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-16.1.1 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-16.1.0 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-16.0.4 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-16.0.3 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-16.0.2 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-16.0.1 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-16.0.0 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-15.0.2 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-15.0.1 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-15.0.0 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-14.5.2 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-14.5.1 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-14.5.0 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-14.4.0 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-14.3.0 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-14.2.0 lib/hubspot/helpers/get_all_helper.rb
hubspot-api-client-14.1.0 lib/hubspot/helpers/get_all_helper.rb