mrkt 1.2.0 → 1.2.2

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: 41d861185c2759674a5688a61bd06294e6ca18460bd1ff868df05bc3932018d5
4
- data.tar.gz: e52dac6cb6ebbba08e079634c7ca72545c358e23305feffb254e243b3b741786
3
+ metadata.gz: 49ea20abe571eedb99a4d2a1efd803804e1b97f5294aa9980909bc3da3f2a6b4
4
+ data.tar.gz: 84e3ada1633dec6b3542085ee1bb74dd6f0c936e8f5237ffd06b2be246fbff99
5
5
  SHA512:
6
- metadata.gz: 5de0d92b43516840e7e71a83253414e157e5812ba00b6bb4bdada5b665c80a06cc24e6a89aec6e01b19515e72032cc6428075adf17acf56d12b48d7caee38545
7
- data.tar.gz: 010fbf3fb5baa8f5a904c1858c938f6fd4d3f344c324b782aa1080a08343b6c7a8fd5f7f1a8c93a4c666cb361a7a2d2c9fd773a18f3bfe2ad6f39e7ce7f056c5
6
+ metadata.gz: 4d0c67f1b4428bb01be0c9e006ddaf537e77ea72acc31740329c874a183d20b3a30378cf3d0e904c76c650b53cb513bbff40317edc67e298be43ca0205c90936
7
+ data.tar.gz: f49b468b10766d46a2427d7ed9f48b76c3ba7d9b1d3a742c9cb1311dd0ae7f1bea82b7140c8fb9c30b313d01f7c824e41606d1b7914dce2bd351ec59fe13851c
@@ -4,8 +4,16 @@ updates:
4
4
  directory: "/"
5
5
  schedule:
6
6
  interval: "weekly"
7
+ commit-message:
8
+ prefix: "chore"
9
+ include: "scope"
10
+ rebase-strategy: "disabled"
7
11
 
8
12
  - package-ecosystem: "github-actions"
9
13
  directory: "/"
10
14
  schedule:
11
15
  interval: "daily"
16
+ commit-message:
17
+ prefix: "chore"
18
+ include: "scope"
19
+ rebase-strategy: "disabled"
@@ -12,10 +12,14 @@ jobs:
12
12
 
13
13
  strategy:
14
14
  matrix:
15
- ruby: [2.5, 2.6, 2.7, 3.0]
15
+ ruby: ['2.6', '2.7', '3.0', '3.1', '3.2']
16
+ gemfile: [faraday_1, faraday_2]
17
+
18
+ env:
19
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
16
20
 
17
21
  steps:
18
- - uses: actions/checkout@v2.3.4
22
+ - uses: actions/checkout@v3
19
23
 
20
24
  - name: Set up Ruby
21
25
  uses: ruby/setup-ruby@v1
@@ -33,7 +37,7 @@ jobs:
33
37
  run: bundle install
34
38
 
35
39
  - name: Run tests and publish coverage
36
- uses: paambaati/codeclimate-action@v2.7.5
40
+ uses: paambaati/codeclimate-action@v3.2.0
37
41
  env:
38
42
  COVERAGE: on
39
43
  CC_TEST_REPORTER_ID: 45cd2174f49b570406e294ff393d456c4ae8532cf16dd6430abb06d8a0722a28
data/.rubocop.yml CHANGED
@@ -1,7 +1,9 @@
1
- require: rubocop-rake
1
+ require:
2
+ - rubocop-rake
3
+ - rubocop-rspec
2
4
 
3
5
  AllCops:
4
- TargetRubyVersion: 2.5
6
+ TargetRubyVersion: 2.6
5
7
  Exclude:
6
8
  - 'bin/**/*'
7
9
  - 'vendor/**/*'
@@ -24,6 +26,7 @@ Metrics/AbcSize:
24
26
  Metrics/BlockLength:
25
27
  Exclude:
26
28
  - 'spec/**/*'
29
+ - '**/*.gemspec'
27
30
  Metrics/MethodLength:
