Sha256: 04306ac13f95951400a8e90f8fea1e92ae2b13ff45ed89957fac40b1a0fa884e

Contents?: true

Size: 616 Bytes

Versions: 1

Compression:

Stored size: 616 Bytes

Contents

# frozen_string_literal: true

module Pipedrive
  module Operations
    module Read
      extend ActiveSupport::Concern
      include ::Enumerable
      include ::Pipedrive::Utils

      def each(params = {}, &block)
        return to_enum(:each, params) unless block

        follow_pagination(:chunk, [], params, &block)
      end

      def all(params = {})
        each(params).to_a
      end

      def chunk(params = {})
        res = make_api_call(:get, params)
        return [] unless res.success?

        res
      end

      def find_by_id(id)
        make_api_call(:get, id)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pipedrive_api_rb-1.0.4 lib/pipedrive/operations/read.rb