PipedrivePUT 1.1.33 → 1.1.34
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 -0
- data/lib/PipedrivePUT.rb +2 -0
- data/lib/PipedrivePUT/activity.rb +27 -12
- data/lib/PipedrivePUT/deal_fields.rb +13 -0
- data/lib/PipedrivePUT/organization.rb +57 -67
- data/lib/PipedrivePUT/persons.rb +4 -4
- data/lib/PipedrivePUT/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 693c6c1f91630f89674b9bd17a001be9934fc5f2
|
4
|
+
data.tar.gz: 60eb9c0407db07b8085a714fbe6725d3c49c18a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a06934585f586d849d9413172bfd56ceffb2856cfff28726fa69c890f5aa1677a9e6c15cb1b5a5d03243529ca7104396ddf57074c21890f12a85b9e69fb8ca79
|
7
|
+
data.tar.gz: a9f6d6348d241b1c4a30e7aef8b7eee63cf689d25cc16d55fb952aa9a75bad104e2bcdea8cfa1720f44b0100b13a1ef1e9d42b7220d840790ce705e3efcc95eb
|
data/README.md
CHANGED
@@ -119,6 +119,13 @@ Get All Deals
|
|
119
119
|
PipedrivePUT::Deal.getAllDeals
|
120
120
|
```
|
121
121
|
|
122
|
+
## Deal Fields
|
123
|
+
|
124
|
+
Get All Deal Fields
|
125
|
+
```ruby
|
126
|
+
PipedrivePUT::DealFields.getAllDealFields
|
127
|
+
```
|
128
|
+
|
122
129
|
## Search
|
123
130
|
|
124
131
|
Search entire Pipedrive (Deals, Organizations, Product, File, Person)
|
@@ -205,6 +212,12 @@ Get all Activites for a specific organization
|
|
205
212
|
PipedrivePUT::Activity.getOrgActivities(< org_id >)
|
206
213
|
```
|
207
214
|
|
215
|
+
Add an Activity
|
216
|
+
|
217
|
+
```ruby
|
218
|
+
PipedrivePUT::Activity.addActivity(<subject>, <type>, <:options => "value">)
|
219
|
+
```
|
220
|
+
|
208
221
|
## Activity Types
|
209
222
|
|
210
223
|
Get all Activity Types
|
data/lib/PipedrivePUT.rb
CHANGED
@@ -4,25 +4,40 @@ module PipedrivePUT
|
|
4
4
|
|
5
5
|
#----------------------------------------- Gets activites of a specific user----------------------------------------------------------
|
6
6
|
def self.getActivity(user_id)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
@parsed = JSON.parse(@content)
|
11
|
-
return @parsed
|
7
|
+
base = "https://api.pipedrive.com/v1/activities?user_id=#{user_id}&api_token=#{@@key}"
|
8
|
+
content = open(base).read
|
9
|
+
JSON.parse(content)
|
12
10
|
end
|
13
11
|
#------------------------------------------------------------------------------------------------------------------------------------
|
14
12
|
|
15
13
|
#----------------------------------------- Gets activites of a specific organization------------------------------------------------
|
16
14
|
|
17
15
|
def self.getOrgActivities(org_id)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
@parsed = JSON.parse(@content)
|
23
|
-
return @parsed
|
24
|
-
end
|
16
|
+
base = "https://api.pipedrive.com/v1/organizations/#{org_id}/activities?start=0&api_token=#{@@key}"
|
17
|
+
content = open(base).read
|
18
|
+
JSON.parse(content)
|
19
|
+
end
|
25
20
|
#-----------------------------------------------------------------------------------------------------------------------------------
|
21
|
+
|
22
|
+
# subject (required) (string) Subject of the activity
|
23
|
+
# done (optional) (enumerated) Whether the activity is done or not. 0 = Not done, 1 = Done
|
24
|
+
# type (required) (string) Type of the activity. (call, meeting, task, deadline, email, lunch)
|
25
|
+
# due_date (optional) (date) Due date of the activity. Format: YYYY-MM-DD
|
26
|
+
# due_time (optional) (time) Due time of the activity in UTC. Format: HH:MM
|
27
|
+
# duration (optional) (time) Duration of the activity. Format: HH:MM
|
28
|
+
# user_id (optional) (number) ID of the user whom the activity will be assigned to. If omitted, the activity will be assigned to the authorized user.
|
29
|
+
# deal_id (optional) (number) ID of the deal this activity will be associated with
|
30
|
+
# person_id (optional) (number) ID of the person this activity will be associated with
|
31
|
+
# org_id (optional) (number) ID of the organization this activity will be associated with
|
32
|
+
# note (optional) (string) Note of the activity (HTML format)
|
33
|
+
def self.addActivity(subject, type, options = {})
|
34
|
+
url = "https://api.pipedrive.com/v1/activities?api_token=#{@@key}"
|
35
|
+
|
36
|
+
options['subject'] = subject
|
37
|
+
options['type'] = type
|
38
|
+
|
39
|
+
HTTParty.post(url, body: options.to_json, headers: {'Content-type' => 'application/json'})
|
40
|
+
end
|
26
41
|
end
|
27
42
|
end
|
28
43
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module PipedrivePUT
|
2
|
+
class DealFields
|
3
|
+
include PipedrivePUT
|
4
|
+
|
5
|
+
#---------------------------------------------------Get all deal fields----------------------------------------------------------
|
6
|
+
def self.getAllDealFields
|
7
|
+
base = "https://api.pipedrive.com/v1/dealFields?api_token=#{@@key}"
|
8
|
+
content = open(base).read
|
9
|
+
JSON.parse(content)
|
10
|
+
end
|
11
|
+
#--------------------------------------------------------------------------------------------------------------------------------
|
12
|
+
end
|
13
|
+
end
|
@@ -13,7 +13,7 @@ require 'rest-client'
|
|
13
13
|
#Get All Organizations from Pipedrive
|
14
14
|
def self.getAllOrgs()
|
15
15
|
@start = 0
|
16
|
-
|
16
|
+
|
17
17
|
table = Array.new
|
18
18
|
@more_items = true
|
19
19
|
tablesize = 0
|
@@ -42,22 +42,13 @@ require 'rest-client'
|
|
42
42
|
return table
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
#Add an organization
|
48
|
-
def self.addOrganization(companyName, options = {})
|
49
|
-
#args.each_with_index{ |arg, i| puts "#{i+1}. #{arg}" }
|
50
|
-
|
51
|
-
uri = URI.parse('https://api.pipedrive.com/v1/organizations?api_token=' + @@key.to_s)
|
52
|
-
|
53
|
-
if (!options.nil?)
|
54
|
-
|
55
|
-
options.merge!(:name => companyName)
|
56
45
|
|
57
|
-
#puts options
|
58
46
|
|
59
|
-
|
60
|
-
|
47
|
+
#Add an organization
|
48
|
+
def self.addOrganization(company_name, options = {})
|
49
|
+
uri = "https://api.pipedrive.com/v1/organizations?api_token=#{@@key}"
|
50
|
+
options = options.merge(name: company_name)
|
51
|
+
HTTParty.post(uri, body: options.to_json, headers: {'Content-type' => 'application/json'})
|
61
52
|
end
|
62
53
|
|
63
54
|
#Return data of a specific Organization
|
@@ -77,55 +68,54 @@ require 'rest-client'
|
|
77
68
|
end
|
78
69
|
end
|
79
70
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
71
|
+
# Find Organization by name
|
72
|
+
def self.findOrganizationByName(name, options = {})
|
73
|
+
params = {}
|
74
|
+
|
75
|
+
params[:start] = options.fetch(:start, 0)
|
76
|
+
params[:limit] = options.fetch(:limit, 500)
|
77
|
+
params[:api_token] = @@key.to_s
|
78
|
+
|
79
|
+
url = "https://api.pipedrive.com/v1/organizations/find?term=#{name}"
|
80
|
+
|
81
|
+
params.each do |key, value|
|
82
|
+
url << "&#{key}=#{value}"
|
83
|
+
end
|
84
|
+
|
85
|
+
begin
|
86
|
+
table = []
|
87
|
+
more_items = true
|
88
|
+
tablesize = 0
|
89
|
+
|
90
|
+
while more_items == true
|
91
|
+
count = 0
|
92
|
+
|
93
|
+
content = open(url).read
|
94
|
+
parsed = JSON.parse(content)
|
95
|
+
return table if parsed['data'].nil?
|
96
|
+
|
97
|
+
while count < parsed['data'].size
|
98
|
+
table[tablesize] = parsed['data'][count]
|
99
|
+
count += 1
|
100
|
+
tablesize += 1
|
101
|
+
end
|
102
|
+
pagination = parsed['additional_data']['pagination']
|
103
|
+
more_items = pagination['more_items_in_collection']
|
104
|
+
params[:start] = pagination['next_start']
|
105
|
+
end
|
106
|
+
return table
|
107
|
+
rescue OpenURI::HTTPError => error
|
108
|
+
response = error.io
|
109
|
+
return response.status
|
110
|
+
end
|
111
|
+
end
|
88
112
|
|
89
|
-
while @more_items == true do
|
90
|
-
count = 0
|
91
|
-
|
92
|
-
@base = URI.parse('https://api.pipedrive.com/v1/organizations/find?term=' + name+ '&start=' + @start.to_s + '&limit=500&api_token=' + @@key.to_s)
|
93
|
-
|
94
|
-
#puts @base
|
95
|
-
|
96
|
-
@content = open(@base.to_s).read
|
97
|
-
|
98
|
-
#puts @content
|
99
|
-
|
100
|
-
@parsed = JSON.parse(@content)
|
101
|
-
|
102
|
-
while count < @parsed["data"].size
|
103
|
-
#table.push(@parsed["data"][count])
|
104
|
-
table[tablesize] = @parsed["data"][count]
|
105
|
-
count = count +1
|
106
|
-
tablesize = tablesize + 1
|
107
|
-
|
108
|
-
end
|
109
|
-
@pagination = @parsed['additional_data']['pagination']
|
110
|
-
@more_items = @pagination['more_items_in_collection']
|
111
|
-
#puts @more_items
|
112
|
-
@start = @pagination['next_start']
|
113
|
-
#puts @start
|
114
|
-
end
|
115
|
-
return table
|
116
|
-
|
117
|
-
rescue OpenURI::HTTPError => error
|
118
|
-
response = error.io
|
119
|
-
return response.status
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
113
|
|
124
114
|
#Get Persons of an Organization
|
125
115
|
def self.getPersonsOfOrganization(id)
|
126
116
|
begin
|
127
117
|
@start = 0
|
128
|
-
|
118
|
+
|
129
119
|
table = Array.new
|
130
120
|
@more_items = true
|
131
121
|
tablesize = 0
|
@@ -134,7 +124,7 @@ require 'rest-client'
|
|
134
124
|
count = 0
|
135
125
|
|
136
126
|
@base = 'https://api.pipedrive.com/v1/organizations/' + id.to_s + '/persons?&start=' + @start.to_s + '&limit=500&api_token=' + @@key.to_s
|
137
|
-
|
127
|
+
|
138
128
|
@content = open(@base.to_s).read
|
139
129
|
|
140
130
|
puts @content
|
@@ -144,14 +134,14 @@ require 'rest-client'
|
|
144
134
|
if @parsed["data"].nil?
|
145
135
|
return "Organization does not have any Person associated with that id"
|
146
136
|
else
|
147
|
-
|
137
|
+
|
148
138
|
while count < @parsed["data"].size
|
149
139
|
#table.push(@parsed["data"][count])
|
150
140
|
table[tablesize] = @parsed["data"][count]
|
151
141
|
count = count +1
|
152
142
|
tablesize = tablesize + 1
|
153
|
-
|
154
|
-
end
|
143
|
+
|
144
|
+
end
|
155
145
|
@pagination = @parsed['additional_data']['pagination']
|
156
146
|
@more_items = @pagination['more_items_in_collection']
|
157
147
|
#puts @more_items
|
@@ -171,18 +161,18 @@ require 'rest-client'
|
|
171
161
|
@url = 'https://api.pipedrive.com/v1/organizations/' + id.to_s + '?api_token=' + @@key.to_s
|
172
162
|
|
173
163
|
#puts @url
|
174
|
-
|
164
|
+
|
175
165
|
if (!options.nil?)
|
176
|
-
|
166
|
+
|
177
167
|
options.merge!(:id => id)
|
178
168
|
#puts options
|
179
169
|
|
180
170
|
#puts '----------------------'
|
181
|
-
|
171
|
+
|
182
172
|
response = HTTParty.put(@url.to_s, :body => options.to_json, :headers => {'Content-type' => 'application/json'})
|
183
173
|
#puts '----------------------'
|
184
|
-
#puts response
|
185
|
-
|
174
|
+
#puts response
|
175
|
+
|
186
176
|
end
|
187
177
|
|
188
178
|
end
|
data/lib/PipedrivePUT/persons.rb
CHANGED
@@ -102,16 +102,16 @@ module PipedrivePUT
|
|
102
102
|
|
103
103
|
content = open(url).read
|
104
104
|
parsed = JSON.parse(content)
|
105
|
-
return
|
105
|
+
return table if parsed['data'].nil?
|
106
106
|
|
107
107
|
while count < parsed['data'].size
|
108
108
|
table[tablesize] = parsed['data'][count]
|
109
109
|
count += 1
|
110
110
|
tablesize += 1
|
111
111
|
end
|
112
|
-
pagination
|
113
|
-
more_items
|
114
|
-
params[
|
112
|
+
pagination = parsed['additional_data']['pagination']
|
113
|
+
more_items = pagination['more_items_in_collection']
|
114
|
+
params[:start] = pagination['next_start']
|
115
115
|
end
|
116
116
|
table
|
117
117
|
end
|
data/lib/PipedrivePUT/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.34
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JakePens71
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-05-
|
12
|
+
date: 2016-05-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -95,8 +95,8 @@ dependencies:
|
|
95
95
|
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: 1.0.7
|
98
|
-
description: Pipedrive gem support for activites, activity-types, deals, organizations,
|
99
|
-
|
98
|
+
description: Pipedrive gem support for activites, activity-types, deals, deal fields,organizations,
|
99
|
+
organization fields, persons, pipelines, recents, search, and users.
|
100
100
|
email:
|
101
101
|
- jake_ps@comcast.net
|
102
102
|
- jrsnow8921@pennunited.com
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- lib/PipedrivePUT/activity.rb
|
113
113
|
- lib/PipedrivePUT/currencies.rb
|
114
114
|
- lib/PipedrivePUT/deal.rb
|
115
|
+
- lib/PipedrivePUT/deal_fields.rb
|
115
116
|
- lib/PipedrivePUT/organization.rb
|
116
117
|
- lib/PipedrivePUT/organization_field.rb
|
117
118
|
- lib/PipedrivePUT/persons.rb
|
@@ -152,3 +153,4 @@ summary: Pipedrive gem to retrieve data from Pipedrive.com
|
|
152
153
|
test_files:
|
153
154
|
- spec/PipedrivePUT_spec.rb
|
154
155
|
- spec/spec_helper.rb
|
156
|
+
has_rdoc:
|