Class: PipedrivePUT::Pipelines

Inherits:
Object
  • Object
show all
Includes:
PipedrivePUT
Defined in:
lib/PipedrivePUT/pipelines.rb

Constant Summary

Constants included from PipedrivePUT

VERSION

Instance Attribute Summary

Attributes included from PipedrivePUT

#key

Class Method Summary collapse

Methods included from PipedrivePUT

getKey, key

Class Method Details

.getAllPipelinesObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/PipedrivePUT/pipelines.rb', line 6

def self.getAllPipelines
  @start = 0
    
    table = Array.new
    @more_items = true
    tablesize = 0
    while @more_items == true do
    count = 0
    #puts @more_items
    @base = 'https://api.pipedrive.com/v1/pipelines?api_token=' + @@key.to_s
    #puts @base
    @content = open(@base.to_s).read
    @parsed = JSON.parse(@content)

    while count < @parsed["data"].size
      #table.push(@parsed["data"][count])
      table[tablesize] = @parsed["data"][count]
      count = count +1
      tablesize = tablesize + 1
    end

    @pagination = @parsed['additional_data']['pagination']
    @more_items = @pagination['more_items_in_collection']
    #puts @more_items
    @start = @pagination['next_start']
    #puts @start
    end

  return table
end

.getOnePipeline(id) ⇒ Object



37
38
39
40
41
42
# File 'lib/PipedrivePUT/pipelines.rb', line 37

def self.getOnePipeline(id)
  @base = 'https://api.pipedrive.com/v1/pipelines/' + id.to_s + '?api_token=' + @@key.to_s
    #puts @base
    @content = open(@base.to_s).read
    @parsed = JSON.parse(@content)
end