mrkt 1.2.0 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/ruby.yml +7 -3
- data/.rubocop.yml +15 -2
- data/Gemfile.lock +43 -55
- data/gemfiles/faraday_1.gemfile +11 -0
- data/gemfiles/faraday_2.gemfile +7 -0
- data/lib/mrkt/concerns/connection.rb +1 -1
- data/lib/mrkt/concerns/crud_program_members.rb +31 -0
- data/lib/mrkt/faraday.rb +1 -0
- data/lib/mrkt/faraday_middleware/response.rb +3 -5
- data/lib/mrkt/version.rb +1 -1
- data/lib/mrkt.rb +2 -0
- data/mrkt.gemspec +8 -5
- data/spec/concerns/authentication_spec.rb +31 -34
- data/spec/concerns/crud_activities_spec.rb +20 -13
- data/spec/concerns/crud_asset_folders_spec.rb +12 -12
- data/spec/concerns/crud_asset_static_lists_spec.rb +4 -4
- data/spec/concerns/crud_campaigns_spec.rb +18 -17
- data/spec/concerns/crud_custom_activities_spec.rb +14 -15
- data/spec/concerns/crud_custom_objects_spec.rb +15 -15
- data/spec/concerns/crud_leads_spec.rb +17 -14
- data/spec/concerns/crud_lists_spec.rb +7 -5
- data/spec/concerns/crud_program_members_spec.rb +141 -0
- data/spec/concerns/crud_programs_spec.rb +5 -5
- data/spec/concerns/import_custom_objects_spec.rb +9 -5
- data/spec/concerns/import_leads_spec.rb +9 -5
- data/spec/errors_spec.rb +9 -11
- data/spec/faraday/params_encoder_spec.rb +4 -4
- data/spec/mkto_rest_spec.rb +1 -1
- data/spec/support/initialized_client.rb +3 -3
- metadata +47 -21
@@ -1,7 +1,9 @@
|
|
1
1
|
describe Mrkt::CrudPrograms do
|
2
|
-
include_context 'initialized client'
|
2
|
+
include_context 'with an initialized client'
|
3
3
|
|
4
4
|
describe '#browse_programs' do
|
5
|
+
subject { client.browse_programs }
|
6
|
+
|
5
7
|
let(:response_stub) do
|
6
8
|
{
|
7
9
|
success: true,
|
@@ -30,8 +32,6 @@ describe Mrkt::CrudPrograms do
|
|
30
32
|
}
|
31
33
|
end
|
32
34
|
|
33
|
-
subject { client.browse_programs }
|
34
|
-
|
35
35
|
before do
|
36
36
|
stub_request(:get, "https://#{host}/rest/asset/v1/programs.json")
|
37
37
|
.to_return(json_stub(response_stub))
|
@@ -41,6 +41,8 @@ describe Mrkt::CrudPrograms do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
describe '#get_program_by_id' do
|
44
|
+
subject { client.get_program_by_id(1107) }
|
45
|
+
|
44
46
|
let(:response_stub) do
|
45
47
|
{
|
46
48
|
success: true,
|
@@ -76,8 +78,6 @@ describe Mrkt::CrudPrograms do
|
|
76
78
|
}
|
77
79
|
end
|
78
80
|
|
79
|
-
subject { client.get_program_by_id(1107) }
|
80
|
-
|
81
81
|
before do
|
82
82
|
stub_request(:get, "https://#{host}/rest/asset/v1/program/1107.json")
|
83
83
|
.to_return(json_stub(response_stub))
|
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'tempfile'
|
2
2
|
|
3
3
|
describe Mrkt::ImportCustomObjects do
|
4
|
-
include_context 'initialized client'
|
4
|
+
include_context 'with an initialized client'
|
5
5
|
let(:custom_object) { 'car_c' }
|
6
6
|
|
7
7
|
describe '#import_custom_object' do
|
8
|
+
subject { client.import_custom_object(file, custom_object) }
|
9
|
+
|
8
10
|
let(:file) { StringIO.new }
|
9
11
|
let(:response_stub) do
|
10
12
|
{
|
@@ -19,7 +21,6 @@ describe Mrkt::ImportCustomObjects do
|
|
19
21
|
]
|
20
22
|
}
|
21
23
|
end
|
22
|
-
subject { client.import_custom_object(file, custom_object) }
|
23
24
|
|
24
25
|
before do
|
25
26
|
stub_request(:post, "https://#{host}/bulk/v1/customobjects/#{custom_object}/import.json")
|
@@ -31,6 +32,8 @@ describe Mrkt::ImportCustomObjects do
|
|
31
32
|
end
|
32
33
|
|
33
34
|
describe '#import_custom_object_status' do
|
35
|
+
subject { client.import_custom_object_status(1, custom_object) }
|
36
|
+
|
34
37
|
let(:id) { 1 }
|
35
38
|
let(:response_stub) do
|
36
39
|
{
|
@@ -51,7 +54,6 @@ describe Mrkt::ImportCustomObjects do
|
|
51
54
|
success: true
|
52
55
|
}
|
53
56
|
end
|
54
|
-
subject { client.import_custom_object_status(1, custom_object) }
|
55
57
|
|
56
58
|
before do
|
57
59
|
stub_request(:get, "https://#{host}/bulk/v1/customobjects/#{custom_object}/import/#{id}/status.json")
|
@@ -62,9 +64,10 @@ describe Mrkt::ImportCustomObjects do
|
|
62
64
|
end
|
63
65
|
|
64
66
|
describe '#import_custom_object_failures' do
|
67
|
+
subject { client.import_custom_object_failures(1, custom_object) }
|
68
|
+
|
65
69
|
let(:id) { 1 }
|
66
70
|
let(:response_stub) { '' }
|
67
|
-
subject { client.import_custom_object_failures(1, custom_object) }
|
68
71
|
|
69
72
|
before do
|
70
73
|
stub_request(:get, "https://#{host}/bulk/v1/customobjects/#{custom_object}/import/#{id}/failures.json")
|
@@ -75,9 +78,10 @@ describe Mrkt::ImportCustomObjects do
|
|
75
78
|
end
|
76
79
|
|
77
80
|
describe '#import_custom_object_warnings' do
|
81
|
+
subject { client.import_custom_object_warnings(1, custom_object) }
|
82
|
+
|
78
83
|
let(:id) { 1 }
|
79
84
|
let(:response_stub) { '' }
|
80
|
-
subject { client.import_custom_object_warnings(1, custom_object) }
|
81
85
|
|
82
86
|
before do
|
83
87
|
stub_request(:get, "https://#{host}/bulk/v1/customobjects/#{custom_object}/import/#{id}/warnings.json")
|
@@ -2,9 +2,11 @@ require 'csv'
|
|
2
2
|
require 'tempfile'
|
3
3
|
|
4
4
|
describe Mrkt::ImportLeads do
|
5
|
-
include_context 'initialized client'
|
5
|
+
include_context 'with an initialized client'
|
6
6
|
|
7
7
|
describe '#import_lead' do
|
8
|
+
subject { client.import_lead(tempfile) }
|
9
|
+
|
8
10
|
let(:tempfile) { Tempfile.new(%w[import-leads csv]) }
|
9
11
|
let(:response_stub) do
|
10
12
|
{
|
@@ -18,7 +20,6 @@ describe Mrkt::ImportLeads do
|
|
18
20
|
]
|
19
21
|
}
|
20
22
|
end
|
21
|
-
subject { client.import_lead(tempfile) }
|
22
23
|
|
23
24
|
before do
|
24
25
|
CSV.open(tempfile, 'wb') do |csv|
|
@@ -39,6 +40,8 @@ describe Mrkt::ImportLeads do
|
|
39
40
|
end
|
40
41
|
|
41
42
|
describe '#import_lead_status' do
|
43
|
+
subject { client.import_lead_status(1) }
|
44
|
+
|
42
45
|
let(:id) { 1 }
|
43
46
|
let(:response_stub) do
|
44
47
|
{
|
@@ -56,7 +59,6 @@ describe Mrkt::ImportLeads do
|
|
56
59
|
success: true
|
57
60
|
}
|
58
61
|
end
|
59
|
-
subject { client.import_lead_status(1) }
|
60
62
|
|
61
63
|
before do
|
62
64
|
stub_request(:get, "https://#{host}/bulk/v1/leads/batch/#{id}.json")
|
@@ -67,9 +69,10 @@ describe Mrkt::ImportLeads do
|
|
67
69
|
end
|
68
70
|
|
69
71
|
describe '#import_lead_failures' do
|
72
|
+
subject { client.import_lead_failures(1) }
|
73
|
+
|
70
74
|
let(:id) { 1 }
|
71
75
|
let(:response_stub) { '' }
|
72
|
-
subject { client.import_lead_failures(1) }
|
73
76
|
|
74
77
|
before do
|
75
78
|
stub_request(:get, "https://#{host}/bulk/v1/leads/batch/#{id}/failures.json")
|
@@ -80,9 +83,10 @@ describe Mrkt::ImportLeads do
|
|
80
83
|
end
|
81
84
|
|
82
85
|
describe '#import_lead_warnings' do
|
86
|
+
subject { client.import_lead_warnings(1) }
|
87
|
+
|
83
88
|
let(:id) { 1 }
|
84
89
|
let(:response_stub) { '' }
|
85
|
-
subject { client.import_lead_warnings(1) }
|
86
90
|
|
87
91
|
before do
|
88
92
|
stub_request(:get, "https://#{host}/bulk/v1/leads/batch/#{id}/warnings.json")
|
data/spec/errors_spec.rb
CHANGED
@@ -1,21 +1,19 @@
|
|
1
1
|
describe Mrkt::Errors do
|
2
2
|
describe '.find_by_response_code' do
|
3
|
-
subject { described_class.find_by_response_code(code) }
|
3
|
+
subject(:actual) { described_class.find_by_response_code(code) }
|
4
4
|
|
5
|
-
context 'when the code is' do
|
6
|
-
|
7
|
-
let(:code) { 413 }
|
5
|
+
context 'when the code is known' do
|
6
|
+
let(:code) { 413 }
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
end
|
8
|
+
it 'returns the mapped error class' do
|
9
|
+
expect(actual).to eq(Mrkt::Errors::RequestEntityTooLarge)
|
12
10
|
end
|
11
|
+
end
|
13
12
|
|
14
|
-
|
15
|
-
|
13
|
+
context 'when the code is unknown' do
|
14
|
+
let(:code) { 7331 }
|
16
15
|
|
17
|
-
|
18
|
-
end
|
16
|
+
it { is_expected.to eq(Mrkt::Errors::Error) }
|
19
17
|
end
|
20
18
|
end
|
21
19
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
describe Mrkt::Faraday::ParamsEncoder do
|
2
2
|
describe '.encode' do
|
3
|
+
subject { described_class.encode(params) }
|
4
|
+
|
3
5
|
let(:params) do
|
4
6
|
{
|
5
7
|
string: 'foobar',
|
@@ -9,16 +11,14 @@ describe Mrkt::Faraday::ParamsEncoder do
|
|
9
11
|
}
|
10
12
|
end
|
11
13
|
|
12
|
-
subject { described_class.encode(params) }
|
13
|
-
|
14
14
|
it { is_expected.to eq(Faraday::Utils::ParamsHash.new.merge(params.merge(array: '1,2,3')).to_query) }
|
15
15
|
end
|
16
16
|
|
17
17
|
describe '.decode' do
|
18
|
-
let(:value) { 'foo=foo&bar=bar' }
|
19
|
-
|
20
18
|
subject { described_class.decode(value) }
|
21
19
|
|
20
|
+
let(:value) { 'foo=foo&bar=bar' }
|
21
|
+
|
22
22
|
it { is_expected.to eq('foo' => 'foo', 'bar' => 'bar') }
|
23
23
|
end
|
24
24
|
end
|
data/spec/mkto_rest_spec.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'securerandom'
|
2
2
|
require 'json'
|
3
3
|
|
4
|
-
shared_context 'initialized client' do
|
4
|
+
shared_context 'with an initialized client' do
|
5
|
+
subject(:client) { Mrkt::Client.new(host: host, client_id: client_id, client_secret: client_secret) }
|
6
|
+
|
5
7
|
let(:host) { '0-KBZ-0.mktorest.com' }
|
6
8
|
let(:client_id) { SecureRandom.uuid }
|
7
9
|
let(:client_secret) { SecureRandom.hex }
|
@@ -9,8 +11,6 @@ shared_context 'initialized client' do
|
|
9
11
|
{ access_token: SecureRandom.uuid, token_type: 'bearer', expires_in: 2241, scope: 'RestClient' }
|
10
12
|
end
|
11
13
|
|
12
|
-
subject(:client) { Mrkt::Client.new(host: host, client_id: client_id, client_secret: client_secret) }
|
13
|
-
|
14
14
|
before do
|
15
15
|
@authentication_request_stub = stub_request(:get, "https://#{host}/identity/oauth/token")
|
16
16
|
.with(query: { client_id: client_id, client_secret: client_secret, grant_type: 'client_credentials' })
|
metadata
CHANGED
@@ -1,44 +1,50 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mrkt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KARASZI István
|
8
8
|
- Jacques Lemieux
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.10'
|
21
|
+
- - "<"
|
19
22
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
23
|
+
version: '3'
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
24
27
|
requirements:
|
25
|
-
- - "
|
28
|
+
- - ">="
|
26
29
|
- !ruby/object:Gem::Version
|
27
|
-
version: '1.
|
30
|
+
version: '1.10'
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3'
|
28
34
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
35
|
+
name: faraday-multipart
|
30
36
|
requirement: !ruby/object:Gem::Requirement
|
31
37
|
requirements:
|
32
|
-
- - "
|
38
|
+
- - ">="
|
33
39
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
40
|
+
version: '0'
|
35
41
|
type: :runtime
|
36
42
|
prerelease: false
|
37
43
|
version_requirements: !ruby/object:Gem::Requirement
|
38
44
|
requirements:
|
39
|
-
- - "
|
45
|
+
- - ">="
|
40
46
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
47
|
+
version: '0'
|
42
48
|
- !ruby/object:Gem::Dependency
|
43
49
|
name: bundler
|
44
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,14 +121,14 @@ dependencies:
|
|
115
121
|
requirements:
|
116
122
|
- - "~>"
|
117
123
|
- !ruby/object:Gem::Version
|
118
|
-
version: 1.
|
124
|
+
version: 1.28.2
|
119
125
|
type: :development
|
120
126
|
prerelease: false
|
121
127
|
version_requirements: !ruby/object:Gem::Requirement
|
122
128
|
requirements:
|
123
129
|
- - "~>"
|
124
130
|
- !ruby/object:Gem::Version
|
125
|
-
version: 1.
|
131
|
+
version: 1.28.2
|
126
132
|
- !ruby/object:Gem::Dependency
|
127
133
|
name: rubocop-rake
|
128
134
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,20 +143,34 @@ dependencies:
|
|
137
143
|
- - "~>"
|
138
144
|
- !ruby/object:Gem::Version
|
139
145
|
version: 0.6.0
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: rubocop-rspec
|
148
|
+
requirement: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '2.6'
|
153
|
+
type: :development
|
154
|
+
prerelease: false
|
155
|
+
version_requirements: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '2.6'
|
140
160
|
- !ruby/object:Gem::Dependency
|
141
161
|
name: simplecov
|
142
162
|
requirement: !ruby/object:Gem::Requirement
|
143
163
|
requirements:
|
144
164
|
- - "~>"
|
145
165
|
- !ruby/object:Gem::Version
|
146
|
-
version: 0.
|
166
|
+
version: 0.22.0
|
147
167
|
type: :development
|
148
168
|
prerelease: false
|
149
169
|
version_requirements: !ruby/object:Gem::Requirement
|
150
170
|
requirements:
|
151
171
|
- - "~>"
|
152
172
|
- !ruby/object:Gem::Version
|
153
|
-
version: 0.
|
173
|
+
version: 0.22.0
|
154
174
|
- !ruby/object:Gem::Dependency
|
155
175
|
name: webmock
|
156
176
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,6 +204,8 @@ files:
|
|
184
204
|
- LICENSE.txt
|
185
205
|
- README.md
|
186
206
|
- Rakefile
|
207
|
+
- gemfiles/faraday_1.gemfile
|
208
|
+
- gemfiles/faraday_2.gemfile
|
187
209
|
- lib/mrkt.rb
|
188
210
|
- lib/mrkt/concerns/authentication.rb
|
189
211
|
- lib/mrkt/concerns/connection.rb
|
@@ -196,6 +218,7 @@ files:
|
|
196
218
|
- lib/mrkt/concerns/crud_helpers.rb
|
197
219
|
- lib/mrkt/concerns/crud_leads.rb
|
198
220
|
- lib/mrkt/concerns/crud_lists.rb
|
221
|
+
- lib/mrkt/concerns/crud_program_members.rb
|
199
222
|
- lib/mrkt/concerns/crud_programs.rb
|
200
223
|
- lib/mrkt/concerns/import_custom_objects.rb
|
201
224
|
- lib/mrkt/concerns/import_leads.rb
|
@@ -215,6 +238,7 @@ files:
|
|
215
238
|
- spec/concerns/crud_custom_objects_spec.rb
|
216
239
|
- spec/concerns/crud_leads_spec.rb
|
217
240
|
- spec/concerns/crud_lists_spec.rb
|
241
|
+
- spec/concerns/crud_program_members_spec.rb
|
218
242
|
- spec/concerns/crud_programs_spec.rb
|
219
243
|
- spec/concerns/import_custom_objects_spec.rb
|
220
244
|
- spec/concerns/import_leads_spec.rb
|
@@ -227,8 +251,9 @@ files:
|
|
227
251
|
homepage: https://github.com/raszi/mrkt
|
228
252
|
licenses:
|
229
253
|
- MIT
|
230
|
-
metadata:
|
231
|
-
|
254
|
+
metadata:
|
255
|
+
rubygems_mfa_required: 'true'
|
256
|
+
post_install_message:
|
232
257
|
rdoc_options: []
|
233
258
|
require_paths:
|
234
259
|
- lib
|
@@ -236,15 +261,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
236
261
|
requirements:
|
237
262
|
- - ">="
|
238
263
|
- !ruby/object:Gem::Version
|
239
|
-
version: '2.
|
264
|
+
version: '2.6'
|
240
265
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
241
266
|
requirements:
|
242
267
|
- - ">="
|
243
268
|
- !ruby/object:Gem::Version
|
244
269
|
version: '0'
|
245
270
|
requirements: []
|
246
|
-
rubygems_version: 3.
|
247
|
-
signing_key:
|
271
|
+
rubygems_version: 3.3.7
|
272
|
+
signing_key:
|
248
273
|
specification_version: 4
|
249
274
|
summary: Marketo REST API Facade
|
250
275
|
test_files:
|
@@ -257,6 +282,7 @@ test_files:
|
|
257
282
|
- spec/concerns/crud_custom_objects_spec.rb
|
258
283
|
- spec/concerns/crud_leads_spec.rb
|
259
284
|
- spec/concerns/crud_lists_spec.rb
|
285
|
+
- spec/concerns/crud_program_members_spec.rb
|
260
286
|
- spec/concerns/crud_programs_spec.rb
|
261
287
|
- spec/concerns/import_custom_objects_spec.rb
|
262
288
|
- spec/concerns/import_leads_spec.rb
|