28
31
  Max: 20
29
32
  Metrics/ParameterLists:
@@ -32,6 +35,16 @@ Metrics/ParameterLists:
32
35
  Naming/AccessorMethodName:
33
36
  Enabled: false
34
37
 
38
+ RSpec/FilePath:
39
+ Enabled: false
40
+ RSpec/NestedGroups:
41
+ Enabled: false
42
+ RSpec/MultipleMemoizedHelpers:
43
+ Enabled: false
44
+ RSpec/MultipleExpectations:
45
+ Exclude:
46
+ - 'spec/concerns/authentication_spec.rb'
47
+
35
48
  Style/ClassAndModuleChildren:
36
49
  Enabled: false
37
50
  Style/Documentation:
data/Gemfile.lock CHANGED
@@ -1,49 +1,34 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mrkt (1.2.0)
5
- faraday (~> 1.0)
6
- faraday_middleware (~> 1.0)
4
+ mrkt (1.2.2)
5
+ faraday (>= 1.10, < 3)
6
+ faraday-multipart
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.8.0)
12
- public_suffix (>= 2.0.2, < 5.0)
11
+ addressable (2.8.1)
12
+ public_suffix (>= 2.0.2, < 6.0)
13
13
  ast (2.4.2)
14
14
  byebug (11.1.3)
15
15
  coderay (1.1.3)
16
16
  crack (0.4.5)
17
17
  rexml
18
- diff-lcs (1.4.4)
19
- docile (1.3.5)
20
- faraday (1.7.1)
21
- faraday-em_http (~> 1.0)
22
- faraday-em_synchrony (~> 1.0)
23
- faraday-excon (~> 1.1)
24
- faraday-httpclient (~> 1.0.1)
25
- faraday-net_http (~> 1.0)
26
- faraday-net_http_persistent (~> 1.1)
27
- faraday-patron (~> 1.0)
28
- faraday-rack (~> 1.0)
29
- multipart-post (>= 1.2, < 3)
18
+ diff-lcs (1.5.0)
19
+ docile (1.4.0)
20
+ faraday (2.7.2)
21
+ faraday-net_http (>= 2.0, < 3.1)
30
22
  ruby2_keywords (>= 0.0.4)
31
- faraday-em_http (1.0.0)
32
- faraday-em_synchrony (1.0.0)
33
- faraday-excon (1.1.0)
34
- faraday-httpclient (1.0.1)
35
- faraday-net_http (1.0.1)
36
- faraday-net_http_persistent (1.2.0)
37
- faraday-patron (1.0.0)
38
- faraday-rack (1.0.0)
39
- faraday_middleware (1.1.0)
40
- faraday (~> 1.0)
23
+ faraday-multipart (1.0.4)
24
+ multipart-post (~> 2)
25
+ faraday-net_http (3.0.2)
41
26
  gem-release (2.2.2)
42
27
  hashdiff (1.0.1)
43
28
  method_source (1.0.0)
44
- multipart-post (2.1.1)
45
- parallel (1.20.1)
46
- parser (3.0.2.0)
29
+ multipart-post (2.2.3)
30
+ parallel (1.22.1)
31
+ parser (3.1.2.0)
47
32
  ast (~> 2.4.1)
48
33
  pry (0.13.1)
49
34
  coderay (~> 1.1)
@@ -51,47 +36,49 @@ GEM
51
36
  pry-byebug (3.9.0)
52
37
  byebug (~> 11.0)
53
38
  pry (~> 0.13.0)
54
- public_suffix (4.0.6)
55
- rainbow (3.0.0)
39
+ public_suffix (4.0.7)
40
+ rainbow (3.1.1)
56
41
  rake (13.0.6)
57
- regexp_parser (2.1.1)
42
+ regexp_parser (2.3.1)
58
43
  rexml (3.2.5)
