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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35988325b69c627a5892597bc7a2f1b0a25d0e30f4ceb34390ba8479e70f299b
4
- data.tar.gz: 5fe78e92cdc521ee89a9ef102b12e22ee5b48e5aaf4314b8bb93fe80830b81be
3
+ metadata.gz: fdbad8b1fea466decfba502bd303d1dbd80e71bd9902baaaaa5f94ac53466bee
4
+ data.tar.gz: 4de6d7d9e2f791a993cdfe3bc6d678379b7009b13e684a87389aa6ebbcfa1e37
5
5
  SHA512:
6
- metadata.gz: 636f0f99a7a2a32a33bad658b060867c703df03af930a97dda717bd019cbd1115b1ffc8a08aaa8d1c2936861066436e3310429a9a3a061f17cd3d9935523bb39
7
- data.tar.gz: 481e86ad08a91796abe0f3a52e6b90d509e6beae87a1686867391bd792028c4208d5f56bdf5f492266bfc0ad5ee02b044ef992fbf555ce23982d46c29530f684
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
@@ -7,6 +7,7 @@ gemspec
7
7
  group :development do
8
8
  gem "byebug"
9
9
  gem "mocha"
10
+ gem "pry"
10
11
  gem "rspec"
11
12
  gem "rubocop"
12
13
  gem "simplecov", require: false
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
- # (If you use this, don't forget to add pry to your Gemfile!)
12
- # require "pry"
13
- # Pry.start
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__)
@@ -12,7 +12,19 @@ module Pipedrive
12
12
  module ClassMethods
13
13
  def fields
14
14
  url = fields_url || "#{class_name.downcase}Fields"
15
- data = request(:get, url).dig(:data)
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)
@@ -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
- "#{resource_url}/#{resource_name}",
82
- params.merge(options))
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pipedrive
4
- VERSION = "1.2.13"
4
+ VERSION = "1.2.14"
5
5
  end
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.13
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: 2022-12-08 00:00:00.000000000 Z
11
+ date: 2023-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday