ractive_campaign 0.1.4 → 0.1.6

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: 138c40a5a3a11cfdaca62219657f9757cade906aadda7ec72d34c742370c0963
4
- data.tar.gz: 1dc92c8d3b8653899c9133485d094536266d6e8e452473229ec04ca464d50f65
3
+ metadata.gz: 9408a43bb84b20b2b675f9b82726ea2766db83be2a8197e02ea2682f623aee4b
4
+ data.tar.gz: 70b0e772adc7678ae9f356abc1a1f3757d10b457a4dececefe0fbb77e22da2ce
5
5
  SHA512:
6
- metadata.gz: 44e8d36dda391fa212172e35f1b5059477e61f517906a23289accc539b516234593633526624d9904429ce15581a3f807e08d7c18f315ad15e965889cffbd009
7
- data.tar.gz: c1dffb39c97ad93b7d72004f0e625e4e09387d2b916c9d0792dde586deb8a57ebbda4e5e22b59949db9f30ff10fc1ea301b6580e9e801fb2a19254f674c47ec8
6
+ metadata.gz: 4c2d039ee5f958c807e93e4af17bf06a5078846c272899d55dedaece4a9da5b1a78c80c5d337837c9cb8da019822a718e5dbbc4636cb4ea39cd88f281d32edf1
7
+ data.tar.gz: 35dba20d5d097abf722d7cd712188e97bbae69c5c34437f1799d41570a8ec0b37ae07ae5ad2a2cae5a30964bf93ba18bc30f045c9a6198a3c110e5d0d01cbd7b
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.6
2
+ TargetRubyVersion: 2.7
3
3
 
4
4
  Style/StringLiterals:
5
5
  Enabled: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.6] - 2024-080-29
4
+ ### Changed
5
+
6
+ - update ruby version to 2.7
7
+
8
+ ## [0.1.5] - 2021-11-19
9
+ ### Changed
10
+
11
+ - when adding a tag to a contact, create it if it doesn't exist
12
+
3
13
  ## [0.1.4] - 2021-11-19
4
14
  ### Changed
5
15
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ractive_campaign (0.1.4)
4
+ ractive_campaign (0.1.6)
5
5
  activemodel (~> 6.1.4)
6
6
  dry-configurable (~> 0.12.1)
7
7
  faraday (~> 1.8.0)
@@ -10,29 +10,33 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activemodel (6.1.4.1)
14
- activesupport (= 6.1.4.1)
15
- activesupport (6.1.4.1)
13
+ activemodel (6.1.7.8)
14
+ activesupport (= 6.1.7.8)
15
+ activesupport (6.1.7.8)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
17
  i18n (>= 1.6, < 2)
18
18
  minitest (>= 5.1)
19
19
  tzinfo (~> 2.0)
20
20
  zeitwerk (~> 2.3)
21
- addressable (2.8.0)
22
- public_suffix (>= 2.0.2, < 5.0)
21
+ addressable (2.8.7)
22
+ public_suffix (>= 2.0.2, < 7.0)
23
23
  ast (2.4.2)
24
+ base64 (0.2.0)
25
+ bigdecimal (3.1.8)
24
26
  byebug (11.1.3)
25
27
  coderay (1.1.3)
26
- concurrent-ruby (1.1.9)
27
- crack (0.4.5)
28
+ concurrent-ruby (1.3.4)
29
+ crack (1.0.0)
30
+ bigdecimal
28
31
  rexml
29
- diff-lcs (1.4.4)
30
- dotenv (2.7.6)
32
+ diff-lcs (1.5.1)
33
+ dotenv (3.1.2)
31
34
  dry-configurable (0.12.1)
32
35
  concurrent-ruby (~> 1.0)
33
36
  dry-core (~> 0.5, >= 0.5.0)
34
- dry-core (0.7.1)
37
+ dry-core (0.9.1)
35
38
  concurrent-ruby (~> 1.0)
39
+ zeitwerk (~> 2.6)
36
40
  faraday (1.8.0)
37
41
  faraday-em_http (~> 1.0)
38
42
  faraday-em_synchrony (~> 1.0)
@@ -48,73 +52,83 @@ GEM
48
52
  faraday-em_synchrony (1.0.0)
49
53
  faraday-excon (1.1.0)
50
54
  faraday-httpclient (1.0.1)
51
- faraday-net_http (1.0.1)
55
+ faraday-net_http (1.0.2)
52
56
  faraday-net_http_persistent (1.2.0)
53
57
  faraday-patron (1.0.0)
54
58
  faraday-rack (1.0.0)
55
59
  faraday_middleware (1.2.0)
56
60
  faraday (~> 1.0)
57
- hashdiff (1.0.1)
58
- httplog (1.5.0)
59
- rack (>= 1.0)
61
+ hashdiff (1.1.1)
62
+ httplog (1.7.0)
63
+ rack (>= 2.0)
60
64
  rainbow (>= 2.0.0)
61
- i18n (1.8.11)
65
+ i18n (1.14.5)
62
66
  concurrent-ruby (~> 1.0)
63
- method_source (1.0.0)
64
- minitest (5.14.4)
65
- multipart-post (2.1.1)
66
- parallel (1.21.0)
67
- parser (3.0.2.0)
67
+ json (2.7.2)
68
+ language_server-protocol (3.17.0.3)
69
+ method_source (1.1.0)
70
+ minitest (5.25.1)
71
+ multipart-post (2.4.1)
72
+ parallel (1.26.3)
73
+ parser (3.3.4.2)
68
74
  ast (~> 2.4.1)
69
- pry (0.13.1)
75
+ racc
76
+ pry (0.14.2)
70
77
  coderay (~> 1.1)
71
78
  method_source (~> 1.0)