59
- rspec (3.10.0)
60
- rspec-core (~> 3.10.0)
61
- rspec-expectations (~> 3.10.0)
62
- rspec-mocks (~> 3.10.0)
63
- rspec-core (3.10.1)
64
- rspec-support (~> 3.10.0)
65
- rspec-expectations (3.10.1)
44
+ rspec (3.12.0)
45
+ rspec-core (~> 3.12.0)
46
+ rspec-expectations (~> 3.12.0)
47
+ rspec-mocks (~> 3.12.0)
48
+ rspec-core (3.12.0)
49
+ rspec-support (~> 3.12.0)
50
+ rspec-expectations (3.12.0)
66
51
  diff-lcs (>= 1.2.0, < 2.0)
67
- rspec-support (~> 3.10.0)
68
- rspec-mocks (3.10.2)
52
+ rspec-support (~> 3.12.0)
53
+ rspec-mocks (3.12.0)
69
54
  diff-lcs (>= 1.2.0, < 2.0)
70
- rspec-support (~> 3.10.0)
71
- rspec-support (3.10.2)
72
- rubocop (1.20.0)
55
+ rspec-support (~> 3.12.0)
56
+ rspec-support (3.12.0)
57
+ rubocop (1.28.2)
73
58
  parallel (~> 1.10)
74
- parser (>= 3.0.0.0)
59
+ parser (>= 3.1.0.0)
75
60
  rainbow (>= 2.2.2, < 4.0)
76
61
  regexp_parser (>= 1.8, < 3.0)
77
62
  rexml
78
- rubocop-ast (>= 1.9.1, < 2.0)
63
+ rubocop-ast (>= 1.17.0, < 2.0)
79
64
  ruby-progressbar (~> 1.7)
80
65
  unicode-display_width (>= 1.4.0, < 3.0)
81
- rubocop-ast (1.11.0)
82
- parser (>= 3.0.1.1)
66
+ rubocop-ast (1.17.0)
67
+ parser (>= 3.1.1.0)
83
68
  rubocop-rake (0.6.0)
84
69
  rubocop (~> 1.0)
70
+ rubocop-rspec (2.10.0)
71
+ rubocop (~> 1.19)
85
72
  ruby-progressbar (1.11.0)
86
73
  ruby2_keywords (0.0.5)
87
- simplecov (0.21.2)
74
+ simplecov (0.22.0)
88
75
  docile (~> 1.1)
89
76
  simplecov-html (~> 0.11)
90
77
  simplecov_json_formatter (~> 0.1)
91
78
  simplecov-html (0.12.3)
92
- simplecov_json_formatter (0.1.3)
93
- unicode-display_width (2.0.0)
94
- webmock (3.14.0)
79
+ simplecov_json_formatter (0.1.4)
80
+ unicode-display_width (2.1.0)
81
+ webmock (3.18.1)
95
82
  addressable (>= 2.8.0)
96
83
  crack (>= 0.3.2)
97
84
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -106,9 +93,10 @@ DEPENDENCIES
106
93
  pry-byebug (~> 3.7)
107
94
  rake (~> 13.0)
108
95
  rspec (~> 3.2)
109
- rubocop (~> 1.20.0)
96
+ rubocop (~> 1.28.2)
110
97
  rubocop-rake (~> 0.6.0)
111
- simplecov (~> 0.21.2)
98
+ rubocop-rspec (~> 2.6)
99
+ simplecov (~> 0.22.0)
112
100
  webmock (~> 3.1)
113
101
 
114
102
  BUNDLED WITH
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # require v1.10 or higher.
6
+ # Because gem needs JSON middleware.
7
+ #
8
+ # see: https://github.com/lostisland/faraday/releases/tag/v1.10.0
9
+ gem 'faraday', '~> 1.10'
10
+
11
+ eval_gemfile File.expand_path('../Gemfile', __dir__)
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'faraday', '~> 2'
6
+
7
+ eval_gemfile File.expand_path('../Gemfile', __dir__)
@@ -12,7 +12,7 @@ module Mrkt
12
12
  conn.request :url_encoded
13
13
 
