pipedrive_api_rb 1.0.1 → 1.0.4

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: d311e681e15f101bfcf2436056a92fadbf482926e9333e63510a16d45158a296
4
- data.tar.gz: 2e6219fdbd535019c12484e3a78fba94f059b3581c74dbbfc69822c98e9111b1
3
+ metadata.gz: 1ec4d0b8d35198aa68339013a941e98cca649be485fd14b06dbc23def1c06a5b
4
+ data.tar.gz: b47eff18d36d7dc0c1affe69ef0342a006fe87cd0ae204e86cf2a801901edcc5
5
5
  SHA512:
6
- metadata.gz: 199213167d3841be6893f18a90477831ddb0c8112ed5aa35bd570810e9a4b1f2ab4ce20ffe5c5a83ba83e0f281f29ca5ddf4700da08e47e51a1f41bad7984bd1
7
- data.tar.gz: 3a78a00d1ce07d8c4d7f66aa9d075935cc69f8c78972b00583ea7d26f52c02c434fbd8a238dfb8246ff705e5c61ea597e8cd733092bf13a6368b2c28dce91a12
6
+ metadata.gz: 86ca547f5dd36061ea5bb5907ef15bcfca536e39d7da053330ea7a3f1a1d4e81f8f6e18dfba1a044fb1e875fb422c8a19a296e8d36e3410cd2f4a882aec1fe6d
7
+ data.tar.gz: 9a0fbea347fa354cb4c3544e3ea1d2bafe43a5826acf9ca55dba0c62bc066c862c6fbd08a4118860100af2945c10fa31e42c729c23f8af739562ed4183748413
data/.rubocop.yml CHANGED
@@ -103,3 +103,7 @@ Performance/StringInclude:
103
103
  Enabled: true
104
104
  RSpec/ContextWording:
105
105
  Enabled: false
106
+ RSpec/NamedSubject:
107
+ Enabled: false
108
+ RSpec/SubjectStub:
109
+ Enabled: false
@@ -8,7 +8,7 @@ module Pipedrive
8
8
  include ::Pipedrive::Utils
9
9
 
10
10
  def each(params = {}, &block)
11
- return to_enum(:each, params) unless block_given?
11
+ return to_enum(:each, params) unless block
12
12
 
13
13
  follow_pagination(:chunk, [], params, &block)
14
14
  end
@@ -8,13 +8,14 @@ module Pipedrive
8
8
  include ::Pipedrive::Operations::Delete
9
9
  include ::Pipedrive::Utils
10
10
 
11
- def find_by_name(*args, &block)
11
+ def search(*args, &block)
12
12
  params = args.extract_options!
13
13
  params[:term] ||= args[0]
14
14
  raise 'term is missing' unless params[:term]
15
- return to_enum(:find_by_name, params) unless block_given?
16
15
 
17
- follow_pagination(:make_api_call, [:get, 'find'], params, &block)
16
+ return to_enum(:search, params) unless block
17
+
18
+ follow_pagination(:make_api_call, [:get, 'search'], params, &block)
18
19
  end
19
20
  end
20
21
  end
@@ -14,7 +14,8 @@ module Pipedrive
14
14
  raise 'term is missing' unless params[:term]
15
15
 
16
16
  params[:fields] ||= args[1]
17
- return to_enum(:find_by_name, params) unless block_given?
17
+ params.delete :fields if params[:fields].blank?
18
+ return to_enum(:search, params) unless block
18
19
 
19
20
  follow_pagination(:make_api_call, [:get, 'search'], params, &block)
20
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pipedrive
4
- VERSION = '1.0.1'
4
+ VERSION = '1.0.4'
5
5
  end
data/lib/pipedrive.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'logger'
4
4
  require 'active_support/core_ext/hash'
5
+ require 'active_support/core_ext/array'
5
6
  require 'active_support/concern'
6
7
  require 'active_support/inflector'
