ractive_campaign 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/active_campaign/models/contact.rb +13 -3
- data/lib/active_campaign/models/tag.rb +6 -0
- data/lib/active_campaign/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0f3b24a31bfe00c8c7bbe97b2a480cb6c7d5ea0838e01b7beb79311e3ee5d43
|
4
|
+
data.tar.gz: 9ca59df1246b16a23d7640ce60552328a9e0802f438e645348e91e728cf9db66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95566c3ad4cf971380b2486058f315c16cb0f8ad5263e145167d40d96ee30d22c85079a5d4ee8868b1effc8a37f7d32d2e1d30fc215f4db555bb6544f309b589
|
7
|
+
data.tar.gz: 0ea82c9eb5b94efb4e881b10b603e8c035f226630f67115f173c28dcdae4b202e011710bedf11e73df880c9118c67778a56c7efdab97619de6b18eb09335bcde
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -24,14 +24,22 @@ module ActiveCampaign
|
|
24
24
|
ContactTag.get "#{self.class.endpoint}/#{id}/contactTags"
|
25
25
|
end
|
26
26
|
|
27
|
-
# @example
|
27
|
+
# @example Add a tag to a contact.
|
28
28
|
#
|
29
29
|
# ActiveCampaign::Contact.find(1).add_tag "tag-name"
|
30
30
|
#
|
31
|
-
|
31
|
+
# Don't create the tag if it doesn't exist.
|
32
|
+
#
|
33
|
+
# ActiveCampaign::Contact.find(1).add_tag "tag-name", create_if_not_found: false
|
34
|
+
#
|
35
|
+
def add_tag(tag, create_if_not_found: true)
|
32
36
|
tag_id = Tag.find_by(tag: tag)&.id
|
33
37
|
|
34
|
-
ActiveCampaign::
|
38
|
+
tag_id = ActiveCampaign::Tag.create(tag: tag)&.id if !tag_id && create_if_not_found
|
39
|
+
|
40
|
+
return false unless tag_id
|
41
|
+
|
42
|
+
ActiveCampaign::ContactTag.create contact: id, tag: tag_id
|
35
43
|
end
|
36
44
|
|
37
45
|
# @example Remove a tag from a contact.
|
@@ -41,6 +49,8 @@ module ActiveCampaign
|
|
41
49
|
def remove_tag(tag)
|
42
50
|
tag_id = Tag.find_by(tag: tag)&.id
|
43
51
|
|
52
|
+
return false unless tag_id
|
53
|
+
|
44
54
|
contact_tag = contact_tags.filter_map { |ct| ct if ct.tag == tag_id }.last
|
45
55
|
|
46
56
|
contact_tag&.destroy
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ractive_campaign
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wedson Lima
|
@@ -122,6 +122,7 @@ metadata:
|
|
122
122
|
homepage_uri: https://github.com/wedsonlima/ractive_campaign
|
123
123
|
source_code_uri: https://github.com/wedsonlima/ractive_campaign
|
124
124
|
changelog_uri: https://github.com/wedsonlima/ractive_campaign/blob/main/CHANGELOG.md
|
125
|
+
documentation_uri: https://www.rubydoc.info/gems/ractive_campaign/0.1.5
|
125
126
|
post_install_message:
|
126
127
|
rdoc_options: []
|
127
128
|
require_paths:
|