14
14
  conn.response :logger, @logger, (@log_options || {}) if @debug
15
- conn.response :mkto, content_type: /\bjson$/
15
+ conn.response :mkto, content_type: /\bjson$/, parser_options: { symbolize_names: true }
16
16
 
17
17
  conn.options.timeout = @options[:read_timeout] if @options.key?(:read_timeout)
18
18
  conn.options.open_timeout = @options[:open_timeout] if @options.key?(:open_timeout)
@@ -0,0 +1,31 @@
1
+ module Mrkt
2
+ module CrudProgramMembers
3
+ def describe_program_members
4
+ get('/rest/v1/programs/members/describe.json')
5
+ end
6
+
7
+ def createupdate_program_members(program_id, lead_ids, status)
8
+ post_json("/rest/v1/programs/#{program_id}/members/status.json") do
9
+ {
10
+ statusName: status,
11
+ input: lead_ids.map { |lead_id| { leadId: lead_id } }
12
+ }
13
+ end
14
+ end
15
+
16
+ def get_program_members(program_id, filter_type, filter_values, fields: nil, batch_size: nil, next_page_token: nil)
17
+ params = {
18
+ filterType: filter_type,
19
+ filterValues: filter_values
20
+ }
21
+
22
+ optional = {
23
+ fields: fields,
24
+ batchSize: batch_size,
25
+ nextPageToken: next_page_token
26
+ }
27
+
28
+ get("/rest/v1/programs/#{program_id}/members.json", params, optional)
29
+ end
30
+ end
31
+ end
data/lib/mrkt/faraday.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'faraday'
2
+ require 'faraday/multipart'
2
3
 
3
4
  require 'mrkt/faraday/params_encoder'
4
5
  require 'mrkt/faraday_middleware'
@@ -1,11 +1,9 @@
1
- require 'faraday_middleware'
1
+ require 'faraday/response/json'
2
2
 
3
3
  module Mrkt
4
4
  module FaradayMiddleware
5
- class Response < ::FaradayMiddleware::ParseJson
6
- define_parser do |body|
7
- JSON.parse(body, symbolize_names: true) unless body.strip.empty?
8
- end
5
+ class Response < ::Faraday::Response::Json
6
+ private
9
7
 
10
8
  def process_response(env)
11
9
  super
data/lib/mrkt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mrkt
2
- VERSION = '1.2.0'.freeze
2
+ VERSION = '1.2.2'.freeze
3
3
  end
data/lib/mrkt.rb CHANGED
@@ -13,6 +13,7 @@ require 'mrkt/concerns/import_custom_objects'
13
13
  require 'mrkt/concerns/crud_custom_objects'
14
14
  require 'mrkt/concerns/crud_custom_activities'
15
15
  require 'mrkt/concerns/crud_programs'
16
+ require 'mrkt/concerns/crud_program_members'
16
17
  require 'mrkt/concerns/crud_asset_static_lists'
17
18
  require 'mrkt/concerns/crud_asset_folders'
18
19
 
@@ -30,6 +31,7 @@ module Mrkt
30
31
  include CrudCustomObjects
31
32
  include CrudCustomActivities
32
33
  include CrudPrograms
34
+ include CrudProgramMembers
33
35
  include CrudAssetStaticLists
34
36
  include CrudAssetFolders
35
37
 
data/mrkt.gemspec CHANGED
@@ -17,18 +17,21 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = %w[lib]
19
19
 
20
- spec.required_ruby_version = '>= 2.5'
20
+ spec.metadata['rubygems_mfa_required'] = 'true'
21
21
 
22
- spec.add_dependency 'faraday', '~> 1.0'
23
- spec.add_dependency 'faraday_middleware', '~> 1.0'
22
+ spec.required_ruby_version = '>= 2.6'
23
+
24
+ spec.add_dependency 'faraday', '>= 1.10', '< 3'
25
+ spec.add_dependency 'faraday-multipart'
24
26
 
