pipedrive-connect 2.0.0 → 2.1.0
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/.github/workflows/ci.yml +27 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +17 -0
- data/README.md +4 -1
- data/lib/pipedrive/api_operations/request.rb +12 -1
- data/lib/pipedrive/errors.rb +3 -3
- data/lib/pipedrive/fields.rb +33 -1
- data/lib/pipedrive/resources/activity.rb +5 -0
- data/lib/pipedrive/version.rb +1 -1
- data/lib/pipedrive.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b59e1ddcf850e86b6ab8ddfc384c83d86b55839b9518ea482190f1685a9d0f4a
|
4
|
+
data.tar.gz: 19715830d980662d719712275641380c818322c06f919b6b6924feda0dada118
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8aaf434d1b15bae2de6608c1baada88ae3cd4010c29f633dcfe28804958a5b6a9356a68f92af392e7bf5bf023659e748c1d19281c34fb45d13583e22253740b
|
7
|
+
data.tar.gz: 7b9318cee4b94c8b352a7767e8ba6d96c021836f44321ea2d69fcc88beebf1b54533c992669ee8b4d4cf2b6add603c8d15e3ed371e3c3554355f81e7ccbe44df
|
@@ -0,0 +1,27 @@
|
|
1
|
+
name: Run tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
push:
|
6
|
+
branches: [master]
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
run-rspec-tests:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
ruby-version: [2.7, 3.4]
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- name: Checkout code
|
17
|
+
uses: actions/checkout@v4
|
18
|
+
|
19
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby-version }}
|
23
|
+
bundler-cache: true
|
24
|
+
|
25
|
+
- name: Run tests
|
26
|
+
run: |
|
27
|
+
bundle exec rspec
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -5,10 +5,27 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
6
6
|
This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
|
7
7
|
|
8
|
+
## [2.1.0] - 2025-08-06
|
9
|
+
|
10
|
+
### Added
|
11
|
+
- New `use_fields_version` method in Fields module to override API version specifically for fields operations
|
12
|
+
- Fields-specific version override functionality that allows resources to use different API versions for fields vs general operations
|
13
|
+
- `fields_api_version` method to query the fields-specific API version
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
- Activity resource now uses `use_fields_version :v1` instead of `use_version :v1` to override version only for fields operations
|
17
|
+
- Activity general operations now use v2 API while fields operations continue to use v1 API as required by Pipedrive
|
18
|
+
|
19
|
+
## [2.0.1] - 2025-04-17
|
20
|
+
|
21
|
+
- Fix bugs introduced with version 2 where the base URL for v1 was broken.
|
22
|
+
- Add GitHub Actions workflow
|
8
23
|
## [2.0.0] - 2025-04-11
|
24
|
+
|
9
25
|
- **BREAKING change**: Minimum ruby version updated to 2.7.
|
10
26
|
- Added options for using new V2 API endpoints. Resource `Pipedrive::Activity` switched to new V2 endpoint.
|
11
27
|
- Documentation updates with information on V1/V2 API endpoint switching.
|
28
|
+
|
12
29
|
## [1.3.1] - 2023-06-01
|
13
30
|
|
14
31
|
- **BREAKING change**: Generated `delete_*` method has been refactored to receive the `id` of the record to be dettached or deleted - instead of the resource per se -, for instance: `deal.delete_product(attached_product_id)`. This is because the API behaves different depending on the endpoint, like in case of `#DELETE /deals/{id}/products/{product_attachment_id}` that receives an id corresponding to the attachment id (not a product, but a different record).
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[](https://github.com/getonbrd/pipedrive-connect/actions/workflows/ci.yml)
|
2
|
+
|
1
3
|
# Pipedrive API Ruby library
|
2
4
|
|
3
5
|
Pipedrive::Connect provides a convenient access to the Pipedrive API from applications written in the Ruby language.
|
@@ -75,7 +77,8 @@ irb(main):009:0> Pipedrive.use_v2_api!
|
|
75
77
|
irb(main):010:0> Pipedrive.api_version
|
76
78
|
=> :v2
|
77
79
|
```
|
78
|
-
|
80
|
+
|
81
|
+
_Please note:_ not all resources have V2 api endpoint. For these resources the V2 setting will be ignored and the
|
79
82
|
V1 endpoints will always be used.
|
80
83
|
|
81
84
|
```ruby
|
@@ -17,6 +17,17 @@ module Pipedrive
|
|
17
17
|
supports_v2_api? ? Pipedrive.api_version : :v1
|
18
18
|
end
|
19
19
|
|
20
|
+
def api_version_prefix
|
21
|
+
# Version 1 endpoints don't use the '/api/' prefix
|
22
|
+
return api_version if api_version == :v1
|
23
|
+
|
24
|
+
"api/#{api_version}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def api_base_url
|
28
|
+
"#{BASE_URL}/#{api_version_prefix}"
|
29
|
+
end
|
30
|
+
|
20
31
|
def request(method, url, params = {})
|
21
32
|
check_api_key!
|
22
33
|
raise "Not supported method" \
|
@@ -39,7 +50,7 @@ module Pipedrive
|
|
39
50
|
|
40
51
|
def api_client
|
41
52
|
@api_client = Faraday.new(
|
42
|
-
url:
|
53
|
+
url: api_base_url,
|
43
54
|
headers: { "Content-Type": "application/json" }
|
44
55
|
) do |faraday|
|
45
56
|
if Pipedrive.debug_http
|
data/lib/pipedrive/errors.rb
CHANGED
@@ -61,9 +61,9 @@ module Pipedrive
|
|
61
61
|
|
62
62
|
error_data =
|
63
63
|
response
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
.fetch(:data, {})
|
65
|
+
.inspect
|
66
|
+
.concat(response.fetch(:additional_data, {}).inspect)
|
67
67
|
|
68
68
|
error_class = ERROR_CLASS_MAP[status.to_s]
|
69
69
|
raise error_class.new(message, status, error_data) if error_class
|
data/lib/pipedrive/fields.rb
CHANGED
@@ -10,6 +10,24 @@ module Pipedrive
|
|
10
10
|
end
|
11
11
|
|
12
12
|
module ClassMethods
|
13
|
+
# Set version specifically for fields operations
|
14
|
+
def use_fields_version(version)
|
15
|
+
@fields_version = version
|
16
|
+
end
|
17
|
+
|
18
|
+
# override the default version with the one provided
|
19
|
+
def api_version
|
20
|
+
return @version if @version
|
21
|
+
|
22
|
+
# Fall back to original Request module logic if no version override
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
# Fields-specific API version
|
27
|
+
def fields_api_version
|
28
|
+
@fields_version || api_version
|
29
|
+
end
|
30
|
+
|
13
31
|
def fields
|
14
32
|
url = fields_url || "#{class_name.downcase}Fields"
|
15
33
|
|
@@ -18,7 +36,7 @@ module Pipedrive
|
|
18
36
|
request_more_fields = true
|
19
37
|
|
20
38
|
while request_more_fields
|
21
|
-
response =
|
39
|
+
response = fields_request(:get, url, start: start)
|
22
40
|
data.concat(response.dig(:data))
|
23
41
|
# Check wether there are more fields to bring
|
24
42
|
metadata = response.dig(:additional_data, :pagination)
|
@@ -40,6 +58,20 @@ module Pipedrive
|
|
40
58
|
end
|
41
59
|
[dicc, data]
|
42
60
|
end
|
61
|
+
|
62
|
+
# Fields-specific request method that uses fields_api_version
|
63
|
+
private def fields_request(method, url, params = {})
|
64
|
+
# Temporarily override the api_version for this request
|
65
|
+
original_version = @version
|
66
|
+
@version = @fields_version if @fields_version
|
67
|
+
|
68
|
+
begin
|
69
|
+
request(method, url, params)
|
70
|
+
ensure
|
71
|
+
# Restore original version
|
72
|
+
@version = original_version
|
73
|
+
end
|
74
|
+
end
|
43
75
|
end
|
44
76
|
|
45
77
|
def fields
|
@@ -3,6 +3,11 @@
|
|
3
3
|
module Pipedrive
|
4
4
|
class Activity < Resource
|
5
5
|
include Fields
|
6
|
+
|
7
|
+
# fields are only available in v1
|
8
|
+
# https://developers.pipedrive.com/docs/api/v1/ActivityFields#getActivityFields
|
9
|
+
use_fields_version :v1
|
10
|
+
|
6
11
|
self.resources_url = "activities"
|
7
12
|
|
8
13
|
def self.supports_v2_api?
|
data/lib/pipedrive/version.rb
CHANGED
data/lib/pipedrive.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: 2.
|
4
|
+
version: 2.1.0
|
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: 2025-
|
11
|
+
date: 2025-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -30,6 +30,7 @@ executables: []
|
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
|
+
- ".github/workflows/ci.yml"
|
33
34
|
- ".gitignore"
|
34
35
|
- ".rspec"
|
35
36
|
- ".rubocop.yml"
|
@@ -102,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
103
|
- !ruby/object:Gem::Version
|
103
104
|
version: '0'
|
104
105
|
requirements: []
|
105
|
-
rubygems_version: 3.
|
106
|
+
rubygems_version: 3.5.21
|
106
107
|
signing_key:
|
107
108
|
specification_version: 4
|
108
109
|
summary: Ruby binding for the pipedrive API.
|