maropost 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/maropost/api.rb +22 -5
- data/lib/maropost/contact.rb +12 -0
- data/lib/maropost/version.rb +1 -1
- 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: ab774a3e10205f14b11eb4d32cd6a0f6f90fd47e
|
4
|
+
data.tar.gz: b4141781b430fe4b4d2549db902c87d41de05d5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0364c6faffd676812f234bc804537969a9f975e8a4fbe9de74f635268f670ec93b7343f2ae149f057f8a80e2dcb5f37925193c7bc4178f9f90b43f0a6f3d192c
|
7
|
+
data.tar.gz: 0d72e7397284499d31c21c99ab640b14f70a0e83e1f079b013c50f86541788ad8db5fe0813bcf6ebe71e808e1aea066202fb9722d3824115ec21de0ee20922b8
|
data/lib/maropost/api.rb
CHANGED
@@ -54,18 +54,35 @@ module Maropost
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def change_email(old_email, new_email)
|
57
|
-
|
57
|
+
old_email_contact = find(old_email)
|
58
|
+
new_email_contact = find(new_email)
|
58
59
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
60
|
+
contact = update_email(old_email_contact, new_email_contact, new_email)
|
61
|
+
|
62
|
+
update_do_not_mail_list(contact) if contact
|
63
63
|
|
64
64
|
contact
|
65
65
|
end
|
66
66
|
|
67
67
|
private
|
68
68
|
|
69
|
+
def update_email(old_contact, new_contact, new_email)
|
70
|
+
contact = nil
|
71
|
+
|
72
|
+
if old_contact.present? && new_contact.present?
|
73
|
+
new_contact = new_contact.merge_settings(old_contact)
|
74
|
+
contact = update(new_contact)
|
75
|
+
Maropost::DoNotMailList.create(old_contact)
|
76
|
+
elsif old_contact.present?
|
77
|
+
old_contact.email = new_email
|
78
|
+
contact = update(old_contact)
|
79
|
+
elsif new_contact.present?
|
80
|
+
contact = update(new_contact)
|
81
|
+
end
|
82
|
+
|
83
|
+
contact
|
84
|
+
end
|
85
|
+
|
69
86
|
def create_or_update_payload(contact)
|
70
87
|
{
|
71
88
|
contact: {
|
data/lib/maropost/contact.rb
CHANGED
@@ -53,6 +53,18 @@ module Maropost
|
|
53
53
|
{ cell_phone_number: cell_phone_number }.merge(lists)
|
54
54
|
end
|
55
55
|
|
56
|
+
def merge_settings(old_contact)
|
57
|
+
self.phone_number = old_contact.phone_number
|
58
|
+
self.cell_phone_number = old_contact.cell_phone_number
|
59
|
+
self.allow_emails = old_contact.allow_emails
|
60
|
+
|
61
|
+
lists.each do |list|
|
62
|
+
lists[list] == '1' ? list : old_contact.lists[list]
|
63
|
+
end
|
64
|
+
|
65
|
+
self
|
66
|
+
end
|
67
|
+
|
56
68
|
private
|
57
69
|
|
58
70
|
def initialize_lists(opts = {})
|
data/lib/maropost/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maropost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael van den Beuken
|
@@ -19,7 +19,7 @@ authors:
|
|
19
19
|
autorequire:
|
20
20
|
bindir: bin
|
21
21
|
cert_chain: []
|
22
|
-
date: 2017-11-
|
22
|
+
date: 2017-11-15 00:00:00.000000000 Z
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
name: rest-client
|