Sha256: bd424fe4acb74747dfb9db427bc307cfc1637f5a468a4cac2fb2698e8b102c27

Contents?: true

Size: 610 Bytes

Versions: 1

Compression:

Stored size: 610 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(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.5 lib/pipedrive/operations/read.rb