PipedrivePUT 1.1.36 → 1.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31cc87dc6a10b4576921abbebe6b1205b6fd3ba5
4
- data.tar.gz: 0d3912db82bc8af846a50a81cea969f9238f9f78
3
+ metadata.gz: 921eb1997ade18df04866320d10f74e47ae8829d
4
+ data.tar.gz: 4c89ca09576821eb9692ca00ae24387cdf3adf35
5
5
  SHA512:
6
- metadata.gz: 4c18660ed24ce76649827ec7f9387fee431130877b234e0b2c312f5572055c49368500d7e4b48d8d92d6cbe86e9b36a3664a9fdd1b633f4db00e1a4a5984b9a0
7
- data.tar.gz: b806227339628fb3dcd57390637024f334829ff6e79dc6d539edae8fc126ffaa8b1e6041fdcb4b4c5ab16147a2fa3128ecd7ab06d5eabf50b265f135e2148fc6
6
+ metadata.gz: 6f0532e5a413f03714506cf22d9e7cf591bf327cdae9afe21f68011351586a0eb5d4928c9206e16e8aee626e78486f3c93f01618befe4acb1b7c09e8a471e78e
7
+ data.tar.gz: fcfe2445213312b37c9c4636c56f00008a32ffa4a33cf722749513fb2f2f6b5245bf82f5c67b60f05dbdd506b7c3ab58251b9decead801fbe137991d2deda578
data/README.md CHANGED
@@ -225,6 +225,24 @@ Get all Activity Types
225
225
  PipedrivePUT::Activity.getActivity_type
226
226
  ```
227
227
 
228
+ ## Filters
229
+
230
+ Get all filters
231
+ ```ruby
232
+ PipedrivePUT::Filters.getFilters
233
+ ```
234
+
235
+ ## Files
236
+ Get all files
237
+ ```ruby
238
+ PipedrivePUT::Files.getAllFiles
239
+ ```
240
+
241
+ Download a specific file
242
+ ```ruby
243
+ PipedrivePUT::Files.downloadFile(< file_id >)
244
+ ```
245
+ # ^This will download the specific file and place it in the root dir of your current dir
228
246
 
229
247
  ## Currencies
230
248
 
@@ -1,5 +1,5 @@
1
- require "PipedrivePUT/version"
2
- require "PipedrivePUT/organization"
1
+ require 'PipedrivePUT/version'
2
+ require 'PipedrivePUT/organization'
3
3
  require 'PipedrivePUT/search'
4
4
  require 'PipedrivePUT/users'
5
5
  require 'PipedrivePUT/deal'
@@ -11,7 +11,8 @@ require 'PipedrivePUT/activity'
11
11
  require 'PipedrivePUT/activity-type'
12
12
  require 'PipedrivePUT/currencies'
13
13
  require 'PipedrivePUT/deal_fields'
14
-
14
+ require 'PipedrivePUT/filters'
15
+ require 'PipedrivePUT/files'
15
16
 
16
17
  require 'json'
17
18
  require 'open-uri'
@@ -0,0 +1,22 @@
1
+ module PipedrivePUT
2
+ class Files
3
+ include PipedrivePUT
4
+
5
+ def self.getAllFiles
6
+ base = "https://api.pipedrive.com/v1/files?start=0&sort=file_name&api_token=#{@@key}"
7
+ content = open(base).read
8
+ JSON.parse(content)
9
+ end
10
+
11
+ def self.downloadFile(file_id)
12
+ file = "https://api.pipedrive.com/v1/files/#{file_id}/download?api_token=#{@@key}"
13
+ base = "https://api.pipedrive.com/v1/files/#{file_id}?api_token=#{@@key}"
14
+ content = open(base).read
15
+ p_data = JSON.parse(content)
16
+ file_name = p_data['data']['file_name']
17
+ open(file_name, 'wb') do |d_file|
18
+ d_file << open(file).read
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,11 @@
1
+ module PipedrivePUT
2
+ class Filters
3
+ include PipedrivePUT
4
+
5
+ def self.getFilters
6
+ base = "https://api.pipedrive.com/v1/filters?api_token=#{@@key}"
7
+ content = open(base).read
8
+ JSON.parse(content)
9
+ end
10
+ end
11
+ end
@@ -72,15 +72,12 @@ require 'rest-client'
72
72
  def self.findOrganizationByName(name, options = {})
73
73
  params = {}
74
74
 
75
+ params[:term] = name if name && !name.empty?
75
76
  params[:start] = options.fetch(:start, 0)
76
77
  params[:limit] = options.fetch(:limit, 500)
77
78
  params[:api_token] = @@key.to_s
78
79
 
79
- url = "https://api.pipedrive.com/v1/organizations/find?term=#{name}"
80
-
81
- params.each do |key, value|
82
- url << "&#{key}=#{value}"
83
- end
80
+ url = "https://api.pipedrive.com/v1/organizations/find?#{URI.encode_www_form(params)}"
84
81
 
85
82
  begin
86
83
  table = []
@@ -85,23 +85,19 @@ module PipedrivePUT
85
85
  params = {}
86
86
 
87
87
  # optional search parameters
88
+ params[:term] = term if term && !term.empty?
88
89
  params[:start] = options.fetch(:start, 0)
89
90
  params[:org_id] = options.fetch(:org_id, nil) if params[:org_id]
90
91
  params[:limit] = options.fetch(:limit, 500)
91
92
  params[:search_by_email] = options.fetch(:search_by_email, 0)
92
93
  params[:api_token] = @@key.to_s
93
94
 
94
- url = "https://api.pipedrive.com/v1/persons/find?term=#{term}"
95
-
96
- params.each do |key, value|
97
- url << "&#{key}=#{value}"
98
- end
95
+ url = "https://api.pipedrive.com/v1/persons/find?#{URI.encode_www_form(params)}"
99
96
 
100
97
  while more_items == true
101
98
  count = 0
102
99
 
103
- content = open(url).read
104
- parsed = JSON.parse(content)
100
+ parsed = HTTParty.get(url)
105
101
  return table if parsed['data'].nil?
106
102
 
107
103
  while count < parsed['data'].size
@@ -1,3 +1,3 @@
1
1
  module PipedrivePUT
2
- VERSION = "1.1.36"
2
+ VERSION = "1.1.38"
3
3
  end
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.36
4
+ version: 1.1.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - JakePens71
@@ -137,9 +137,9 @@ dependencies:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
139
  version: 0.7.0
140
- description: "Pipedrive gem support for activites, activity-types, deals, deal fields,organizations,
141
- organization fields, persons, pipelines, \nrecents, search, users, and a bonus addition
142
- a currency exchange calculator."
140
+ description: Pipedrive gem support for activites, activity-types, deals, deal fields,organizations,
141
+ organization fields, persons, pipelines, recents, search, users, and a bonus addition
142
+ a currency exchange calculator.
143
143
  email:
144
144
  - jake_ps@comcast.net
145
145
  - jrsnow8921@pennunited.com
@@ -156,6 +156,8 @@ files:
156
156
  - lib/PipedrivePUT/currencies.rb
157
157
  - lib/PipedrivePUT/deal.rb
158
158
  - lib/PipedrivePUT/deal_fields.rb
159
+ - lib/PipedrivePUT/files.rb
160
+ - lib/PipedrivePUT/filters.rb
159
161
  - lib/PipedrivePUT/organization.rb
160
162
  - lib/PipedrivePUT/organization_field.rb
161
163
  - lib/PipedrivePUT/persons.rb