Module: Pipedrive::Operations::Read

Extended by:
ActiveSupport::Concern
Includes:
Enumerable, Utils
Included in:
Activity, ActivityType, Deal, DealField, File, Filter, Goal, Note, Pipedrive::Organization, Pipedrive::OrganizationField, Person, PersonField, Pipeline, Product, ProductField, Role, Stage, User
Defined in:
lib/pipedrive/operations/read.rb

Instance Method Summary collapse

Methods included from Utils

#follow_pagination

Instance Method Details

#all(params = {}) ⇒ Object



16
17
18
# File 'lib/pipedrive/operations/read.rb', line 16

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

#chunk(params = {}) ⇒ Object



20
21
22
23
24
25
# File 'lib/pipedrive/operations/read.rb', line 20

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

  res
end

#each(params = {}, &block) ⇒ Object



10
11
12
13
14
# File 'lib/pipedrive/operations/read.rb', line 10

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

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

#find_by_id(id) ⇒ Object



27
28
29
# File 'lib/pipedrive/operations/read.rb', line 27

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