emarsys 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/emarsys/data_objects/contact.rb +14 -0
- data/lib/emarsys/version.rb +1 -1
- data/spec/emarsys/data_objects/contact_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18a4b948ca6129f44102965cf04b6fd51bbd432c
|
4
|
+
data.tar.gz: 13245ed46d9523c72d6c14d6071f1d6cbeb8a1c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d2e155673fcd7e194ca49e22f6b4464d80c40cff79dd2bc642ed55b207b5adb2686c330abe6dc7b473676ca481e58bc627a571180a97ed4b27c15a6b62e47b3
|
7
|
+
data.tar.gz: e8313f9bae06d8ef876ae08ec4af7fc866829afb2cd61f94d259170021837ad29a3725bfd41973fd7c0df3bdce13a748cc9e33c6a8a94e0a110c953a973e2681
|
@@ -81,6 +81,20 @@ module Emarsys
|
|
81
81
|
put account, path, {'key_id' => transform_key_id(key_id), 'contacts' => batch_params(params)}
|
82
82
|
end
|
83
83
|
|
84
|
+
# Delete a contact. The given params are transformed to emarsys ids.
|
85
|
+
#
|
86
|
+
# @param key_id [Integer, String] internal id of key field
|
87
|
+
# @param key_value [Integer, String] value of interal id field
|
88
|
+
# @return [Hash]
|
89
|
+
# @example
|
90
|
+
# Emarsys::Contact.update('app_id', 23, {:firstname => "Jon", :lastname => "Doe"})
|
91
|
+
# Emarsys::Contact.update('3', 'john.doe@example.com', {'1' => "Jon", '2' => "Doe"}, true)
|
92
|
+
def delete(key_id:, key_value:, account: nil)
|
93
|
+
path = "contact/delete"
|
94
|
+
transformed_key_id = transform_key_id(key_id)
|
95
|
+
post account, path, {'key_id' => transformed_key_id, transformed_key_id => key_value}
|
96
|
+
end
|
97
|
+
|
84
98
|
# Get list of emails send to a contact
|
85
99
|
#
|
86
100
|
# @param contacts [array] Array of contact ids
|
data/lib/emarsys/version.rb
CHANGED
@@ -71,6 +71,14 @@ describe Emarsys::Contact do
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
+
describe ".delete" do
|
75
|
+
it "deletes contact" do
|
76
|
+
stub = stub_request(:post, "https://api.emarsys.net/api/v2/contact/delete").with(:body => {'key_id' => 3, 3 => 'jane.doe@example.com'}.to_json).to_return(standard_return_body)
|
77
|
+
Emarsys::Contact.delete(key_id: 3, key_value: 'jane.doe@example.com')
|
78
|
+
expect(stub).to have_been_requested.once
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
74
82
|
describe ".contact_history" do
|
75
83
|
it "requests contact histories" do
|
76
84
|
stub_params = [1,2,3]
|
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.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schoppmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|