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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95d7bdb92ea222969c7110ba81031aef9941cd179b6bc0b6452a73fa0b606827
4
- data.tar.gz: a2ffb27694a3ca55544b15646e184d69babb90c8e86856db539e55180f3f27b9
3
+ metadata.gz: ab79d9d6e6b77e44fe80b172b609438c113e0d0708b03a464cc72e5def66aa1c
4
+ data.tar.gz: 57d478c79b5ad16617e8b20901916be66dc1ebbb4f84c2d9ee486a6e41790f9e
5
5
  SHA512:
6
- metadata.gz: 79e98b61a6c97879d0f4e7519949f33902313188d5541b55939bb8c8582c0cc8e3e710551a6ba3eb45347713b5e3857a5068234d4c97e3b268d61219b8c57bc3
7
- data.tar.gz: 60e566934c0a3556d002d5a7cab2eb41c04cf43b3a8e3e147ddb4b144b9909374c850617b4b7e39fe51a82e27fec1432384995318d84dea1c9bed639e238c1fd
6
+ metadata.gz: de36d1ba3039ca03ebb8c31b30d67576b3f3c8ec0bac4b4513166bbfd5864f8c3d3bbfba3d1cb0461eac7d30eca82d5702d67b67c5be02158a30df25e7b100e9
7
+ data.tar.gz: 970d89b3d0da7daa512c4f1fa51162f1c57c08b0c995557dafb279b6494f03edb7ab1a1b04cae8684a8d492e4ab6968611aaab7bc1dc3654541c5adfb05f17cd
@@ -40,7 +40,7 @@ module Cordial
40
40
 
41
41
  # Create a new contact.
42
42
  #
43
- # If the contact already exists it will be updated.
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`
@@ -1,3 +1,3 @@
1
1
  module Cordial
2
- VERSION = '1.2.0'.freeze
2
+ VERSION = '1.3.0'.freeze
3
3
  end
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.2.0
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-02-22 00:00:00.000000000 Z
11
+ date: 2020-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty