pipedrive-connect 1.3.1 → 2.0.1
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 +2 -0
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +12 -1
- data/Gemfile +1 -0
- data/README.md +47 -1
- data/bin/console +1 -0
- data/lib/pipedrive/api_operations/request.rb +25 -2
- data/lib/pipedrive/errors.rb +3 -3
- data/lib/pipedrive/merge.rb +7 -4
- data/lib/pipedrive/resources/activity.rb +4 -0
- data/lib/pipedrive/resources/deal.rb +4 -0
- data/lib/pipedrive/resources/product.rb +4 -0
- data/lib/pipedrive/version.rb +1 -1
- data/lib/pipedrive.rb +20 -2
- data/pipedrive-connect.gemspec +12 -12
- metadata +6 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 131444c95f6ebc0388e1bbc98d1a9e3b6093a18e4c66d3e97865a05bc68b3a78
|
4
|
+
data.tar.gz: 3ac8c7f3a256c9c7cc0c0bf2e2bd13d272f1ee89d556b4e549e8593762451f6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d66f1e1446e979020acd1216ef46a6a90e2910248a52fecaf62371adf79fd5af22c0d95e26f7b576a02c63a395289b684f246b4657278d321f0e01d82981593
|
7
|
+
data.tar.gz: 6a993a356288b5d470d44653cc646942b9485d9e9fb21b955204c7347acb84854cfb840e4971bc4df254160ff8bb30a4a93e854aedbac9fc10838d5ab3b598e9
|
@@ -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/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -5,9 +5,20 @@ 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.0.1] - 2025-04-17
|
9
|
+
|
10
|
+
- Fix bugs instroduced with version 2 where the base url for v1 was broken.
|
11
|
+
- Add github actions
|
12
|
+
|
13
|
+
## [2.0.0] - 2025-04-11
|
14
|
+
|
15
|
+
- **BREAKING change**: Minimum ruby version updated to 2.7.
|
16
|
+
- Added options for using new V2 API endpoints. Resource `Pipedrive::Activity` switched to new V2 endpoint.
|
17
|
+
- Documentation updates with information on V1/V2 API endpoint switching.
|
18
|
+
|
8
19
|
## [1.3.1] - 2023-06-01
|
9
20
|
|
10
|
-
- **BREAKING change
|
21
|
+
- **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).
|
11
22
|
|
12
23
|
## [1.3.0] - 2023-04-17
|
13
24
|
|
data/Gemfile
CHANGED
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.
|
@@ -53,6 +55,50 @@ require 'pipedrive'
|
|
53
55
|
Pipedrive.api_key = ENV["PIPEDRIVE_API_KEY"]
|
54
56
|
```
|
55
57
|
|
58
|
+
### Pipedrive API versions
|
59
|
+
|
60
|
+
Pipedrive has started adding new V2 endpoints to their API. You can change which API endpoint is accessed by setting up
|
61
|
+
the enpoint access on the configuration settings
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
# by default set up to use V2 api endpoints (as of version 2.0.0)
|
65
|
+
irb(main):001:0> Pipedrive.api_version
|
66
|
+
=> :v2
|
67
|
+
|
68
|
+
# use only V1 api endpoints
|
69
|
+
irb(main):005:0> Pipedrive.use_v1_api!
|
70
|
+
=> :v1
|
71
|
+
irb(main):006:0> Pipedrive.api_version
|
72
|
+
=> :v1
|
73
|
+
|
74
|
+
# change back to using V2 api endpoints
|
75
|
+
irb(main):009:0> Pipedrive.use_v2_api!
|
76
|
+
=> :v2
|
77
|
+
irb(main):010:0> Pipedrive.api_version
|
78
|
+
=> :v2
|
79
|
+
```
|
80
|
+
|
81
|
+
_Please note:_ not all resources have V2 api endpoint. For these resources the V2 setting will be ignored and the
|
82
|
+
V1 endpoints will always be used.
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
irb(main):030:0> Pipedrive.use_v2_api!
|
86
|
+
=> :v2
|
87
|
+
irb(main):031:0> Pipedrive.api_version
|
88
|
+
=> :v2
|
89
|
+
irb(main):032:0> Pipedrive::Lead.api_version
|
90
|
+
=> :v1
|
91
|
+
```
|
92
|
+
|
93
|
+
### Backwards Compatibility
|
94
|
+
|
95
|
+
To maintain backwards compatibility, you can explicitly set the API version to V1 in your application's configuration:
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
# Set to use V1 API endpoints for all resources
|
99
|
+
Pipedrive.use_v1_api!
|
100
|
+
```
|
101
|
+
|
56
102
|
### Models
|
57
103
|
|
58
104
|
Access your data in pipedrive via the models (for the complete list check out the directory `lib/pipedrive/resources`). You'll find that most of these classes are documented in the [API Reference](https://developers.pipedrive.com/docs/api/v1/).
|
@@ -116,7 +162,7 @@ product_attachment =
|
|
116
162
|
|
117
163
|
# detach a product from a deal
|
118
164
|
# Note: product attachment is not the product per se
|
119
|
-
# but the record that
|
165
|
+
# but the record that represents the attachment
|
120
166
|
deal.delete_product(product_attachment.id)
|
121
167
|
```
|
122
168
|
|
data/bin/console
CHANGED
@@ -8,12 +8,32 @@ module Pipedrive
|
|
8
8
|
end
|
9
9
|
|
10
10
|
module ClassMethods
|
11
|
+
def supports_v2_api?
|
12
|
+
# default setting, override in resources as required
|
13
|
+
false
|
14
|
+
end
|
15
|
+
|
16
|
+
def api_version
|
17
|
+
supports_v2_api? ? Pipedrive.api_version : :v1
|
18
|
+
end
|
19
|
+
|
20
|
+
def api_version_prefix
|
21
|
+
return api_version if api_version == :v1
|
22
|
+
|
23
|
+
"api/#{api_version}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def api_base_url
|
27
|
+
"#{BASE_URL}/#{api_version_prefix}"
|
28
|
+
end
|
29
|
+
|
11
30
|
def request(method, url, params = {})
|
12
31
|
check_api_key!
|
13
32
|
raise "Not supported method" \
|
14
33
|
unless %i[get post put patch delete].include?(method)
|
15
34
|
|
16
35
|
Util.debug "#{name} #{method.upcase} #{url}"
|
36
|
+
|
17
37
|
response = api_client.send(method) do |req|
|
18
38
|
req.url url
|
19
39
|
req.params = { api_token: Pipedrive.api_key }
|
@@ -23,18 +43,21 @@ module Pipedrive
|
|
23
43
|
req.params.merge!(params)
|
24
44
|
end
|
25
45
|
end
|
46
|
+
|
26
47
|
Util.serialize_response(response)
|
27
48
|
end
|
28
49
|
|
29
50
|
def api_client
|
30
51
|
@api_client = Faraday.new(
|
31
|
-
url:
|
52
|
+
url: api_base_url,
|
32
53
|
headers: { "Content-Type": "application/json" }
|
33
54
|
) do |faraday|
|
34
55
|
if Pipedrive.debug_http
|
35
56
|
faraday.response :logger, Pipedrive.logger,
|
36
|
-
bodies:
|
57
|
+
bodies: Pipedrive.debug_http_body
|
37
58
|
end
|
59
|
+
|
60
|
+
faraday.adapter Pipedrive.faraday_adapter
|
38
61
|
end
|
39
62
|
end
|
40
63
|
|
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/merge.rb
CHANGED
@@ -5,10 +5,13 @@ module Pipedrive
|
|
5
5
|
def merge(with_id:)
|
6
6
|
raise "with_id must be an integer" unless with_id&.is_a?(Integer)
|
7
7
|
|
8
|
-
response = request(
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
response = request(
|
9
|
+
:put,
|
10
|
+
"#{resource_url}/merge",
|
11
|
+
merge_with_id: with_id
|
12
|
+
)
|
13
|
+
|
14
|
+
self.class.new(response[:data])
|
12
15
|
end
|
13
16
|
end
|
14
17
|
end
|
data/lib/pipedrive/version.rb
CHANGED
data/lib/pipedrive.rb
CHANGED
@@ -24,7 +24,7 @@ require "pipedrive/merge"
|
|
24
24
|
require "pipedrive/resources"
|
25
25
|
|
26
26
|
module Pipedrive
|
27
|
-
BASE_URL = "https://api.pipedrive.com
|
27
|
+
BASE_URL = "https://api.pipedrive.com"
|
28
28
|
|
29
29
|
class << self
|
30
30
|
attr_accessor :api_key,
|
@@ -33,7 +33,25 @@ module Pipedrive
|
|
33
33
|
:debug_http,
|
34
34
|
:debug_http_body,
|
35
35
|
:treat_no_content_as_not_found
|
36
|
+
|
37
|
+
attr_writer :faraday_adapter
|
38
|
+
|
39
|
+
def use_v2_api!
|
40
|
+
@api_version = :v2
|
41
|
+
end
|
42
|
+
|
43
|
+
def use_v1_api!
|
44
|
+
@api_version = :v1
|
45
|
+
end
|
46
|
+
|
47
|
+
def api_version
|
48
|
+
@api_version || :v2
|
49
|
+
end
|
50
|
+
|
51
|
+
def faraday_adapter
|
52
|
+
@faraday_adapter || :net_http
|
53
|
+
end
|
36
54
|
end
|
37
55
|
|
38
|
-
@logger = Logger.new(
|
56
|
+
@logger = Logger.new($stdout)
|
39
57
|
end
|
data/pipedrive-connect.gemspec
CHANGED
@@ -1,23 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
$LOAD_PATH.unshift(
|
3
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib"))
|
4
4
|
|
5
5
|
require "pipedrive/version"
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name
|
9
|
-
spec.version
|
10
|
-
spec.authors
|
11
|
-
spec.email
|
8
|
+
spec.name = "pipedrive-connect"
|
9
|
+
spec.version = Pipedrive::VERSION
|
10
|
+
spec.authors = "Get on Board"
|
11
|
+
spec.email = "team@getonbrd.com"
|
12
|
+
spec.summary = "Ruby binding for the pipedrive API."
|
13
|
+
spec.homepage = "https://github.com/getonbrd/pipedrive-connect"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
12
16
|
|
13
|
-
spec.
|
14
|
-
spec.homepage = "https://github.com/getonbrd/pipedrive-connect"
|
15
|
-
spec.license = "MIT"
|
16
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
17
|
-
|
18
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
18
|
spec.metadata["source_code_uri"] = "https://github.com/getonbrd/pipedrive-connect"
|
20
|
-
spec.metadata["changelog_uri"]
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/getonbrd/pipedrive-connect/CHANGELOG.md"
|
21
20
|
|
22
21
|
# Specify which files should be added to the gem when it is released.
|
23
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -30,4 +29,5 @@ Gem::Specification.new do |spec|
|
|
30
29
|
|
31
30
|
# dependencies
|
32
31
|
spec.add_dependency("faraday", "< 3")
|
32
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
33
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pipedrive-connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Get on Board
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-04-18 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: faraday
|
@@ -24,12 +23,12 @@ dependencies:
|
|
24
23
|
- - "<"
|
25
24
|
- !ruby/object:Gem::Version
|
26
25
|
version: '3'
|
27
|
-
description:
|
28
26
|
email: team@getonbrd.com
|
29
27
|
executables: []
|
30
28
|
extensions: []
|
31
29
|
extra_rdoc_files: []
|
32
30
|
files:
|
31
|
+
- ".github/workflows/ci.yml"
|
33
32
|
- ".gitignore"
|
34
33
|
- ".rspec"
|
35
34
|
- ".rubocop.yml"
|
@@ -86,7 +85,7 @@ metadata:
|
|
86
85
|
homepage_uri: https://github.com/getonbrd/pipedrive-connect
|
87
86
|
source_code_uri: https://github.com/getonbrd/pipedrive-connect
|
88
87
|
changelog_uri: https://github.com/getonbrd/pipedrive-connect/CHANGELOG.md
|
89
|
-
|
88
|
+
rubygems_mfa_required: 'true'
|
90
89
|
rdoc_options: []
|
91
90
|
require_paths:
|
92
91
|
- lib
|
@@ -94,15 +93,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
93
|
requirements:
|
95
94
|
- - ">="
|
96
95
|
- !ruby/object:Gem::Version
|
97
|
-
version: 2.
|
96
|
+
version: 2.7.0
|
98
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
98
|
requirements:
|
100
99
|
- - ">="
|
101
100
|
- !ruby/object:Gem::Version
|
102
101
|
version: '0'
|
103
102
|
requirements: []
|
104
|
-
rubygems_version: 3.
|
105
|
-
signing_key:
|
103
|
+
rubygems_version: 3.6.2
|
106
104
|
specification_version: 4
|
107
105
|
summary: Ruby binding for the pipedrive API.
|
108
106
|
test_files: []
|