25
27
  spec.add_development_dependency 'bundler', '~> 2.0'
26
28
  spec.add_development_dependency 'gem-release', '~> 2.1'
27
29
  spec.add_development_dependency 'pry-byebug', '~> 3.7'
28
30
  spec.add_development_dependency 'rake', '~> 13.0'
29
31
  spec.add_development_dependency 'rspec', '~> 3.2'
30
- spec.add_development_dependency 'rubocop', '~> 1.20.0'
32
+ spec.add_development_dependency 'rubocop', '~> 1.28.2'
31
33
  spec.add_development_dependency 'rubocop-rake', '~> 0.6.0'
32
- spec.add_development_dependency 'simplecov', '~> 0.21.2'
34
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.6'
35
+ spec.add_development_dependency 'simplecov', '~> 0.22.0'
33
36
  spec.add_development_dependency 'webmock', '~> 3.1'
34
37
  end
@@ -1,10 +1,10 @@
1
1
  describe Mrkt::Authentication do
2
- include_context 'initialized client'
2
+ include_context 'with an initialized client'
3
3
 
4
4
  describe '#authenticate' do
5
- subject { client.authenticate }
5
+ subject(:action) { client.authenticate }
6
6
 
7
- context 'on a successful response' do
7
+ context 'with on a successful response' do
8
8
  it { is_expected.to be_success }
9
9
  end
10
10
 
@@ -16,21 +16,28 @@ describe Mrkt::Authentication do
16
16
  }
17
17
  end
18
18
 
19
- it 'should raise an Error' do
20
- expect { subject }.to raise_error(Mrkt::Errors::Error, 'Bad client credentials')
19
+ it 'raises an Error' do
20
+ expect { action }.to raise_error(Mrkt::Errors::Error, 'Bad client credentials')
21
21
  end
22
22
  end
23
23
  end
24
24
 
25
25
  describe '#authenticate!' do
26
- it 'should authenticate and then be authenticated?' do
27
- expect(client.authenticated?).to_not be true
26
+ it 'authenticates the client' do
27
+ expect(client.authenticated?).not_to be true
28
+
28
29
  client.authenticate!
29
30
  expect(client.authenticated?).to be true
30
31
  end
31
32
 
32
33
  context 'with optional partner_id client option' do
33
- before { remove_request_stub(@authentication_request_stub) }
34
+ subject(:client) { Mrkt::Client.new(client_options) }
35
+
36
+ before do
37
+ stub_request(:get, "https://#{host}/identity/oauth/token")
38
+ .with(query: query)
39
+ .to_return(json_stub(authentication_stub))
40
+ end
34
41
 
35
42
  let(:partner_id) { SecureRandom.uuid }
36
43
 
@@ -52,23 +59,22 @@ describe Mrkt::Authentication do
52
59
  }
53
60
  end
54
61
 
55
- subject(:client) { Mrkt::Client.new(client_options) }
56
-
57
- before do
58
- stub_request(:get, "https://#{host}/identity/oauth/token")
59
- .with(query: query)
60
- .to_return(json_stub(authentication_stub))
61
- end
62
-
63
- it 'should authenticate and then be authenticated?' do
64
- expect(client.authenticated?).to_not be true
62
+ it 'authenticates the client' do
63
+ expect(client.authenticated?).not_to be true
65
64
  client.authenticate!
66
65
  expect(client.authenticated?).to be true
67
66
  end
68
67
  end
69
68
 
70
69
  context 'when the token has expired and @retry_authentication = true' do
71
- before { remove_request_stub(@authentication_request_stub) }
70
+ subject(:client) { Mrkt::Client.new(client_options) }
71
+
72
+ before do
73
+ stub_request(:get, "https://#{host}/identity/oauth/token")
74
+ .with(query: { client_id: client_id, client_secret: client_secret, grant_type: 'client_credentials' })
75
+ .to_return(json_stub(expired_authentication_stub)).times(3).then
76
+ .to_return(json_stub(valid_authentication_stub))
77
+ end
72
78
 
