mautic 2.3.11 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54130da5f454542319794381488da40d7ddf9b44ae18e9071cee61a4ae6cee65
4
- data.tar.gz: f81597d7b092e25ed9cc7f18905e681ae92f1afc61e1cd143f2fecb1f704b026
3
+ metadata.gz: c03bde50c40a75d830eb7e281af2ecc36143b62a9db7b30647a26bb1044013d4
4
+ data.tar.gz: 0eda55684550a7512e911792846a0d7646ba4da0a1a15a216ecc6836876deda5
5
5
  SHA512:
6
- metadata.gz: fdf11781f6797c3174c5e49612d0369660b7fde520cdfecc237396879b110bbe3ac56fd23c6ffd20dc9cf1878ea76faec45e0132930c3992afffd92c3b66cd53
7
- data.tar.gz: 5d82c6eed700f377967347e8bc0bb759557d3f006a7a3ec4fb709a78026086eb8dfaedc6be3c0d3fef667a17a9b2cf472f8819ddfcfae757f2442d6b077c11b6
6
+ metadata.gz: 7382580246a31dcc47c03fb1c9ef98168fd4a0429439b8b45794db9f8dc263d839866a3f3e4c0c4aeab741d074c8fa6029d0cef25be67e0a279b2f68b1d8d8c0
7
+ data.tar.gz: 8e801c01c6aec779c05e7f858dfdfe45dc3ca06b21c86086e42f4f0a180a0251e1ab02bf4edb84ed0c2c91658b7e8e8f9370b81511b04324ed10efa2bbdf6e15
@@ -0,0 +1,22 @@
1
+ module Mautic
2
+ class Campaign < Model
3
+
4
+ # @see https://developer.mautic.org/#add-contact-to-a-campaign
5
+ # @param [Integer] id of Mautic::Contact
6
+ def add_contact!(id)
7
+ json = @connection.request(:post, "api/campaigns/#{self.id}/contact/#{id}/add")
8
+ json["success"]
9
+ rescue RequestError => _e
10
+ false
11
+ end
12
+
13
+ # @see https://developer.mautic.org/#remove-contact-from-a-campaign
14
+ # @param [Integer] id of Mautic::Contact
15
+ def remove_contact!(id)
16
+ json = @connection.request(:post, "api/campaigns/#{self.id}/contact/#{id}/remove")
17
+ json["success"]
18
+ rescue RequestError => _e
19
+ false
20
+ end
21
+ end
22
+ end
@@ -117,6 +117,23 @@ module Mautic
117
117
 
118
118
  # !endgroup
119
119
 
120
+ # @!group Campaigns
121
+
122
+ # @return [Array<Mautic::Campaign>]
123
+ def campaigns
124
+ return @campaigns if @campaigns
125
+
126
+ json = @connection.request(:get, "api/contacts/#{id}/campaigns")
127
+
128
+ @campaigns = json["campaigns"].collect do |_campaign_id, campaign_attributes|
129
+ Mautic::Campaign.new @connection, campaign_attributes
130
+ end
131
+ rescue RequestError => _e
132
+ []
133
+ end
134
+
135
+ # !endgroup
136
+
120
137
  private
121
138
 
122
139
  def clear_change
@@ -1,3 +1,3 @@
1
1
  module Mautic
2
- VERSION = '2.3.11'
2
+ VERSION = '2.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mautic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.11
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukáš Pokorný
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-02 00:00:00.000000000 Z
11
+ date: 2020-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -174,6 +174,7 @@ files:
174
174
  - app/jobs/mautic/application_job.rb
175
175
  - app/mailers/mautic/application_mailer.rb
176
176
  - app/models/mautic/application_record.rb
177
+ - app/models/mautic/campaign.rb
177
178
  - app/models/mautic/connection.rb
178
179
  - app/models/mautic/connections/oauth2.rb
179
180
  - app/models/mautic/contact.rb
@@ -207,7 +208,7 @@ licenses:
207
208
  - MIT
208
209
  metadata:
209
210
  allowed_push_host: https://rubygems.org
210
- post_install_message:
211
+ post_install_message:
211
212
  rdoc_options: []
212
213
  require_paths:
213
214
  - lib
@@ -222,8 +223,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
223
  - !ruby/object:Gem::Version
223
224
  version: '0'
224
225
  requirements: []
225
- rubygems_version: 3.0.8
226
- signing_key:
226
+ rubygems_version: 3.0.6
227
+ signing_key:
227
228
  specification_version: 4
228
229
  summary: Ruby on Rails Mautic integration
229
230
  test_files: