emarsys 0.3.13 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +10 -2
- data/emarsys.gemspec +3 -2
- data/lib/emarsys/data_objects/contact_list.rb +8 -0
- data/lib/emarsys/data_objects/segment.rb +14 -9
- data/lib/emarsys/error.rb +0 -4
- data/lib/emarsys/response.rb +0 -2
- data/lib/emarsys/version.rb +1 -1
- data/spec/emarsys/data_objects/contact_list_spec.rb +7 -0
- data/spec/emarsys/data_objects/segment_spec.rb +12 -5
- data/spec/emarsys/response_spec.rb +0 -8
- metadata +10 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b91da527fa70b69756d7dca70b153ec103be4c52ed2fc189b6d8eb6d4036637a
|
4
|
+
data.tar.gz: 1ac969e7acf008b6cc07ae032d3c8ce42b8cdcf398b61bb3b51db0ff14c18533
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b512d98dc2a1acbb56a1e783fb00a6e3d915d58a66ea1c773b9c92ea444b4724734e004273ee72758b16179b10b304656a07ad56bd5bd406606fe0d9726c02a0
|
7
|
+
data.tar.gz: 955e9a9626883406b3e029929475dbf04971f3411b5c2112626f7faacd0796c7a0216caf9f1548587d686d4d5e54b1a3c29870fc5a376f7f94ef65673c04eb42
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.4.0
|
4
|
+
|
5
|
+
* Add supported segment endpoints and remove the deprecated one ([#64]https://github.com/Absolventa/emarsys-rb/pull/64)
|
6
|
+
|
3
7
|
## v0.3.13
|
4
8
|
|
5
9
|
* Add method to delete ContactList by ID ([#63](https://github.com/Absolventa/emarsys-rb/pull/63))
|
data/README.md
CHANGED
@@ -161,6 +161,9 @@ Emarsys::ContactList.create
|
|
161
161
|
|
162
162
|
# Delete a contact list
|
163
163
|
Emarsys::ContactList.delete(123)
|
164
|
+
|
165
|
+
# List all contacts in a contact list
|
166
|
+
Emarsys::ContactList.contacts(123)
|
164
167
|
```
|
165
168
|
|
166
169
|
#### Emails
|
@@ -235,8 +238,13 @@ Emarsys::Segment.collection
|
|
235
238
|
```
|
236
239
|
|
237
240
|
```ruby
|
238
|
-
#
|
239
|
-
Emarsys::Segment.
|
241
|
+
# Run a segment for multiple contacts
|
242
|
+
Emarsys::Segment.run(123)
|
243
|
+
```
|
244
|
+
|
245
|
+
```ruby
|
246
|
+
# Check the status of a segment run
|
247
|
+
Emarsys::Segment.status('foo123')
|
240
248
|
```
|
241
249
|
|
242
250
|
#### Source
|
data/emarsys.gemspec
CHANGED
@@ -17,12 +17,13 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
|
+
spec.required_ruby_version = '>= 2.3'
|
20
21
|
|
21
22
|
spec.add_dependency "rest-client"
|
22
23
|
|
23
|
-
spec.add_development_dependency "bundler", "~> 1.
|
24
|
+
spec.add_development_dependency "bundler", "~> 2.1.4"
|
24
25
|
spec.add_development_dependency "rake"
|
25
26
|
spec.add_development_dependency "rspec", ">= 3.5.0"
|
26
|
-
spec.add_development_dependency "webmock", "
|
27
|
+
spec.add_development_dependency "webmock", "~> 2.3.2"
|
27
28
|
spec.add_development_dependency "timecop"
|
28
29
|
end
|
@@ -16,6 +16,14 @@ module Emarsys
|
|
16
16
|
get account, 'contactlist', {}
|
17
17
|
end
|
18
18
|
|
19
|
+
# List contacts in a contact list
|
20
|
+
# Reference: https://dev.emarsys.com/v2/contact-lists/list-contacts-in-a-contact-list
|
21
|
+
#
|
22
|
+
# @param id [Integer] The contact list id
|
23
|
+
def contacts(id, account: nil)
|
24
|
+
get account, "contactlist/#{id}/", {}
|
25
|
+
end
|
26
|
+
|
19
27
|
# Create a new contact list
|
20
28
|
#
|
21
29
|
# @param params [Hash] Contact list information to create
|
@@ -16,17 +16,22 @@ module Emarsys
|
|
16
16
|
get account, 'filter', {}
|
17
17
|
end
|
18
18
|
|
19
|
-
#
|
20
|
-
#
|
21
|
-
# Reference: https://dev.emarsys.com/v2/response-codes/http-202-errors
|
22
|
-
# The `limit` param is required by this endpoint although it is marked as optional in the API v2 doc.
|
19
|
+
# Run a Segment for Multiple Contacts
|
20
|
+
# Reference: https://dev.emarsys.com/v2/segments/run-a-contact-segment-batch
|
23
21
|
#
|
24
22
|
# @param id [Integer] the id of the segment
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
def run(id, account: nil)
|
24
|
+
path = "filter/#{id}/runs"
|
25
|
+
post account, path, {}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Poll the Status of a Segment Run for Multiple Contacts
|
29
|
+
# Reference: https://dev.emarsys.com/v2/segments/poll-the-status-of-a-segment-run-for-multiple-contacts
|
30
|
+
#
|
31
|
+
# @param run_id [String] the id of the segment run, @see #run
|
32
|
+
def status(run_id, account: nil)
|
33
|
+
path = "filter/runs/#{run_id}"
|
34
|
+
get account, path, {}
|
30
35
|
end
|
31
36
|
end
|
32
37
|
end
|
data/lib/emarsys/error.rb
CHANGED
@@ -28,10 +28,6 @@ module Emarsys
|
|
28
28
|
# Raised when Emarsys returns a 500 HTTP status code
|
29
29
|
class InternalServerError < Error; end
|
30
30
|
|
31
|
-
# Raised when Emarsys returns a 202 HTTP status code with 10001 Reply Code
|
32
|
-
# https://dev.emarsys.com/v2/response-codes/http-202-errors
|
33
|
-
class SegmentIsEvaluated < Error; end
|
34
|
-
|
35
31
|
class AccountNotConfigured < StandardError; end
|
36
32
|
|
37
33
|
class AccountRequired < StandardError; end
|
data/lib/emarsys/response.rb
CHANGED
@@ -21,8 +21,6 @@ module Emarsys
|
|
21
21
|
raise Emarsys::Unauthorized.new(code, text, status)
|
22
22
|
elsif status == 429
|
23
23
|
raise Emarsys::TooManyRequests.new(code, text, status)
|
24
|
-
elsif status == 202 && code == 10001
|
25
|
-
raise Emarsys::SegmentIsEvaluated.new(code, text, status)
|
26
24
|
else
|
27
25
|
raise Emarsys::BadRequest.new(code, text, status)
|
28
26
|
end
|
data/lib/emarsys/version.rb
CHANGED
@@ -8,4 +8,11 @@ describe Emarsys::ContactList do
|
|
8
8
|
).to have_been_requested.once
|
9
9
|
end
|
10
10
|
end
|
11
|
+
describe ".contacts" do
|
12
|
+
it "requests all contacts in the given contact list" do
|
13
|
+
expect(
|
14
|
+
stub_get("contactlist/123/") { Emarsys::ContactList.contacts(123) }
|
15
|
+
).to have_been_requested.once
|
16
|
+
end
|
17
|
+
end
|
11
18
|
end
|
@@ -7,11 +7,18 @@ describe Emarsys::Segment do
|
|
7
7
|
stub_get("filter") { Emarsys::Segment.collection }
|
8
8
|
).to have_been_requested.once
|
9
9
|
end
|
10
|
-
describe ".
|
11
|
-
it "requests
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
describe ".run" do
|
11
|
+
it "requests a run for a segment for multiple contacts" do
|
12
|
+
expect(
|
13
|
+
stub_post("filter/123/runs") { Emarsys::Segment.run(123) }
|
14
|
+
).to have_been_requested.once
|
15
|
+
end
|
16
|
+
end
|
17
|
+
describe ".status" do
|
18
|
+
it "requests the status of the given segment run" do
|
19
|
+
expect(
|
20
|
+
stub_get("filter/runs/foo-333-bar") { Emarsys::Segment.status('foo-333-bar') }
|
21
|
+
).to have_been_requested.once
|
15
22
|
end
|
16
23
|
end
|
17
24
|
end
|
@@ -78,14 +78,6 @@ describe Emarsys::Response do
|
|
78
78
|
allow(fake_response).to receive(:code).and_return(429)
|
79
79
|
expect{response}.to raise_error(Emarsys::TooManyRequests)
|
80
80
|
end
|
81
|
-
|
82
|
-
context 'with Reply Code 10001' do
|
83
|
-
let(:reply_code) { 10001 }
|
84
|
-
it "raises SegmentIsEvaluated error if http-status i 202" do
|
85
|
-
allow(fake_response).to receive(:code).and_return(202)
|
86
|
-
expect{response}.to raise_error(Emarsys::SegmentIsEvaluated)
|
87
|
-
end
|
88
|
-
end
|
89
81
|
end
|
90
82
|
|
91
83
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emarsys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schoppmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.1.4
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.1.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: webmock
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 2.3.2
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 2.3.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: timecop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -177,15 +177,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
177
177
|
requirements:
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
180
|
+
version: '2.3'
|
181
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
182
|
requirements:
|
183
183
|
- - ">="
|
184
184
|
- !ruby/object:Gem::Version
|
185
185
|
version: '0'
|
186
186
|
requirements: []
|
187
|
-
|
188
|
-
rubygems_version: 2.4.5.4
|
187
|
+
rubygems_version: 3.0.3
|
189
188
|
signing_key:
|
190
189
|
specification_version: 4
|
191
190
|
summary: Easy to use ruby library for Emarsys Marketing Suite.
|