72
- pry-byebug (3.9.0)
79
+ pry-byebug (3.10.1)
73
80
  byebug (~> 11.0)
74
- pry (~> 0.13.0)
75
- public_suffix (4.0.6)
76
- rack (2.2.3)
77
- rainbow (3.0.0)
78
- rake (13.0.6)
79
- regexp_parser (2.1.1)
80
- rexml (3.2.5)
81
- rspec (3.10.0)
82
- rspec-core (~> 3.10.0)
83
- rspec-expectations (~> 3.10.0)
84
- rspec-mocks (~> 3.10.0)
85
- rspec-core (3.10.1)
86
- rspec-support (~> 3.10.0)
87
- rspec-expectations (3.10.1)
81
+ pry (>= 0.13, < 0.15)
82
+ public_suffix (6.0.1)
83
+ racc (1.8.1)
84
+ rack (3.1.7)
85
+ rainbow (3.1.1)
86
+ rake (13.2.1)
87
+ regexp_parser (2.9.2)
88
+ rexml (3.3.6)
89
+ strscan
90
+ rspec (3.13.0)
91
+ rspec-core (~> 3.13.0)
92
+ rspec-expectations (~> 3.13.0)
93
+ rspec-mocks (~> 3.13.0)
94
+ rspec-core (3.13.0)
95
+ rspec-support (~> 3.13.0)
96
+ rspec-expectations (3.13.2)
88
97
  diff-lcs (>= 1.2.0, < 2.0)
89
- rspec-support (~> 3.10.0)
90
- rspec-mocks (3.10.2)
98
+ rspec-support (~> 3.13.0)
99
+ rspec-mocks (3.13.1)
91
100
  diff-lcs (>= 1.2.0, < 2.0)
92
- rspec-support (~> 3.10.0)
93
- rspec-support (3.10.3)
94
- rubocop (1.23.0)
101
+ rspec-support (~> 3.13.0)
102
+ rspec-support (3.13.1)
103
+ rubocop (1.65.1)
104
+ json (~> 2.3)
105
+ language_server-protocol (>= 3.17.0)
95
106
  parallel (~> 1.10)
96
- parser (>= 3.0.0.0)
107
+ parser (>= 3.3.0.2)
97
108
  rainbow (>= 2.2.2, < 4.0)
98
- regexp_parser (>= 1.8, < 3.0)
99
- rexml
100
- rubocop-ast (>= 1.12.0, < 2.0)
109
+ regexp_parser (>= 2.4, < 3.0)
110
+ rexml (>= 3.2.5, < 4.0)
111
+ rubocop-ast (>= 1.31.1, < 2.0)
101
112
  ruby-progressbar (~> 1.7)
102
- unicode-display_width (>= 1.4.0, < 3.0)
103
- rubocop-ast (1.13.0)
104
- parser (>= 3.0.1.1)
105
- ruby-progressbar (1.11.0)
113
+ unicode-display_width (>= 2.4.0, < 3.0)
114
+ rubocop-ast (1.32.1)
115
+ parser (>= 3.3.1.0)
116
+ ruby-progressbar (1.13.0)
106
117
  ruby2_keywords (0.0.5)
107
- tzinfo (2.0.4)
118
+ strscan (3.1.0)
119
+ tzinfo (2.0.6)
108
120
  concurrent-ruby (~> 1.0)
109
- unicode-display_width (2.1.0)
110
- vcr (6.0.0)
111
- webmock (3.14.0)
121
+ unicode-display_width (2.5.0)
122
+ vcr (6.3.1)
123
+ base64
124
+ webmock (3.23.1)
112
125
  addressable (>= 2.8.0)
113
126
  crack (>= 0.3.2)
114
127
  hashdiff (>= 0.4.0, < 2.0.0)
115
- zeitwerk (2.5.1)
128
+ zeitwerk (2.6.17)
116
129
 
117
130
  PLATFORMS
131
+ arm64-darwin-21
118
132
  x86_64-linux
119
133
 
120
134
  DEPENDENCIES
@@ -24,14 +24,22 @@ module ActiveCampaign
24
24
  ContactTag.get "#{self.class.endpoint}/#{id}/contactTags"
25
25
  end
26
26
 
27
- # @example Apply a tag to a contact.
27
+ # @example Add a tag to a contact.
28
28
  #
29
29
  # ActiveCampaign::Contact.find(1).add_tag "tag-name"
30
30
  #
31
- def add_tag(tag)
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::ContactTag.create contact: id, tag: tag_id if tag_id
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
@@ -3,5 +3,11 @@
3
3
  module ActiveCampaign
4
4
  class Tag < Model # :nodoc:
5
5
  define_attributes :tag, :tagType, :description
6
+
7
+ def create
8
+ self.tagType ||= "contact"
9
+
10
+ super
11
+ end
6
12
  end
7
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveCampaign
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.6"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ractive_campaign
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wedson Lima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-19 00:00:00.000000000 Z
11
+ date: 2024-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -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.6
125
126
  post_install_message:
126
127
  rdoc_options: []
127
128
  require_paths:
@@ -130,14 +131,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
130
131
  requirements:
131
132
  - - ">="
132
133
  - !ruby/object:Gem::Version
133
- version: 2.6.0
134
+ version: 2.7.8
134
135
  required_rubygems_version: !ruby/object:Gem::Requirement
135
136
  requirements:
136
137
  - - ">="
137
138
  - !ruby/object:Gem::Version
138
139
  version: '0'
139
140
  requirements: []
140
- rubygems_version: 3.0.3.1
141
+ rubygems_version: 3.1.6
141
142
  signing_key:
142
143
  specification_version: 4
143
144
  summary: Ruby API wrapper for ActiveCampaign API v3