pipedrive-connect 1.2.13 → 1.2.14
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -0
- data/bin/console +15 -4
- data/lib/pipedrive/fields.rb +13 -1
- data/lib/pipedrive/resource.rb +3 -3
- data/lib/pipedrive/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdbad8b1fea466decfba502bd303d1dbd80e71bd9902baaaaa5f94ac53466bee
|
4
|
+
data.tar.gz: 4de6d7d9e2f791a993cdfe3bc6d678379b7009b13e684a87389aa6ebbcfa1e37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bc678ae0f3aacea13f25f0af9426b88d27c13563ad89cdbf8cb934b32687bcc0b3316749ff0c14417e252553dd887b7bf00ad6a1cd26db5273d5a9d3c3460a7
|
7
|
+
data.tar.gz: b89e76e137037be243b0403a5bce4a2809db8cd5054b07177fd4fffba56f6954ee3726f282a32dc4a6b8290ea9df36243d6a32db8530741e222a7670c28c043e
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ This file contains all notable changes to this project.
|
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
|
6
6
|
|
7
|
+
## [1.2.14] - 2023-01-31
|
8
|
+
|
9
|
+
- The codebase paginates until fetching all the fields so the diccionary of custom fields is complete (checkout `lib/pipedrive/fields` for more info)
|
10
|
+
|
7
11
|
## [1.2.13] - 2022-12-08
|
8
12
|
|
9
13
|
- Update `LeadLabel` resource to use _PATCH_ method (as according to the API doc)
|
data/Gemfile
CHANGED
data/bin/console
CHANGED
@@ -4,13 +4,24 @@
|
|
4
4
|
|
5
5
|
require "bundler/setup"
|
6
6
|
require "pipedrive"
|
7
|
+
require "pry"
|
8
|
+
require "irb"
|
7
9
|
|
8
10
|
# You can add fixtures and/or initialization code here to make experimenting
|
9
11
|
# with your gem easier. You can also use a different console, if you like.
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
#
|
13
|
+
def reload!(print = true)
|
14
|
+
puts "Reloading ..." if print
|
15
|
+
# Main project directory.
|
16
|
+
root_dir = File.expand_path("..", __dir__)
|
17
|
+
# Directories within the project that should be reloaded.
|
18
|
+
reload_dirs = %w[lib]
|
19
|
+
# Loop through and reload every file in all relevant project directories.
|
20
|
+
reload_dirs.each do |dir|
|
21
|
+
Dir.glob("#{root_dir}/#{dir}/**/*.rb").each { |f| load(f) }
|
22
|
+
end
|
23
|
+
# Return true when complete.
|
24
|
+
true
|
25
|
+
end
|
14
26
|
|
15
|
-
require "irb"
|
16
27
|
IRB.start(__FILE__)
|
data/lib/pipedrive/fields.rb
CHANGED
@@ -12,7 +12,19 @@ module Pipedrive
|
|
12
12
|
module ClassMethods
|
13
13
|
def fields
|
14
14
|
url = fields_url || "#{class_name.downcase}Fields"
|
15
|
-
|
15
|
+
|
16
|
+
data = []
|
17
|
+
start = 0
|
18
|
+
request_more_fields = true
|
19
|
+
|
20
|
+
while request_more_fields
|
21
|
+
response = request(:get, url, start: start)
|
22
|
+
data.concat(response.dig(:data))
|
23
|
+
# Check wether there are more fields to bring
|
24
|
+
metadata = response.dig(:additional_data, :pagination)
|
25
|
+
request_more_fields = metadata&.fetch(:more_items_in_collection, false)
|
26
|
+
start = metadata[:next_start] if request_more_fields
|
27
|
+
end
|
16
28
|
# return a hash prefilled with
|
17
29
|
# the fields hash and name parameterized
|
18
30
|
# and the original array of fields (schema)
|
data/lib/pipedrive/resource.rb
CHANGED
@@ -10,7 +10,7 @@ module Pipedrive
|
|
10
10
|
class << self
|
11
11
|
attr_accessor :resources_url
|
12
12
|
|
13
|
-
def update_method(method_override=nil)
|
13
|
+
def update_method(method_override = nil)
|
14
14
|
@update_method ||= method_override
|
15
15
|
end
|
16
16
|
|
@@ -78,8 +78,8 @@ module Pipedrive
|
|
78
78
|
class_name = "::Pipedrive::#{class_name}" unless class_name.include?("Pipedrive")
|
79
79
|
define_method(resource_name) do |params = {}|
|
80
80
|
response = request(:get,
|
81
|
-
|
82
|
-
|
81
|
+
"#{resource_url}/#{resource_name}",
|
82
|
+
params.merge(options))
|
83
83
|
response.dig(:data)&.map do |data|
|
84
84
|
class_name_as_sym = class_name_lower_case.to_sym
|
85
85
|
data[:metadata] = data
|
data/lib/pipedrive/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pipedrive-connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Get on Board
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|