7
8
 
@@ -41,7 +42,7 @@ module Pipedrive
41
42
  reset!
42
43
  end
43
44
 
44
- require 'pipedrive/railties' if defined?(::Rails)
45
+ require 'pipedrive/railties' if defined?(Rails)
45
46
 
46
47
  # Core
47
48
  require 'pipedrive/base'
data/pipedrive.gemspec CHANGED
@@ -16,7 +16,6 @@ Gem::Specification.new do |gem|
16
16
 
17
17
  gem.files = `git ls-files -z`.split("\x0")
18
18
  gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
20
19
  gem.require_paths = ['lib']
21
20
  gem.required_ruby_version = '>=2.5'
22
21
 
@@ -31,4 +30,5 @@ Gem::Specification.new do |gem|
31
30
  gem.add_development_dependency('rubocop-performance')
32
31
  gem.add_development_dependency('rubocop-rspec')
33
32
  gem.add_development_dependency('webmock')
33
+ gem.metadata['rubygems_mfa_required'] = 'true'
34
34
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::Activity do
5
+ RSpec.describe Pipedrive::Activity do
6
6
  subject { described_class.new('token') }
7
7
 
8
8
  describe '#entity_name' do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::ActivityType do
5
+ RSpec.describe Pipedrive::ActivityType do
6
6
  subject { described_class.new('token') }
7
7
 
8
8
  describe '#entity_name' do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::Base do
5
+ RSpec.describe Pipedrive::Base do
6
6
  subject { described_class.new('token') }
7
7
 
8
8
  describe '#entity_name' do
@@ -16,32 +16,32 @@ RSpec.describe ::Pipedrive::Base do
16
16
 
17
17
  it {
18
18
  expect(subject).to eq({
19
- url: 'https://api.pipedrive.com',
20
- headers: { accept: 'application/json', content_type: "application/json", user_agent: 'Pipedrive Ruby Client v0.3.0' }
21
- })
22
- }
23
- end
19
+ url: 'https://api.pipedrive.com',
20
+ headers: { accept: 'application/json', content_type: 'application/json', user_agent: "Pipedrive Ruby Client v#{Pipedrive::VERSION}" }
21
+ })
22
+ }
23
+ end
24
24
 
25
25
  context '::connection' do
26
26
  subject { super().connection }
27
27
 
28
- it { is_expected.to be_kind_of(::Faraday::Connection) }
28
+ it { is_expected.to be_a(Faraday::Connection) }
29
29
  end
30
30
 
31
31
  describe '#failed_response' do
32
32
  subject { super().failed_response(res) }
33
33
 
34
- let(:res) { double('res', body: ::Hashie::Mash.new({}), status: status) }
34
+ let(:res) { double('res', body: Hashie::Mash.new({}), status: status) }
35
35
 
36
36
  context 'status is 401' do
37
37
  let(:status) { 401 }
38
38
 
39
39
  it {
40
- expect(subject).to eq(::Hashie::Mash.new({
41
- failed: false,
40
+ expect(subject).to eq(Hashie::Mash.new({
41
+ failed: false,
42
42
  not_authorized: true,
43
43
  success: false
44
- }))
44
+ }))
45
45
  }
46
46
  end
47
47
 
@@ -49,11 +49,11 @@ RSpec.describe ::Pipedrive::Base do
49
49
  let(:status) { 420 }
50
50
 
51
51
  it {
52
- expect(subject).to eq(::Hashie::Mash.new({
53
- failed: true,
52
+ expect(subject).to eq(Hashie::Mash.new({
53
+ failed: true,
54
54
  not_authorized: false,
55
55
  success: false
56
- }))
56
+ }))
57
57
  }
58
58
  end
59
59
 
@@ -61,11 +61,11 @@ RSpec.describe ::Pipedrive::Base do
61
61
  let(:status) { 400 }
62
62
 
