cordial 1.2.0 → 1.3.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/cordial/contacts.rb +24 -1
- data/lib/cordial/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab79d9d6e6b77e44fe80b172b609438c113e0d0708b03a464cc72e5def66aa1c
|
4
|
+
data.tar.gz: 57d478c79b5ad16617e8b20901916be66dc1ebbb4f84c2d9ee486a6e41790f9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de36d1ba3039ca03ebb8c31b30d67576b3f3c8ec0bac4b4513166bbfd5864f8c3d3bbfba3d1cb0461eac7d30eca82d5702d67b67c5be02158a30df25e7b100e9
|
7
|
+
data.tar.gz: 970d89b3d0da7daa512c4f1fa51162f1c57c08b0c995557dafb279b6494f03edb7ab1a1b04cae8684a8d492e4ab6968611aaab7bc1dc3654541c5adfb05f17cd
|
data/lib/cordial/contacts.rb
CHANGED
@@ -40,7 +40,7 @@ module Cordial
|
|
40
40
|
|
41
41
|
# Create a new contact.
|
42
42
|
#
|
43
|
-
# If the contact already exists it will
|
43
|
+
# If the contact already exists it will fail.
|
44
44
|
# @example Usage.
|
45
45
|
# Cordial::Contacts.create(
|
46
46
|
# email: 'hello@world.earth',
|
@@ -61,6 +61,29 @@ module Cordial
|
|
61
61
|
}.compact.merge(attribute_list).to_json)
|
62
62
|
end
|
63
63
|
|
64
|
+
# Update an existing contact.
|
65
|
+
#
|
66
|
+
# If the contact doesn't exist it will fail.
|
67
|
+
# @example Usage.
|
68
|
+
# Cordial::Contacts.update(
|
69
|
+
# email: 'hello@world.earth',
|
70
|
+
# attribute_list: {
|
71
|
+
# some_attribute: 'your-custom-value'
|
72
|
+
# },
|
73
|
+
# subscribe_status: 'subscribed'
|
74
|
+
# )
|
75
|
+
def self.update(email:, attribute_list: {}, subscribe_status: nil)
|
76
|
+
client.put("/contacts/email:#{email}", body: {
|
77
|
+
channels: {
|
78
|
+
email: {
|
79
|
+
address: email,
|
80
|
+
subscribeStatus: subscribe_status
|
81
|
+
}.compact
|
82
|
+
},
|
83
|
+
forceSubscribe: subscribe_status == 'subscribed' || nil
|
84
|
+
}.compact.merge(attribute_list).to_json)
|
85
|
+
end
|
86
|
+
|
64
87
|
# Unsubscribe a contact.
|
65
88
|
#
|
66
89
|
# @param channel [String] The channel to unsubscribe`
|
data/lib/cordial/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cordial
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Hood
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|