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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1943af483f1ff4babeca7459c1cf9abfe6f72310
4
- data.tar.gz: b387277b486845a2a7c1cdcdedf0d40ff7fdb707
3
+ metadata.gz: 18a4b948ca6129f44102965cf04b6fd51bbd432c
4
+ data.tar.gz: 13245ed46d9523c72d6c14d6071f1d6cbeb8a1c4
5
5
  SHA512:
6
- metadata.gz: b03ccb71acbabb401381ae3883f204530f168771713fa075c46faf320d8edef785869b4fffc91134cf25c3829c29dc0acc33950815c13eb973d5d423351a50da
7
- data.tar.gz: 01336632d7109dcd761f1922f5b07da6440f806edf56546a6a3d5cb520b3cd9517caab4104442190043ccf4ac6a5f8e233dcddafb9f714d3f375f976aa3fddbc
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Emarsys
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
@@ -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.1
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-05 00:00:00.000000000 Z
11
+ date: 2017-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client