63
63
  it {
64
- expect(subject).to eq(::Hashie::Mash.new({
65
- failed: false,
64
+ expect(subject).to eq(Hashie::Mash.new({
65
+ failed: false,
66
66
  not_authorized: false,
67
67
  success: false
68
- }))
68
+ }))
69
69
  }
70
70
  end
71
71
  end
@@ -78,32 +78,32 @@ RSpec.describe ::Pipedrive::Base do
78
78
  context 'without id' do
79
79
  it 'calls :get' do
80
80
  stub_request(:get, 'https://api.pipedrive.com/v1/bases?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
81
- expect_any_instance_of(::Faraday::Connection).to receive(:get).with('/v1/bases?api_token=token', {}).and_call_original
81
+ expect_any_instance_of(Faraday::Connection).to have_received(:get).with('/v1/bases?api_token=token', {}).and_call_original
82
82
  expect(subject.make_api_call(:get))
83
83
  end
84
84
 
85
85
  it 'calls :post' do
86
86
  stub_request(:post, 'https://api.pipedrive.com/v1/bases?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
87
- expect_any_instance_of(::Faraday::Connection).to receive(:post).with('/v1/bases?api_token=token', { test: 'bar' }.to_json).and_call_original
87
+ expect_any_instance_of(Faraday::Connection).to have_received(:post).with('/v1/bases?api_token=token', { test: 'bar' }.to_json).and_call_original
88
88
  expect(subject.make_api_call(:post, test: 'bar'))
89
89
  end
90
90
 
91
91
  it 'calls :put' do
92
92
  stub_request(:put, 'https://api.pipedrive.com/v1/bases?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
93
- expect_any_instance_of(::Faraday::Connection).to receive(:put).with('/v1/bases?api_token=token', { test: 'bar' }.to_json).and_call_original
93
+ expect_any_instance_of(Faraday::Connection).to have_received(:put).with('/v1/bases?api_token=token', { test: 'bar' }.to_json).and_call_original
94
94
  expect(subject.make_api_call(:put, test: 'bar'))
95
95
  end
96
96
 
97
97
  it 'uses field_selector properly' do
98
98
  stub_request(:get, 'https://api.pipedrive.com/v1/bases:(a,b,c)?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
99
- expect_any_instance_of(::Faraday::Connection).to receive(:get)
99
+ expect_any_instance_of(Faraday::Connection).to have_received(:get)
100
100
  .with('/v1/bases:(a,b,c)?api_token=token', {}).and_call_original
101
101
  expect(subject.make_api_call(:get, fields_to_select: %w[a b c]))
102
102
  end
103
103
 
104
104
  it 'does not use field_selector if it empty' do
105
105
  stub_request(:get, 'https://api.pipedrive.com/v1/bases?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
106
- expect_any_instance_of(::Faraday::Connection).to receive(:get)
106
+ expect_any_instance_of(Faraday::Connection).to have_received(:get)
107
107
  .with('/v1/bases?api_token=token', {}).and_call_original
108
108
  expect(subject.make_api_call(:get, fields_to_select: []))
109
109
  end
@@ -111,10 +111,10 @@ RSpec.describe ::Pipedrive::Base do
111
111
  it 'retries if Errno::ETIMEDOUT' do
112
112
  stub_request(:get, 'https://api.pipedrive.com/v1/bases?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
113
113
  connection = subject.connection
114
- allow(subject).to receive(:connection).and_return(connection)
115
- allow(connection).to receive(:get)
114
+ allow(subject).to have_received(:connection).and_return(connection)
115
+ allow(connection).to have_received(:get)
116
116
  .with('/v1/bases?api_token=token', {}).and_raise(Errno::ETIMEDOUT)
117
- expect(connection).to receive(:get)
117
+ expect(connection).to have_received(:get)
118
118
  .with('/v1/bases?api_token=token', {}).and_call_original
119
119
  expect(subject.make_api_call(:get, fields_to_select: []))
120
120
  end
@@ -123,32 +123,32 @@ RSpec.describe ::Pipedrive::Base do
123
123
  context 'with id' do
124
124
  it 'calls :get' do
125
125
  stub_request(:get, 'https://api.pipedrive.com/v1/bases/12?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
126
- expect_any_instance_of(::Faraday::Connection).to receive(:get).with('/v1/bases/12?api_token=token', {}).and_call_original
126
+ expect_any_instance_of(Faraday::Connection).to have_received(:get).with('/v1/bases/12?api_token=token', {}).and_call_original
127
127
  expect(subject.make_api_call(:get, 12))
128
128
  end
129
129
 
130
130
  it 'calls :post' do
131
131
  stub_request(:post, 'https://api.pipedrive.com/v1/bases/13?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
132
- expect_any_instance_of(::Faraday::Connection).to receive(:post).with('/v1/bases/13?api_token=token', { test: 'bar' }.to_json).and_call_original
132
+ expect_any_instance_of(Faraday::Connection).to have_received(:post).with('/v1/bases/13?api_token=token', { test: 'bar' }.to_json).and_call_original
133
133
  expect(subject.make_api_call(:post, 13, test: 'bar'))
134
134
  end
135
135
 
136
136
  it 'calls :put' do
137
137
  stub_request(:put, 'https://api.pipedrive.com/v1/bases/14?api_token=token').to_return(status: 200, body: {}.to_json, headers: {})
138
- expect_any_instance_of(::Faraday::Connection).to receive(:put).with('/v1/bases/14?api_token=token', { test: 'bar' }.to_json).and_call_original
138
+ expect_any_instance_of(Faraday::Connection).to have_received(:put).with('/v1/bases/14?api_token=token', { test: 'bar' }.to_json).and_call_original
139
139
  expect(subject.make_api_call(:put, 14, test: 'bar'))
140
140
  end
141
141
  end
142
142
 
143
143
  it 'calls Hashie::Mash if return empty string' do
144
144
  stub_request(:get, 'https://api.pipedrive.com/v1/bases?api_token=token').to_return(status: 200, body: '', headers: {})
145
- expect(::Hashie::Mash).to receive(:new).with(success: true).and_call_original
145
+ expect(Hashie::Mash).to have_received(:new).with(success: true).and_call_original
146
146
  expect(subject.make_api_call(:get))
147
147
  end
148
148
 
149
149
  it 'calls #failed_response if failed status' do
150
150
  stub_request(:get, 'https://api.pipedrive.com/v1/bases?api_token=token').to_return(status: 400, body: '', headers: {})
151
- expect(subject).to receive(:failed_response)
151
+ expect(subject).to have_received(:failed_response)
152
152
  expect(subject.make_api_call(:get))
153
153
  end
154
154
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::DealField do
5
+ RSpec.describe Pipedrive::DealField do
6
6
  subject { described_class.new('token') }
7
7
 
8
8
  describe '#entity_name' do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::Deal do
5
+ RSpec.describe Pipedrive::Deal do
6
6
  subject { described_class.new('token') }
7
7
 
8
8
  describe '#entity_name' do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::File do
5
+ RSpec.describe Pipedrive::File do
6
6
  subject { described_class.new('token') }
7
7
 
8
8
  describe '#entity_name' do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::Filter do
5
+ RSpec.describe Pipedrive::Filter do
6
6
  subject { described_class.new('token') }
7
7
 
8
8
  describe '#entity_name' do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::Goal do
5
+ RSpec.describe Pipedrive::Goal do
6
6
  subject { described_class.new('token') }
7
7
 
8
8
  describe '#entity_name' do
@@ -1,9 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- RSpec.describe ::Pipedrive::LeadLabel do
3
+ RSpec.describe Pipedrive::LeadLabel do
4
4
  subject { described_class.new('token') }
5
- context '#entity_name' do
5
+
6
+ describe '#entity_name' do
6
7
  subject { super().entity_name }
8
+
7
9
  it { is_expected.to eq('leadLabels') }
8
10
  end
9
11
  end
@@ -1,9 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- RSpec.describe ::Pipedrive::Lead do
3
+ RSpec.describe Pipedrive::Lead do
4
4
  subject { described_class.new('token') }
5
- context '#entity_name' do
5
+
6
+ describe '#entity_name' do
6
7
  subject { super().entity_name }
8
+
7
9
  it { is_expected.to eq('leads') }
8
10
  end
9
11
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::Note do
5
+ RSpec.describe Pipedrive::Note do
6
6
  subject { described_class.new('token') }
7
7
 
8
8
  describe '#entity_name' do
@@ -2,16 +2,16 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::Operations::Create do
5
+ RSpec.describe Pipedrive::Operations::Create do
6
6
  subject do
7
- Class.new(::Pipedrive::Base) do
8
- include ::Pipedrive::Operations::Create
7
+ Class.new(Pipedrive::Base) do
8
+ include Pipedrive::Operations::Create
9
9
  end.new('token')
10
10
  end
11
11
 
12
12
  describe '#create' do
13
13
  it 'calls #make_api_call' do
14
- expect(subject).to receive(:make_api_call).with(:post, { foo: 'bar' })
14
+ expect(subject).to have_received(:make_api_call).with(:post, { foo: 'bar' })
15
15
  subject.create(foo: 'bar')
16
16
  end
17
17
  end
@@ -2,23 +2,23 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::Operations::Delete do
5
+ RSpec.describe Pipedrive::Operations::Delete do
6
6
  subject do
7
- Class.new(::Pipedrive::Base) do
8
- include ::Pipedrive::Operations::Delete
7
+ Class.new(Pipedrive::Base) do
8
+ include Pipedrive::Operations::Delete
9
9
  end.new('token')
10
10
  end
11
11
 
12
12
  describe '#delete' do
13
13
  it 'calls #make_api_call' do
14
- expect(subject).to receive(:make_api_call).with(:delete, 12)
14
+ expect(subject).to have_received(:make_api_call).with(:delete, 12)
15
15
  subject.delete(12)
16
16
  end
17
17
  end
18
18
 
19
19
  describe '#delete_all' do
20
20
  it 'calls #make_api_call' do
21
- expect(subject).to receive(:make_api_call).with(:delete)
21
+ expect(subject).to have_received(:make_api_call).with(:delete)
22
22
  subject.delete_all
23
23
  end
24
24
  end
@@ -2,16 +2,16 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::Operations::Read do
5
+ RSpec.describe Pipedrive::Operations::Read do
6
6
  subject do
7
- Class.new(::Pipedrive::Base) do
8
- include ::Pipedrive::Operations::Read
7
+ Class.new(Pipedrive::Base) do
8
+ include Pipedrive::Operations::Read
9
9
  end.new('token')
10
10
  end
11
11
 
12
12
  describe '#find_by_id' do
13
13
  it 'calls #make_api_call' do
14
- expect(subject).to receive(:make_api_call).with(:get, 12)
14
+ expect(subject).to have_received(:make_api_call).with(:get, 12)
15
15
  subject.find_by_id(12)
16
16
  end
17
17
  end
@@ -22,32 +22,32 @@ RSpec.describe ::Pipedrive::Operations::Read do
22
22
  end
23
23
 
24
24
  it 'returns Enumerator if no block given' do
25
- expect(subject.each).to be_a(::Enumerator)
25
+ expect(subject.each).to be_a(Enumerator)
26
26
  end
27
27
 
28
28
  it 'calls to_enum with params' do
29
- expect(subject).to receive(:to_enum).with(:each, { foo: 'bar' })
29
+ expect(subject).to have_received(:to_enum).with(:each, { foo: 'bar' })
30
30
  subject.each(foo: 'bar')
31
31
  end
32
32
 
33
33
  it 'yields data' do
34
- expect(subject).to receive(:chunk).and_return(::Hashie::Mash.new(data: [1, 2], success: true))
34
+ expect(subject).to have_received(:chunk).and_return(Hashie::Mash.new(data: [1, 2], success: true))
35
35
  expect { |b| subject.each(&b) }.to yield_successive_args(1, 2)
36
36
  end
37
37
 
38
38
  it 'follows pagination' do
39
- expect(subject).to receive(:chunk).with(start: 0).and_return(::Hashie::Mash.new(data: [1, 2], success: true, additional_data: additional_data))
40
- expect(subject).to receive(:chunk).with(start: 10).and_return(::Hashie::Mash.new(data: [3, 4], success: true))
39
+ expect(subject).to have_received(:chunk).with({ start: 0 }).and_return(Hashie::Mash.new(data: [1, 2], success: true, additional_data: additional_data))
40
+ expect(subject).to have_received(:chunk).with({ start: 10 }).and_return(Hashie::Mash.new(data: [3, 4], success: true))
41
41
  expect { |b| subject.each(&b) }.to yield_successive_args(1, 2, 3, 4)
42
42
  end
43
43
 
44
44
  it 'does not yield anything if result is empty' do
45
- expect(subject).to receive(:chunk).with(start: 0).and_return(::Hashie::Mash.new(success: true))
45
+ expect(subject).to have_received(:chunk).with({ start: 0 }).and_return(Hashie::Mash.new(success: true))
46
46
  expect { |b| subject.each(&b) }.to yield_successive_args
47
47
  end
48
48
 
49
49
  it 'does not yield anything if result is not success' do
50
- expect(subject).to receive(:chunk).with(start: 0).and_return(::Hashie::Mash.new(success: false))
50
+ expect(subject).to have_received(:chunk).with({ start: 0 }).and_return(Hashie::Mash.new(success: false))
51
51
  expect { |b| subject.each(&b) }.to yield_successive_args
52
52
  end
53
53
  end
@@ -55,8 +55,8 @@ RSpec.describe ::Pipedrive::Operations::Read do
55
55
  describe '#all' do
56
56
  it 'calls #each' do
57
57
  arr = double('enumerator')
58
- allow(arr).to receive(:to_a)
59
- expect(subject).to receive(:each).and_return(arr)
58
+ allow(arr).to have_received(:to_a)
59
+ expect(subject).to have_received(:each).and_return(arr)
60
60
  subject.all
61
61
  end
62
62
  end
@@ -64,13 +64,13 @@ RSpec.describe ::Pipedrive::Operations::Read do
64
64
  describe '#chunk' do
65
65
  it 'returns []' do
66
66
  res = double('res', success?: false)
67
- expect(subject).to receive(:make_api_call).with(:get, {}).and_return(res)
67
+ expect(subject).to have_received(:make_api_call).with(:get, {}).and_return(res)
68
68
  expect(subject.chunk).to eq([])
69
69
  end
70
70
 
71
71
  it 'returns result' do
72
72
  res = double('res', success?: true)
73
- expect(subject).to receive(:make_api_call).with(:get, {}).and_return(res)
73
+ expect(subject).to have_received(:make_api_call).with(:get, {}).and_return(res)
74
74
  expect(subject.chunk).to eq(res)
75
75
  end
76
76
  end
@@ -2,21 +2,21 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::Operations::Update do
5
+ RSpec.describe Pipedrive::Operations::Update do
6
6
  subject do
7
- Class.new(::Pipedrive::Base) do
8
- include ::Pipedrive::Operations::Update
7
+ Class.new(Pipedrive::Base) do
8
+ include Pipedrive::Operations::Update
9
9
  end.new('token')
10
10
  end
11
11
 
12
12
  describe '#create' do
13
13
  it 'calls #make_api_call' do
14
- expect(subject).to receive(:make_api_call).with(:put, 12, { foo: 'bar' })
14
+ expect(subject).to have_received(:make_api_call).with(:put, 12, { foo: 'bar' })
15
15
  subject.update(12, foo: 'bar')
16
16
  end
17
17
 
18
18
  it 'calls #make_api_call with id in params' do
19
- expect(subject).to receive(:make_api_call).with(:put, 14, { foo: 'bar' })
19
+ expect(subject).to have_received(:make_api_call).with(:put, 14, { foo: 'bar' })
20
20
  subject.update(foo: 'bar', id: 14)
21
21
  end
22
22
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::OrganizationField do
5
+ RSpec.describe Pipedrive::OrganizationField do
6
6
  subject { described_class.new('token') }
7
7
 
8
8
  describe '#entity_name' do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::Organization do
5
+ RSpec.describe Pipedrive::Organization do
6
6
  subject { described_class.new('token') }
7
7
 
8
8
  describe '#entity_name' do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::PersonField do
5
+ RSpec.describe Pipedrive::PersonField do
6
6
  subject { described_class.new('token') }
7
7
 
8
8
  describe '#entity_name' do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::Person do
5
+ RSpec.describe Pipedrive::Person do
6
6
  subject { described_class.new('token') }
7
7
 
8
8
  describe '#entity_name' do
@@ -13,18 +13,18 @@ RSpec.describe ::Pipedrive::Person do
13
13
 
14
14
  describe '#search' do
15
15
  it 'calls #make_api_call with term' do
16
- expect(subject).to receive(:make_api_call).with(:get, 'search', { term: 'term', fields: nil})
16
+ expect(subject).to have_received(:make_api_call).with(:get, 'search', { term: 'term', start: 0 })
17
17
  expect { |b| subject.search('term', &b) }.to yield_successive_args
18
18
  end
19
19
 
20
20
  it 'calls #make_api_call with term and search_by_email' do
21
- expect(subject).to receive(:make_api_call).with(:get, 'search', { term: 'term', fields: "email" })
22
- expect { |b| subject.search('term', "email", &b) }.to yield_successive_args
21
+ expect(subject).to have_received(:make_api_call).with(:get, 'search', { term: 'term', fields: 'email', start: 0 })
22
+ expect { |b| subject.search('term', 'email', &b) }.to yield_successive_args
23
23
  end
24
24
 
25
25
  it 'yields results' do
26
- expect(subject).to receive(:make_api_call).with(:get, 'search', { term: 'term', fields: nil, start: 0 }).
27
- and_return(::Hashie::Mash.new(data: [1, 2], success: true))
26
+ expect(subject).to have_received(:make_api_call).with(:get, 'search', { term: 'term', start: 0 })
27
+ .and_return(Hashie::Mash.new(data: [1, 2], success: true))
28
28
  expect { |b| subject.search('term', &b) }.to yield_successive_args(1, 2)
29
29
  end
30
30
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::ProductField do
5
+ RSpec.describe Pipedrive::ProductField do
6
6
  subject { described_class.new('token') }
7
7
 
8
8
  describe '#entity_name' do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive::Product do
5
+ RSpec.describe Pipedrive::Product do
6
6
  subject { described_class.new('token') }
7
7
 
8
8
  describe '#entity_name' do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe ::Pipedrive do
5
+ RSpec.describe Pipedrive do
6
6
  subject { described_class }
7
7
 
8
8
  before do
@@ -13,7 +13,7 @@ RSpec.describe ::Pipedrive do
13
13
  describe '#user_agent' do
14
14
  subject { super().user_agent }
15
15
 
16
- it { is_expected.to eq("Pipedrive Ruby Client v#{::Pipedrive::VERSION}") }
16
+ it { is_expected.to eq("Pipedrive Ruby Client v#{Pipedrive::VERSION}") }
17
17
  end
18
18
 
19
19
  describe '#api_token' do
@@ -25,7 +25,7 @@ RSpec.describe ::Pipedrive do
25
25
  describe '#logger' do
26
26
  subject { super().logger }
27
27
 
28
- it { is_expected.to be_kind_of(::Logger) }
28
+ it { is_expected.to be_a(Logger) }
29
29
  end
30
30
  end
31
31
 
@@ -41,7 +41,7 @@ RSpec.describe ::Pipedrive do
41
41
  end
42
42
 
43
43
  it 'sets logger' do
44
- newlogger = ::Logger.new($stderr)
44
+ newlogger = Logger.new($stderr)
45
45
  client.setup do |c|
46
46
  c.logger = newlogger
47
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pipedrive_api_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Sterba
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-01-30 00:00:00.000000000 Z
12
+ date: 2023-01-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -225,12 +225,12 @@ files:
225
225
  - spec/lib/pipedrive/lead_label_spec.rb
226
226
  - spec/lib/pipedrive/lead_spec.rb
227
227
  - spec/lib/pipedrive/note_spec.rb
228
- - spec/lib/pipedrive/ogranization_spec.rb
229
228
  - spec/lib/pipedrive/operations/create_spec.rb
230
229
  - spec/lib/pipedrive/operations/delete_spec.rb
231
230
  - spec/lib/pipedrive/operations/read_spec.rb
232
231
  - spec/lib/pipedrive/operations/update_spec.rb
233
232
  - spec/lib/pipedrive/organization_field_spec.rb
233
+ - spec/lib/pipedrive/organization_spec.rb
234
234
  - spec/lib/pipedrive/person_field_spec.rb
235
235
  - spec/lib/pipedrive/person_spec.rb
236
236
  - spec/lib/pipedrive/product_field_spec.rb
@@ -240,7 +240,8 @@ files:
240
240
  homepage: https://github.com/honzasterba/pipedrive_api_rb
241
241
  licenses:
242
242
  - MIT
243
- metadata: {}
243
+ metadata:
244
+ rubygems_mfa_required: 'true'
244
245
  post_install_message:
245
246
  rdoc_options: []
246
247
  require_paths:
@@ -260,27 +261,4 @@ rubygems_version: 3.3.7
260
261
  signing_key:
261
262
  specification_version: 4
262
263
  summary: Pipedrive.com API Wrapper
263
- test_files:
264
- - spec/lib/pipedrive/activity_spec.rb
265
- - spec/lib/pipedrive/activity_type_spec.rb
266
- - spec/lib/pipedrive/base_spec.rb
267
- - spec/lib/pipedrive/deal_field_spec.rb
268
- - spec/lib/pipedrive/deal_spec.rb
269
- - spec/lib/pipedrive/file_spec.rb
270
- - spec/lib/pipedrive/filter_spec.rb
271
- - spec/lib/pipedrive/goal_spec.rb
272
- - spec/lib/pipedrive/lead_label_spec.rb
273
- - spec/lib/pipedrive/lead_spec.rb
274
- - spec/lib/pipedrive/note_spec.rb
275
- - spec/lib/pipedrive/ogranization_spec.rb
276
- - spec/lib/pipedrive/operations/create_spec.rb
277
- - spec/lib/pipedrive/operations/delete_spec.rb
278
- - spec/lib/pipedrive/operations/read_spec.rb
279
- - spec/lib/pipedrive/operations/update_spec.rb
280
- - spec/lib/pipedrive/organization_field_spec.rb
281
- - spec/lib/pipedrive/person_field_spec.rb
282
- - spec/lib/pipedrive/person_spec.rb
283
- - spec/lib/pipedrive/product_field_spec.rb
284
- - spec/lib/pipedrive/product_spec.rb
285
- - spec/lib/pipedrive_spec.rb
286
- - spec/spec_helper.rb
264
+ test_files: []