73
79
  let(:retry_count) { 3 }
74
80
 
@@ -90,17 +96,8 @@ describe Mrkt::Authentication do
90
96
  }
91
97
  end
92
98
 
93
- subject(:client) { Mrkt::Client.new(client_options) }
94
-
95
- before do
96
- stub_request(:get, "https://#{host}/identity/oauth/token")
97
- .with(query: { client_id: client_id, client_secret: client_secret, grant_type: 'client_credentials' })
98
- .to_return(json_stub(expired_authentication_stub)).times(3).then
99
- .to_return(json_stub(valid_authentication_stub))
100
- end
101
-
102
- it 'should retry until getting valid token and then be authenticated?' do
103
- expect(client.authenticated?).to_not be true
99
+ it 'retries until it gets a valid token' do
100
+ expect(client.authenticated?).not_to be true
104
101
  client.authenticate!
105
102
  expect(client.authenticated?).to be true
106
103
  end
@@ -108,8 +105,8 @@ describe Mrkt::Authentication do
108
105
  context 'when retry_authentication_count is low' do
109
106
  let(:retry_count) { 2 }
110
107
 
111
- it 'should stop retrying after @retry_authentication_count tries and then raise an error' do
112
- expect(client.authenticated?).to_not be true
108
+ it 'stops retrying after a while' do
109
+ expect(client.authenticated?).not_to be true
113
110
 
114
111
  expect { client.authenticate! }.to raise_error(Mrkt::Errors::Error, 'Client not authenticated')
115
112
  end
@@ -120,11 +117,11 @@ describe Mrkt::Authentication do
120
117
  describe '#authenticated?' do
121
118
  subject { client.authenticated? }
122
119
 
123
- context 'before authentication' do
120
+ context 'when authentication has not been done' do
124
121
  it { is_expected.to be_falsey }
125
122
  end
126
123
 
127
- context 'after authentication' do
124
+ context 'when authentication has been done' do
128
125
  before { client.authenticate }
129
126
 
130
127
  it { is_expected.to be_truthy }
@@ -1,7 +1,9 @@
1
1
  describe Mrkt::CrudActivities do
2
- include_context 'initialized client'
2
+ include_context 'with an initialized client'
3
3
 
4
4
  describe '#get_activity_types' do
5
+ subject { client.get_activity_types }
6
+
5
7
  let(:response_stub) do
6
8
  {
7
9
  requestId: 'c245#14cd6830ae2',
@@ -29,7 +31,6 @@ describe Mrkt::CrudActivities do
29
31
  success: true
30
32
  }
31
33
  end
32
- subject { client.get_activity_types }
33
34
 
34
35
  before do
35
36
  stub_request(:get, "https://#{host}/rest/v1/activities/types.json")
@@ -40,6 +41,8 @@ describe Mrkt::CrudActivities do
40
41
  end
41
42
 
42
43
  describe '#get_paging_token' do
44
+ subject { client.get_paging_token(since_datetime) }
45
+
43
46
  let(:since_datetime) { Time.utc(2017, 1, 1, 4, 30) }
44
47
  let(:response_stub) do
45
48
  {
@@ -48,7 +51,6 @@ describe Mrkt::CrudActivities do
48
51
  nextPageToken: '4GAX7YNCIJKO2VAED5LH5PQIYPUM7WCVKTQWEDMP2L24AXZT54LA===='
49
52
  }
50
53
  end
51
- subject { client.get_paging_token(since_datetime) }
52
54
 
53
55
  before do
54
56
  stub_request(:get, "https://#{host}/rest/v1/activities/pagingtoken.json")
@@ -60,6 +62,8 @@ describe Mrkt::CrudActivities do
60
62
  end
61
63
 
62
64
  describe '#get_activities' do
65
+ subject { client.get_activities(token) }
66
+
63
67
  let(:activity_type_ids) { [1, 2] }
64
68
  let(:lead_ids) { [100, 102] }
