emarsys 0.1.0 → 0.2.0
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 +7 -0
- data/.travis.yml +8 -0
- data/Gemfile +0 -6
- data/README.md +118 -64
- data/emarsys.gemspec +3 -1
- data/lib/emarsys/client.rb +7 -9
- data/lib/emarsys/country.rb +220 -0
- data/lib/emarsys/data_object.rb +12 -3
- data/lib/emarsys/data_objects/condition.rb +2 -1
- data/lib/emarsys/data_objects/contact.rb +3 -2
- data/lib/emarsys/data_objects/contact_list.rb +2 -1
- data/lib/emarsys/data_objects/email.rb +2 -1
- data/lib/emarsys/data_objects/email_category.rb +2 -1
- data/lib/emarsys/data_objects/email_launch_status.rb +2 -1
- data/lib/emarsys/data_objects/email_status_code.rb +2 -1
- data/lib/emarsys/data_objects/event.rb +18 -1
- data/lib/emarsys/data_objects/export.rb +2 -1
- data/lib/emarsys/data_objects/field.rb +2 -1
- data/lib/emarsys/data_objects/file.rb +2 -1
- data/lib/emarsys/data_objects/folder.rb +2 -1
- data/lib/emarsys/data_objects/form.rb +2 -1
- data/lib/emarsys/data_objects/language.rb +2 -1
- data/lib/emarsys/data_objects/segment.rb +2 -1
- data/lib/emarsys/data_objects/source.rb +2 -1
- data/lib/emarsys/error.rb +2 -1
- data/lib/emarsys/extensions.rb +2 -1
- data/lib/emarsys/field_mapping.rb +2 -1
- data/lib/emarsys/params_converter.rb +2 -1
- data/lib/emarsys/request.rb +2 -1
- data/lib/emarsys/response.rb +2 -1
- data/lib/emarsys/version.rb +2 -1
- data/lib/emarsys.rb +5 -3
- data/spec/emarsys/client_spec.rb +25 -24
- data/spec/emarsys/country_spec.rb +22 -0
- data/spec/emarsys/data_object_spec.rb +14 -9
- data/spec/emarsys/data_objects/condition_spec.rb +4 -2
- data/spec/emarsys/data_objects/contact_list_spec.rb +4 -2
- data/spec/emarsys/data_objects/contact_spec.rb +17 -17
- data/spec/emarsys/data_objects/email_category_spec.rb +4 -2
- data/spec/emarsys/data_objects/email_spec.rb +31 -21
- data/spec/emarsys/data_objects/event_spec.rb +16 -6
- data/spec/emarsys/data_objects/export_spec.rb +4 -2
- data/spec/emarsys/data_objects/field_spec.rb +10 -4
- data/spec/emarsys/data_objects/file_spec.rb +11 -7
- data/spec/emarsys/data_objects/folder_spec.rb +7 -3
- data/spec/emarsys/data_objects/form_spec.rb +4 -2
- data/spec/emarsys/data_objects/language_spec.rb +4 -2
- data/spec/emarsys/data_objects/segment_spec.rb +4 -2
- data/spec/emarsys/data_objects/source_spec.rb +8 -6
- data/spec/emarsys/field_mapping_spec.rb +4 -4
- data/spec/emarsys/params_converter_spec.rb +2 -2
- data/spec/emarsys/request_spec.rb +2 -2
- data/spec/emarsys/response_spec.rb +5 -5
- data/spec/emarsys_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -4
- metadata +48 -25
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Emarsys
|
2
3
|
|
3
4
|
# Methods for the Event API
|
@@ -33,6 +34,22 @@ module Emarsys
|
|
33
34
|
post "event/#{event_id}/trigger", params
|
34
35
|
end
|
35
36
|
|
37
|
+
# Trigger an external event for multiple contacts
|
38
|
+
#
|
39
|
+
# @param event_id [Integer, String] The internal emarsys id
|
40
|
+
# @param key_id [Integer, String] The identifer of the key field (e.g. 3 for 'email')
|
41
|
+
# @param contacts [Array, Hash] An array with hashes containing the contacts and optional data per contact
|
42
|
+
# @return [Hash] Result data
|
43
|
+
# @example
|
44
|
+
# Emarsys::Event.trigger_multiple(2, 3, [{:external_id => "test@example.com"},{:external_id => "test2@example.com", :data => {:name => "Special Name"}}])
|
45
|
+
def trigger_multiple(event_id, key_id, contacts)
|
46
|
+
external_id = ""
|
47
|
+
transformed_key_id = transform_key_id(key_id)
|
48
|
+
params = {:key_id => transformed_key_id, :external_id => external_id, :data => nil}
|
49
|
+
params.merge!(:contacts => contacts)
|
50
|
+
post "event/#{event_id}/trigger", params
|
51
|
+
end
|
52
|
+
|
36
53
|
# @private
|
37
54
|
def transform_key_id(key_id)
|
38
55
|
matching_attributes = Emarsys::FieldMapping::ATTRIBUTES.find{|elem| elem[:identifier] == key_id.to_s}
|
@@ -41,4 +58,4 @@ module Emarsys
|
|
41
58
|
end
|
42
59
|
|
43
60
|
end
|
44
|
-
end
|
61
|
+
end
|
data/lib/emarsys/error.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Emarsys
|
2
3
|
# Custom error class for rescuing from Emarsys errors
|
3
4
|
class Error < StandardError
|
@@ -21,4 +22,4 @@ module Emarsys
|
|
21
22
|
|
22
23
|
# Raised when Emarsys returns a 500 HTTP status code
|
23
24
|
class InternalServerError < Error; end
|
24
|
-
end
|
25
|
+
end
|
data/lib/emarsys/extensions.rb
CHANGED
data/lib/emarsys/request.rb
CHANGED
data/lib/emarsys/response.rb
CHANGED
data/lib/emarsys/version.rb
CHANGED
data/lib/emarsys.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "base64"
|
2
3
|
require 'json'
|
3
4
|
require 'rest_client'
|
4
5
|
require 'uri'
|
5
6
|
|
6
7
|
require 'emarsys/client'
|
8
|
+
require 'emarsys/country'
|
7
9
|
require 'emarsys/data_object'
|
8
10
|
require 'emarsys/error'
|
9
11
|
require 'emarsys/extensions'
|
@@ -36,7 +38,7 @@ module Emarsys
|
|
36
38
|
class << self
|
37
39
|
|
38
40
|
# @!attribute api_endpoint
|
39
|
-
# @return [String] Base URL for emarsys URLs. default: https://
|
41
|
+
# @return [String] Base URL for emarsys URLs. default: https://api.emarsys.net/api/v2
|
40
42
|
# @!attribute api_password
|
41
43
|
# @return [String] API Username given by Emarsys
|
42
44
|
# @!attribute api_username
|
@@ -48,7 +50,7 @@ module Emarsys
|
|
48
50
|
#
|
49
51
|
# @return [String] domain which should be used to query the API
|
50
52
|
def api_endpoint
|
51
|
-
@api_endpoint ||= 'https://
|
53
|
+
@api_endpoint ||= 'https://api.emarsys.net/api/v2'
|
52
54
|
end
|
53
55
|
|
54
56
|
# Set configuration options using a block
|
@@ -57,4 +59,4 @@ module Emarsys
|
|
57
59
|
end
|
58
60
|
|
59
61
|
end
|
60
|
-
end
|
62
|
+
end
|
data/spec/emarsys/client_spec.rb
CHANGED
@@ -4,22 +4,22 @@ describe Emarsys::Client do
|
|
4
4
|
|
5
5
|
describe 'configs for username and password' do
|
6
6
|
it 'inherits username from module' do
|
7
|
-
Emarsys.
|
7
|
+
allow(Emarsys).to receive(:api_username).and_return("my_username")
|
8
8
|
expect(Emarsys::Client.new.username).to eq("my_username")
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'inherits password from module' do
|
12
|
-
Emarsys.
|
12
|
+
allow(Emarsys).to receive(:api_password).and_return("my_password")
|
13
13
|
expect(Emarsys::Client.new.password).to eq("my_password")
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'raises error if api_username is not set' do
|
17
|
-
Emarsys.
|
17
|
+
allow(Emarsys).to receive(:api_username).and_return(nil)
|
18
18
|
expect{Emarsys::Client.new.username}.to raise_error(ArgumentError, 'Emarsys.api_username is not set')
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'raises error if api_password is not set' do
|
22
|
-
Emarsys.
|
22
|
+
allow(Emarsys).to receive(:api_password).and_return(nil)
|
23
23
|
expect{Emarsys::Client.new.password}.to raise_error(ArgumentError, 'Emarsys.api_password is not set')
|
24
24
|
end
|
25
25
|
end
|
@@ -27,54 +27,56 @@ describe Emarsys::Client do
|
|
27
27
|
context 'client authentication' do
|
28
28
|
describe '#x_wsse_string' do
|
29
29
|
it 'builds x_wsse_string with specific format' do
|
30
|
-
Emarsys::Client.
|
31
|
-
Emarsys::Client.
|
32
|
-
Emarsys::Client.
|
33
|
-
Emarsys::Client.
|
30
|
+
allow_any_instance_of(Emarsys::Client).to receive(:username).and_return("my_username")
|
31
|
+
allow_any_instance_of(Emarsys::Client).to receive(:header_password_digest).and_return("12345689")
|
32
|
+
allow_any_instance_of(Emarsys::Client).to receive(:header_nonce).and_return("some_header_nonce")
|
33
|
+
allow_any_instance_of(Emarsys::Client).to receive(:header_created).and_return("2013-01-01")
|
34
34
|
expect(Emarsys::Client.new.x_wsse_string).to eq(
|
35
|
-
'UsernameToken Username
|
35
|
+
'UsernameToken Username="my_username", PasswordDigest="12345689", Nonce="some_header_nonce", Created="2013-01-01"'
|
36
36
|
)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
describe '#header_password_digest' do
|
41
41
|
before :each do
|
42
|
-
Emarsys::Client.
|
42
|
+
allow_any_instance_of(Emarsys::Client).to receive(:calculated_digest).and_return("something")
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'encodes string with Base64' do
|
46
|
-
Base64.
|
46
|
+
expect(Base64).to receive(:encode64).with("something").and_return("something_base64_encoded")
|
47
47
|
Emarsys::Client.new.header_password_digest
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'strips of \n character' do
|
51
|
-
Base64.
|
51
|
+
expect(Base64).to receive(:encode64).with("something").and_return("something_base64_encoded\n")
|
52
52
|
expect(Emarsys::Client.new.header_password_digest).to eq("something_base64_encoded")
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
describe '#header_nonce' do
|
57
|
-
it 'uses
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
it 'uses 16 random bytes to generate a 32 char hex string' do
|
58
|
+
expect(Emarsys::Client.new.header_nonce).to match(/^[0-9a-f]{32}$/i)
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'only creates the nonce once' do
|
62
|
+
client = Emarsys::Client.new
|
63
|
+
nonce = client.header_nonce
|
64
|
+
expect(client.header_nonce).to eq nonce
|
61
65
|
end
|
62
66
|
end
|
63
67
|
|
64
68
|
describe '#header_created' do
|
65
69
|
it 'uses current timestamp format' do
|
66
|
-
|
67
|
-
Time.stub(:new).and_return(time)
|
68
|
-
expect(Emarsys::Client.new.header_created).to eq("2013-01-01 01:00:01")
|
70
|
+
expect(Emarsys::Client.new.header_created).to eq(Time.now.utc.iso8601)
|
69
71
|
end
|
70
72
|
end
|
71
73
|
|
72
74
|
describe '#calculated_digest' do
|
73
75
|
it 'runs sha1 on header_nonce + header_created + password' do
|
74
|
-
Emarsys::Client.
|
75
|
-
Emarsys::Client.
|
76
|
-
Emarsys::Client.
|
77
|
-
Digest::SHA1.
|
76
|
+
allow_any_instance_of(Emarsys::Client).to receive(:header_nonce).and_return("some_header_nonce")
|
77
|
+
allow_any_instance_of(Emarsys::Client).to receive(:header_created).and_return("12345689")
|
78
|
+
allow_any_instance_of(Emarsys::Client).to receive(:password).and_return("my_password")
|
79
|
+
expect(Digest::SHA1).to receive(:hexdigest).with("some_header_nonce12345689my_password")
|
78
80
|
Emarsys::Client.new.calculated_digest
|
79
81
|
end
|
80
82
|
end
|
@@ -82,4 +84,3 @@ describe Emarsys::Client do
|
|
82
84
|
end
|
83
85
|
|
84
86
|
end
|
85
|
-
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Emarsys::Country do
|
4
|
+
|
5
|
+
describe 'from_iso' do
|
6
|
+
it 'maps ISO-3166-1 alpha-2 country code to equivalent Emarsys internal country ID' do
|
7
|
+
expect(Emarsys::Country.from_iso('AF')).to eq( { id: 1, name: 'Afghanistan'} )
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'supports passing ISO country code as a symbol' do
|
11
|
+
expect(Emarsys::Country.from_iso(:AF)).to eq( { id: 1, name: 'Afghanistan'} )
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'ignores case of the ISO country code' do
|
15
|
+
expect(Emarsys::Country.from_iso('aF')).to eq( { id: 1, name: 'Afghanistan'} )
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'returns nil for an unknown/invalid code' do
|
19
|
+
expect(Emarsys::Country.from_iso('XY')).to eq nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -5,33 +5,33 @@ describe Emarsys::DataObject do
|
|
5
5
|
|
6
6
|
describe '.get' do
|
7
7
|
it "delegates to the instance request method" do
|
8
|
-
Emarsys::DataObject.
|
8
|
+
allow_any_instance_of(Emarsys::DataObject).to receive(:request).with('get', 'test_method', {}).and_return(nil)
|
9
9
|
Emarsys::DataObject.get('test_method', {})
|
10
10
|
end
|
11
11
|
|
12
12
|
it "transfers params to specific emarsys params format" do
|
13
|
-
Emarsys::DataObject.
|
13
|
+
allow_any_instance_of(Emarsys::DataObject).to receive(:request).with('get', 'test_method/?a=1&b=2', {}).and_return(nil)
|
14
14
|
Emarsys::DataObject.get('test_method', {'a' => 1, 'b' => 2})
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe '.post' do
|
19
19
|
it "delegates to the instance request method" do
|
20
|
-
Emarsys::DataObject.
|
20
|
+
allow_any_instance_of(Emarsys::DataObject).to receive(:request).with('post', 'test_method', {}).and_return(nil)
|
21
21
|
Emarsys::DataObject.post('test_method', {})
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe '.put' do
|
26
26
|
it "delegates to the instance request method" do
|
27
|
-
Emarsys::DataObject.
|
27
|
+
allow_any_instance_of(Emarsys::DataObject).to receive(:request).with('put', 'test_method', {}).and_return(nil)
|
28
28
|
Emarsys::DataObject.put('test_method', {})
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
describe '.delete' do
|
33
33
|
it "delegates to the instance request method" do
|
34
|
-
Emarsys::DataObject.
|
34
|
+
allow_any_instance_of(Emarsys::DataObject).to receive(:request).with('delete', 'test_method', {}).and_return(nil)
|
35
35
|
Emarsys::DataObject.delete('test_method', {})
|
36
36
|
end
|
37
37
|
end
|
@@ -39,7 +39,12 @@ describe Emarsys::DataObject do
|
|
39
39
|
describe '.parameterize_params' do
|
40
40
|
it "converts hash to params string" do
|
41
41
|
params = {"a" => 1, "b" => 2, "c" => 3}
|
42
|
-
expect(Emarsys::DataObject.parameterize_params(params)).to eq("a=1&b=2&c=3")
|
42
|
+
expect(Emarsys::DataObject.parameterize_params(params)).to eq("?a=1&b=2&c=3")
|
43
|
+
end
|
44
|
+
|
45
|
+
it "url_encodes params" do
|
46
|
+
params = {"email" => "best/email@mail.org"}
|
47
|
+
expect(Emarsys::DataObject.parameterize_params(params)).to eq("?email=best%2Femail%40mail.org")
|
43
48
|
end
|
44
49
|
end
|
45
50
|
end
|
@@ -47,9 +52,9 @@ describe Emarsys::DataObject do
|
|
47
52
|
context "as an instance" do
|
48
53
|
let(:data_object) { Emarsys::DataObject.new }
|
49
54
|
|
50
|
-
it "provides a
|
51
|
-
Emarsys::Request.
|
55
|
+
it "provides a simple #request that delegates to Emarsys::Request" do
|
56
|
+
allow_any_instance_of(Emarsys::Request).to receive(:send_request).and_return(nil)
|
52
57
|
data_object.request('get', 'test_method', {})
|
53
58
|
end
|
54
59
|
end
|
55
|
-
end
|
60
|
+
end
|
@@ -3,7 +3,9 @@ require 'spec_helper'
|
|
3
3
|
describe Emarsys::Condition do
|
4
4
|
describe ".collection" do
|
5
5
|
it "requests all conditions" do
|
6
|
-
|
6
|
+
expect(
|
7
|
+
stub_get("condition") { Emarsys::Condition.collection }
|
8
|
+
).to have_been_requested.once
|
7
9
|
end
|
8
10
|
end
|
9
|
-
end
|
11
|
+
end
|
@@ -3,7 +3,9 @@ require 'spec_helper'
|
|
3
3
|
describe Emarsys::ContactList do
|
4
4
|
describe ".collection" do
|
5
5
|
it "requests all contactlists" do
|
6
|
-
|
6
|
+
expect(
|
7
|
+
stub_get("contactlist") { Emarsys::ContactList.collection }
|
8
|
+
).to have_been_requested.once
|
7
9
|
end
|
8
10
|
end
|
9
|
-
end
|
11
|
+
end
|
@@ -4,70 +4,70 @@ describe Emarsys::Contact do
|
|
4
4
|
describe ".create" do
|
5
5
|
it "requests contact creation with parameters" do
|
6
6
|
stub_params = {1 => 'John', 2 => "Doe"}
|
7
|
-
stub = stub_request(:post, "https://
|
7
|
+
stub = stub_request(:post, "https://api.emarsys.net/api/v2/contact").with(:body => stub_params.merge!({'key_id' => 3, 3 => 'john.doe@example.com'}).to_json).to_return(standard_return_body)
|
8
8
|
Emarsys::Contact.create(3, "john.doe@example.com", stub_params)
|
9
|
-
stub.
|
9
|
+
expect(stub).to have_been_requested.once
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
describe ".emarsys_id" do
|
14
14
|
it "requests emarsys_id of a contact" do
|
15
|
-
stub = stub_request(:get, "https://
|
15
|
+
stub = stub_request(:get, "https://api.emarsys.net/api/v2/contact/?3=jane.doe@example.com").to_return(standard_return_body)
|
16
16
|
Emarsys::Contact.emarsys_id(3, 'jane.doe@example.com')
|
17
|
-
stub.
|
17
|
+
expect(stub).to have_been_requested.once
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
describe ".update" do
|
22
22
|
it "requests contact update with parameters" do
|
23
23
|
stub_params = {1 => 'Jane', 2 => "Doe"}
|
24
|
-
stub = stub_request(:put, "https://
|
24
|
+
stub = stub_request(:put, "https://api.emarsys.net/api/v2/contact").with(:body => stub_params.merge!({'key_id' => 3, 3 => 'jane.doe@example.com'}).to_json).to_return(standard_return_body)
|
25
25
|
Emarsys::Contact.update(3, 'jane.doe@example.com', stub_params)
|
26
|
-
stub.
|
26
|
+
expect(stub).to have_been_requested.once
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
describe ".create_batch" do
|
31
31
|
it "requests contact batch creation with parameters" do
|
32
32
|
stub_params = [{1 => 'Jane', 2 => "Doe"}, {1 => 'Paul', 2 => 'Tester'}]
|
33
|
-
stub = stub_request(:post, "https://
|
33
|
+
stub = stub_request(:post, "https://api.emarsys.net/api/v2/contact").with(:body => {'key_id' => 3, 'contacts' => stub_params}.to_json).to_return(standard_return_body)
|
34
34
|
Emarsys::Contact.create_batch(3, stub_params)
|
35
|
-
stub.
|
35
|
+
expect(stub).to have_been_requested.once
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
describe ".update_batch" do
|
40
40
|
it "requests contact batch update with parameters" do
|
41
41
|
stub_params = [{1 => 'Jane', 2 => "Doe"}, {1 => 'Paul', 2 => 'Tester'}]
|
42
|
-
stub = stub_request(:put, "https://
|
42
|
+
stub = stub_request(:put, "https://api.emarsys.net/api/v2/contact").with(:body => {'key_id' => 3, 'contacts' => stub_params}.to_json).to_return(standard_return_body)
|
43
43
|
Emarsys::Contact.update_batch(3, stub_params)
|
44
|
-
stub.
|
44
|
+
expect(stub).to have_been_requested.once
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
describe ".contact_history" do
|
49
49
|
it "requests contact histories" do
|
50
50
|
stub_params = [1,2,3]
|
51
|
-
stub = stub_request(:post, "https://
|
51
|
+
stub = stub_request(:post, "https://api.emarsys.net/api/v2/contact/getcontacthistory").with(:body => {'contacts' => stub_params}.to_json).to_return(standard_return_body)
|
52
52
|
Emarsys::Contact.contact_history(stub_params)
|
53
|
-
stub.
|
53
|
+
expect(stub).to have_been_requested.once
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
describe ".search" do
|
58
58
|
it "requests contact data based on search params" do
|
59
|
-
stub = stub_request(:post, "https://
|
59
|
+
stub = stub_request(:post, "https://api.emarsys.net/api/v2/contact/getdata").with(:body => {'keyId' => '3', 'keyValues' => ['jane.doe@example.com'], 'fields' => []}.to_json).to_return(standard_return_body)
|
60
60
|
Emarsys::Contact.search('3', ['jane.doe@example.com'])
|
61
|
-
stub.
|
61
|
+
expect(stub).to have_been_requested.once
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
describe ".export_registrations" do
|
66
66
|
it "requests contact data export based on parameters" do
|
67
67
|
stub_params = {distribution_method: 'local', time_range: ["2013-01-01","2013-12-31"], contact_fields: [1,2,3]}
|
68
|
-
stub = stub_request(:post, "https://
|
68
|
+
stub = stub_request(:post, "https://api.emarsys.net/api/v2/contact/getregistrations").with(:body => stub_params.to_json).to_return(standard_return_body)
|
69
69
|
Emarsys::Contact.export_registrations(stub_params)
|
70
|
-
stub.
|
70
|
+
expect(stub).to have_been_requested.once
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -76,4 +76,4 @@ describe Emarsys::Contact do
|
|
76
76
|
def contact_history(contact_ids_array)
|
77
77
|
post "contact/getcontacthistory", {'contacts' => contact_ids_array}
|
78
78
|
end
|
79
|
-
end
|
79
|
+
end
|
@@ -3,7 +3,9 @@ require 'spec_helper'
|
|
3
3
|
describe Emarsys::EmailCategory do
|
4
4
|
describe ".collection" do
|
5
5
|
it "requests all email_categories" do
|
6
|
-
|
6
|
+
expect(
|
7
|
+
stub_get("emailcategory") { Emarsys::EmailCategory.collection }
|
8
|
+
).to have_been_requested.once
|
7
9
|
end
|
8
10
|
end
|
9
|
-
end
|
11
|
+
end
|