PipedrivePUT 1.1.25 → 1.1.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -1
- data/lib/PipedrivePUT/organization.rb +111 -89
- data/lib/PipedrivePUT/organization_field.rb +17 -1
- data/lib/PipedrivePUT/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4a99a18e055a0dfa4257e023517b81734d60c18
|
4
|
+
data.tar.gz: 96400b33b801f94cceb130e736b6ae1b610dd532
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: faf318427f34e264b30916be0fb4ff6b558f7da40212635ab0711a33d3ed390dce38a7b92840baaea3b48d9d8370eff1ee877c181acdc1c2cb431db3bdf0899b
|
7
|
+
data.tar.gz: 0ad080c29057474750237d9d6d6e1f3f6ddf1bf912a06afe190f9f11f73c9cbf58339a0215ce9f71e433d1a76d060c239a6fa6a2fb58e171dc1cf243c6f50096
|
data/README.md
CHANGED
@@ -207,11 +207,23 @@ Get all fields that are able to be used in an organization
|
|
207
207
|
PipedrivePUT::OrganizationFields.getAllOrganizationFields
|
208
208
|
```
|
209
209
|
|
210
|
-
|
211
210
|
NOTE: This searches for everything in Pipedrive (deal, organization, user, state, product, etc.)
|
212
211
|
|
213
212
|
I hope to add additional support to break this down at a later time.
|
214
213
|
|
214
|
+
Add Organization Field
|
215
|
+
```ruby
|
216
|
+
PipedrivePUT::OrganizationFields.addOrganizationField(< Field Name>, <Field Type>, { <options> } )
|
217
|
+
```
|
218
|
+
|
219
|
+
Field types: " ", varchar, varchar_auto, text, double, monetary, date, set, enum, user, org, people, phone, time, timerange, daterange
|
220
|
+
|
221
|
+
NOTE: The field type for Pipedrive is required. However, it can also be left as empty.
|
222
|
+
|
223
|
+
Example:
|
224
|
+
```ruby
|
225
|
+
PipedrivePUT::OrganizationFields.addOrganizationField("Total Ordered in September", "monetary", {:important_flag => 'true'})
|
226
|
+
```
|
215
227
|
|
216
228
|
Data is returned in JSON format.
|
217
229
|
|
@@ -12,35 +12,34 @@ require 'rest-client'
|
|
12
12
|
|
13
13
|
#Get All Organizations from Pipedrive
|
14
14
|
def self.getAllOrgs()
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
@parsed = JSON.parse(@content)
|
28
|
-
|
29
|
-
while count < @parsed["data"].size
|
30
|
-
#table.push(@parsed["data"][count])
|
31
|
-
table[tablesize] = @parsed["data"][count]
|
32
|
-
count = count +1
|
33
|
-
tablesize = tablesize + 1
|
34
|
-
end
|
15
|
+
@start = 0
|
16
|
+
|
17
|
+
table = Array.new
|
18
|
+
@more_items = true
|
19
|
+
tablesize = 0
|
20
|
+
while @more_items == true do
|
21
|
+
count = 0
|
22
|
+
#puts @more_items
|
23
|
+
@base = URI.parse('https://api.pipedrive.com/v1/organizations?start=' + @start.to_s + '&limit=500&api_token=' + @@key.to_s)
|
24
|
+
#puts @base
|
25
|
+
@content = Net::HTTP.get(@base)
|
26
|
+
@parsed = JSON.parse(@content)
|
35
27
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
28
|
+
while count < @parsed["data"].size
|
29
|
+
#table.push(@parsed["data"][count])
|
30
|
+
table[tablesize] = @parsed["data"][count]
|
31
|
+
count = count +1
|
32
|
+
tablesize = tablesize + 1
|
33
|
+
end
|
42
34
|
|
43
|
-
|
35
|
+
@pagination = @parsed['additional_data']['pagination']
|
36
|
+
@more_items = @pagination['more_items_in_collection']
|
37
|
+
#puts @more_items
|
38
|
+
@start = @pagination['next_start']
|
39
|
+
#puts @start
|
40
|
+
end
|
41
|
+
|
42
|
+
return table
|
44
43
|
end
|
45
44
|
|
46
45
|
|
@@ -62,85 +61,108 @@ require 'rest-client'
|
|
62
61
|
|
63
62
|
#Return data of a specific Organization
|
64
63
|
def self.getOrganization(id)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
begin
|
65
|
+
@base = 'https://api.pipedrive.com/v1/organizations/' + id.to_s + '?api_token=' + @@key.to_s
|
66
|
+
@content = open(@base.to_s).read
|
67
|
+
@parsed = JSON.parse(@content)
|
68
|
+
if @parsed["data"].nil?
|
69
|
+
return "Organization does not exist in pipedrive"
|
70
|
+
else
|
71
|
+
return @parsed
|
72
|
+
end
|
73
|
+
rescue OpenURI::HTTPError => error
|
74
|
+
response = error.io
|
75
|
+
return response.status
|
76
|
+
end
|
69
77
|
end
|
70
78
|
|
71
79
|
#Find Organization by name
|
72
80
|
def self.findOrganizationByName(name)
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
81
|
+
begin
|
82
|
+
@start = 0
|
83
|
+
|
84
|
+
table = Array.new
|
85
|
+
@more_items = true
|
86
|
+
tablesize = 0
|
78
87
|
|
79
|
-
|
80
|
-
|
88
|
+
while @more_items == true do
|
89
|
+
count = 0
|
81
90
|
|
82
|
-
|
83
|
-
|
84
|
-
|
91
|
+
@base = URI.parse('https://api.pipedrive.com/v1/organizations/find?term=' + name+ '&start=' + @start.to_s + '&limit=500&api_token=' + @@key.to_s)
|
92
|
+
|
93
|
+
#puts @base
|
85
94
|
|
86
|
-
|
95
|
+
@content = open(@base.to_s).read
|
87
96
|
|
88
|
-
|
97
|
+
#puts @content
|
89
98
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
99
|
+
@parsed = JSON.parse(@content)
|
100
|
+
|
101
|
+
while count < @parsed["data"].size
|
102
|
+
#table.push(@parsed["data"][count])
|
103
|
+
table[tablesize] = @parsed["data"][count]
|
104
|
+
count = count +1
|
105
|
+
tablesize = tablesize + 1
|
106
|
+
|
107
|
+
end
|
108
|
+
@pagination = @parsed['additional_data']['pagination']
|
109
|
+
@more_items = @pagination['more_items_in_collection']
|
110
|
+
#puts @more_items
|
111
|
+
@start = @pagination['next_start']
|
112
|
+
#puts @start
|
113
|
+
end
|
114
|
+
return table
|
115
|
+
|
116
|
+
rescue OpenURI::HTTPError => error
|
117
|
+
response = error.io
|
118
|
+
return response.status
|
119
|
+
end
|
106
120
|
end
|
107
121
|
|
108
122
|
|
109
123
|
#Get Persons of an Organization
|
110
124
|
def self.getPersonsOfOrganization(id)
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
125
|
+
begin
|
126
|
+
@start = 0
|
127
|
+
|
128
|
+
table = Array.new
|
129
|
+
@more_items = true
|
130
|
+
tablesize = 0
|
116
131
|
|
117
|
-
|
118
|
-
|
132
|
+
while @more_items == true do
|
133
|
+
count = 0
|
119
134
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
@parsed = JSON.parse(@content)
|
135
|
+
@base = 'https://api.pipedrive.com/v1/organizations/' + id.to_s + '/persons?&start=' + @start.to_s + '&limit=500&api_token=' + @@key.to_s
|
136
|
+
|
137
|
+
@content = open(@base.to_s).read
|
124
138
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
count = count +1
|
133
|
-
tablesize = tablesize + 1
|
139
|
+
puts @content
|
140
|
+
|
141
|
+
@parsed = JSON.parse(@content)
|
142
|
+
|
143
|
+
if @parsed["data"].nil?
|
144
|
+
return "Organization does not have any Person associated with that id"
|
145
|
+
else
|
134
146
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
147
|
+
while count < @parsed["data"].size
|
148
|
+
#table.push(@parsed["data"][count])
|
149
|
+
table[tablesize] = @parsed["data"][count]
|
150
|
+
count = count +1
|
151
|
+
tablesize = tablesize + 1
|
152
|
+
|
153
|
+
end
|
154
|
+
@pagination = @parsed['additional_data']['pagination']
|
155
|
+
@more_items = @pagination['more_items_in_collection']
|
156
|
+
#puts @more_items
|
157
|
+
@start = @pagination['next_start']
|
158
|
+
#puts @start
|
159
|
+
end
|
160
|
+
end
|
161
|
+
return table
|
162
|
+
rescue OpenURI::HTTPError => error
|
163
|
+
response = error.io
|
164
|
+
return response.status
|
165
|
+
end
|
144
166
|
end
|
145
167
|
|
146
168
|
#Update an Organization
|
@@ -165,4 +187,4 @@ require 'rest-client'
|
|
165
187
|
end
|
166
188
|
|
167
189
|
end
|
168
|
-
end
|
190
|
+
end
|
@@ -33,8 +33,24 @@ include PipedrivePUT
|
|
33
33
|
end
|
34
34
|
|
35
35
|
return table
|
36
|
-
|
36
|
+
end
|
37
|
+
|
38
|
+
#Add an organization Field
|
39
|
+
def self.addOrganizationField(fieldName, fieldType, options = {})
|
40
|
+
#args.each_with_index{ |arg, i| puts "#{i+1}. #{arg}" }
|
41
|
+
|
42
|
+
@url = 'https://api.pipedrive.com/v1/organizationFields?api_token=' + @@key.to_s
|
43
|
+
|
44
|
+
if (!options.nil?)
|
37
45
|
|
46
|
+
options.merge!(:name => fieldName.to_s)
|
47
|
+
options.merge!(:field_type => fieldType.to_s)
|
48
|
+
|
49
|
+
#puts options
|
50
|
+
|
51
|
+
response = HTTParty.post(@url.to_s, :body => options.to_json, :headers => {'Content-type' => 'application/json'})
|
52
|
+
end
|
53
|
+
end
|
38
54
|
|
39
55
|
end
|
40
56
|
end
|
data/lib/PipedrivePUT/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: PipedrivePUT
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JakePens71
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|