65
69
  let(:token) { '4GAX7YNCIJKO2VAED5LH5PQIYPUM7WCVKTQWEDMP2L24AXZT54LA====' }
@@ -106,7 +110,6 @@ describe Mrkt::CrudActivities do
106
110
  moreResult: false
107
111
  }
108
112
  end
109
- subject { client.get_activities(token) }
110
113
 
111
114
  before do
112
115
  stub_request(:get, "https://#{host}/rest/v1/activities.json")
@@ -116,7 +119,9 @@ describe Mrkt::CrudActivities do
116
119
 
117
120
  it { is_expected.to eq(response_stub) }
118
121
 
119
- context 'specifying activity type ids' do
122
+ context 'when specifying activity type ids' do
123
+ subject { client.get_activities(token, activity_type_ids: activity_type_ids) }
124
+
120
125
  let(:response_stub) do
121
126
  {
122
127
  data: {
@@ -147,7 +152,6 @@ describe Mrkt::CrudActivities do
147
152
  moreResult: false
148
153
  }
149
154
  end
150
- subject { client.get_activities(token, activity_type_ids: activity_type_ids) }
151
155
 
152
156
  before do
153
157
  stub_request(:get, "https://#{host}/rest/v1/activities.json")
@@ -161,7 +165,9 @@ describe Mrkt::CrudActivities do
161
165
  it { is_expected.to eq(response_stub) }
162
166
  end
163
167
 
164
- context 'specifying lead ids' do
168
+ context 'when specifying lead ids' do
169
+ subject { client.get_activities(token, lead_ids: lead_ids) }
170
+
165
171
  let(:response_stub) do
166
172
  {
167
173
  data: {
@@ -192,7 +198,6 @@ describe Mrkt::CrudActivities do
192
198
  moreResult: false
193
199
  }
194
200
  end
195
- subject { client.get_activities(token, lead_ids: lead_ids) }
196
201
 
197
202
  before do
198
203
  stub_request(:get, "https://#{host}/rest/v1/activities.json")
@@ -203,13 +208,14 @@ describe Mrkt::CrudActivities do
203
208
  it { is_expected.to eq(response_stub) }
204
209
  end
205
210
 
206
- context 'specifying arrays values as empty strings' do
207
- let(:activity_type_ids) { '' }
208
- let(:lead_ids) { '' }
211
+ context 'when specifying arrays values as empty strings' do
209
212
  subject do
210
213
  client.get_activities(token, activity_type_ids: activity_type_ids, lead_ids: lead_ids)
211
214
  end
212
215
 
216
+ let(:activity_type_ids) { '' }
217
+ let(:lead_ids) { '' }
218
+
213
219
  before do
214
220
  stub_request(:get, "https://#{host}/rest/v1/activities.json")
215
221
  .with(query: { nextPageToken: token })
@@ -219,7 +225,7 @@ describe Mrkt::CrudActivities do
219
225
  it { is_expected.to eq(response_stub) }
220
226
  end
221
227
 
222
- context 'specifying all options' do
228
+ context 'when specifying all options' do
223
229
  subject do
224
230
  client.get_activities(token, activity_type_ids: activity_type_ids, lead_ids: lead_ids)
225
231
  end
@@ -239,6 +245,8 @@ describe Mrkt::CrudActivities do
239
245
  end
240
246
 
241
247
  describe '#get_deleted_leads' do
248
+ subject { client.get_deleted_leads(token) }
249
+
242
250
  let(:token) { '4GAX7YNCIJKO2VAED5LH5PQIYPUM7WCVKTQWEDMP2L24AXZT54LA====' }
243
251
  let(:response_stub) do
244
252
  {
@@ -266,7 +274,6 @@ describe Mrkt::CrudActivities do
266
274
  moreResult: false
267
275
  }
268
276
  end
269
- subject { client.get_deleted_leads(token) }
270
277
 
271
278
  before do
272
279
  stub_request(:get, "https://#{host}/rest/v1/activities/deletedleads.json")