maropost 0.6.0 → 0.7.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 +4 -4
- data/lib/maropost/api.rb +1 -1
- data/lib/maropost/contact.rb +3 -3
- data/lib/maropost/do_not_mail_list.rb +6 -11
- 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: a96b51fcc2cf29e3e393dee5c3e94b577add066b
|
4
|
+
data.tar.gz: e66ccd7a68abf57ad2e6e790884ef7f0278c2807
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64d0a1efc1f82d8ba7ad4df2bb8cf6338c3f2d122bc9ebb4317c81e01af3fd1ae74ecda850c01f9863839a4849e37410e4b696dddc73d1130b63d25cd5d03cf7
|
7
|
+
data.tar.gz: d4c377258d87e1af223709719538b1fcd5b24eaa618d944d799d7b29ab35952f09a3eff21a6a2177d28d29ddba569c43fb7d1eca74086161d5b142322e3e7f3d
|
data/lib/maropost/api.rb
CHANGED
data/lib/maropost/contact.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Maropost
|
4
4
|
class Contact
|
5
5
|
ATTRIBUTES = %i[
|
6
|
-
|
6
|
+
allow_emails
|
7
7
|
id
|
8
8
|
email
|
9
9
|
phone_number
|
@@ -35,14 +35,14 @@ module Maropost
|
|
35
35
|
self.email = data[:email]
|
36
36
|
self.phone_number = data[:phone]
|
37
37
|
self.cell_phone_number = data[:cell_phone_number]
|
38
|
-
self.
|
38
|
+
self.allow_emails = data.fetch(:allow_emails) { !DoNotMailList.exists?(self) }
|
39
39
|
self.errors = []
|
40
40
|
self.lists = {}
|
41
41
|
initialize_lists(data)
|
42
42
|
end
|
43
43
|
|
44
44
|
def allow_emails?
|
45
|
-
|
45
|
+
allow_emails
|
46
46
|
end
|
47
47
|
|
48
48
|
def subscribed_to_any_lists?
|
@@ -14,9 +14,8 @@ module Maropost
|
|
14
14
|
)
|
15
15
|
response = JSON.parse(service.execute!.body)
|
16
16
|
response['id'].present?
|
17
|
-
rescue RestClient::ResourceNotFound, RestClient::BadRequest
|
18
|
-
|
19
|
-
contact
|
17
|
+
rescue RestClient::ResourceNotFound, RestClient::BadRequest
|
18
|
+
false
|
20
19
|
end
|
21
20
|
|
22
21
|
def create(contact)
|
@@ -27,10 +26,8 @@ module Maropost
|
|
27
26
|
payload: payload
|
28
27
|
)
|
29
28
|
service.execute!
|
30
|
-
|
31
|
-
|
32
|
-
contact.errors << "Unable to subscribe contact. Error: #{e.message}"
|
33
|
-
contact
|
29
|
+
rescue RestClient::UnprocessableEntity, RestClient::BadRequest
|
30
|
+
false
|
34
31
|
end
|
35
32
|
|
36
33
|
def delete(contact)
|
@@ -42,10 +39,8 @@ module Maropost
|
|
42
39
|
}
|
43
40
|
)
|
44
41
|
service.execute!
|
45
|
-
|
46
|
-
|
47
|
-
contact.errors << "Unable to unsubscribe contact. Error: #{e.message}"
|
48
|
-
contact
|
42
|
+
rescue RestClient::UnprocessableEntity, RestClient::BadRequest
|
43
|
+
false
|
49
44
|
end
|
50
45
|
end
|
51
46
|
end
|
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.
|
4
|
+
version: 0.7.0
|
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-10-
|
22
|
+
date: 2017-10-20 00:00:00.000000000 Z
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
name: rest-client
|