Sha256: 1eee960eb8e429396fe607e1dceea7179e751ed803fdd2ababdaf1c3e82f836d

Contents?: true

Size: 623 Bytes

Versions: 4

Compression:

Stored size: 623 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_given?

        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

4 entries across 4 versions & 2 rubygems

Version Path
pipedrive_api_rb-1.0.2 lib/pipedrive/operations/read.rb
pipedrive_api_rb-1.0.1 lib/pipedrive/operations/read.rb
pipedrive_api_rb-1.0.0 lib/pipedrive/operations/read.rb
pipedrive.rb-0.3.0 lib/pipedrive/operations/read.rb