mautic 2.4.0 → 2.5.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/README.md +15 -3
- data/app/models/mautic/company_field.rb +11 -0
- data/app/models/mautic/contact_field.rb +11 -0
- data/app/models/mautic/form.rb +30 -1
- data/app/views/layouts/mautic/application.html.erb +0 -2
- data/lib/mautic/proxy.rb +2 -2
- data/lib/mautic/submissions/form.rb +6 -0
- data/lib/mautic/version.rb +1 -1
- metadata +5 -9
- data/app/assets/config/mautic_manifest.js +0 -2
- data/app/assets/javascripts/mautic/application.js +0 -14
- data/app/assets/javascripts/mautic/mautic_connections.js +0 -2
- data/app/assets/stylesheets/mautic/application.css +0 -15
- data/app/assets/stylesheets/mautic/mautic_connections.css +0 -4
- data/app/assets/stylesheets/scaffold.css +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb4e903dff064ccd272c769b31a9692b0479cc93f86d6caa7586f73adb0190d6
|
4
|
+
data.tar.gz: a96abb5a2f455fb0026bfe56be46640f49d6fdcf89673f27fb59ebae8f66aa42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49997f77ce24fa44c9a3ec96a785b31d0ae382ccd754e9c3c89b1adabf33869b31dc3fbc0aaf25f38b3d988192cafa6ccc7d617b7c90a53ae516a6f218b8fa38
|
7
|
+
data.tar.gz: ab3974fd38ba6ce83c8b489634bce1a637b18effdddbcb779b98e5531d865cf4bd6363c899b57927a9374a409b35cc0f27865cffca7086963954bbfad9aa9828
|
data/README.md
CHANGED
@@ -94,11 +94,11 @@ end
|
|
94
94
|
```
|
95
95
|
Get specify contact:
|
96
96
|
```ruby
|
97
|
-
contact = m.contact.find(1) # =>
|
97
|
+
contact = m.contact.find(1) # => #<Mautic::Contact id=1 ...>
|
98
98
|
```
|
99
99
|
Collections of contacts:
|
100
100
|
```ruby
|
101
|
-
m.contacts.where("gmail").each do |contact|
|
101
|
+
m.contacts.where(search: "gmail").each do |contact|
|
102
102
|
#<Mautic::Contact id=12 ...>
|
103
103
|
#<Mautic::Contact id=21 ...>
|
104
104
|
#<Mautic::Contact id=99 ...>
|
@@ -115,7 +115,7 @@ end
|
|
115
115
|
contact.save # => false
|
116
116
|
contact.errors # => [{"code"=>400, "message"=>"email: This field is required.", "details"=>{"email"=>["This field is required."]}}]
|
117
117
|
```
|
118
|
-
Do not contact
|
118
|
+
#### Do not contact
|
119
119
|
```ruby
|
120
120
|
contact.do_not_contact? # => false
|
121
121
|
contact.do_not_contact! message: "Some reason"
|
@@ -127,6 +127,18 @@ end
|
|
127
127
|
contact.remove_do_not_contact!
|
128
128
|
contact.do_not_contact? # => false
|
129
129
|
```
|
130
|
+
#### Campaigns
|
131
|
+
list of contacts campaigns (where contact is a member) and remove it from one
|
132
|
+
```ruby
|
133
|
+
contact.campaigns #=> [Mautic::Campaign, ...]
|
134
|
+
campaign = contact.campaigns.find { |campaign| campaign.name == "Newsletter" }
|
135
|
+
campaign.remove_contact! contact.id
|
136
|
+
```
|
137
|
+
or add contact back
|
138
|
+
```ruby
|
139
|
+
campaign = connection.campaigns.where(search: "Newsletter").first
|
140
|
+
campaign.add_contact! contact.id
|
141
|
+
```
|
130
142
|
Of course you can use more than contact: `assets`, `emails`, `companies`, `forms`, `points` ...
|
131
143
|
### Gem provides simple Mautic form submit
|
132
144
|
There are two options of usage:
|
data/app/models/mautic/form.rb
CHANGED
@@ -5,5 +5,34 @@ module Mautic
|
|
5
5
|
self.attributes = { name: source['name'], fields: source['fields'] } if source.is_a? Hash
|
6
6
|
end
|
7
7
|
|
8
|
+
# @param [Integer] submission_id
|
9
|
+
# @return Mautic::Submissions::Form
|
10
|
+
# @see https://developer.mautic.org/#get-form-submission
|
11
|
+
def submission(submission_id)
|
12
|
+
json = @connection.request(:get, "api/forms/#{id}/submissions/#{submission_id}")
|
13
|
+
Mautic::Submissions::Form.new @connection, json["submission"]
|
14
|
+
rescue Mautic::RecordNotFound => _e
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
|
18
|
+
# @see https://developer.mautic.org/#list-form-submissions
|
19
|
+
# @param [Hash] options
|
20
|
+
# @option options [String] :search String or search command to filter entities by.
|
21
|
+
# @option options [String] :start Starting row for the entities returned. Defaults to 0.
|
22
|
+
# @option options [String] :limit Limit number of entities to return. Defaults to the system configuration for pagination (30).
|
23
|
+
# @option options [String] :orderBy Column to sort by. Can use any column listed in the response, also can use column of joined table with prefix. Sort by submitted date is s.date_submitted
|
24
|
+
# @option options [String] :orderByDir Sort direction: asc or desc.
|
25
|
+
# @option options [String] :publishedOnly Only return currently published entities.
|
26
|
+
# @option options [String] :minimal Return only array of entities without additional lists in it.
|
27
|
+
# @return Array[Mautic::Submissions::Form]
|
28
|
+
def submissions(**options)
|
29
|
+
json = @connection.request(:get, "api/forms/#{id}/submissions", params: options)
|
30
|
+
@submissions = json["submissions"].collect do |attributes|
|
31
|
+
Mautic::Submissions::Form.new @connection, attributes
|
32
|
+
end
|
33
|
+
rescue RequestError => _e
|
34
|
+
[]
|
35
|
+
end
|
36
|
+
|
8
37
|
end
|
9
|
-
end
|
38
|
+
end
|
data/lib/mautic/proxy.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Mautic
|
2
2
|
module Submissions
|
3
|
+
# @see https://developer.mautic.org/#get-form-submissions
|
3
4
|
class Form
|
4
5
|
attr_reader :id
|
5
6
|
|
@@ -36,6 +37,11 @@ module Mautic
|
|
36
37
|
@raw["referer"].to_s
|
37
38
|
end
|
38
39
|
|
40
|
+
# @return [Hash]
|
41
|
+
def results
|
42
|
+
@raw["results"]
|
43
|
+
end
|
44
|
+
|
39
45
|
end
|
40
46
|
end
|
41
47
|
end
|
data/lib/mautic/version.rb
CHANGED
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.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukáš Pokorný
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -160,12 +160,6 @@ files:
|
|
160
160
|
- MIT-LICENSE
|
161
161
|
- README.md
|
162
162
|
- Rakefile
|
163
|
-
- app/assets/config/mautic_manifest.js
|
164
|
-
- app/assets/javascripts/mautic/application.js
|
165
|
-
- app/assets/javascripts/mautic/mautic_connections.js
|
166
|
-
- app/assets/stylesheets/mautic/application.css
|
167
|
-
- app/assets/stylesheets/mautic/mautic_connections.css
|
168
|
-
- app/assets/stylesheets/scaffold.css
|
169
163
|
- app/controllers/concerns/mautic/connections_controller_concern.rb
|
170
164
|
- app/controllers/concerns/mautic/receive_web_hooks.rb
|
171
165
|
- app/controllers/mautic/application_controller.rb
|
@@ -175,9 +169,11 @@ files:
|
|
175
169
|
- app/mailers/mautic/application_mailer.rb
|
176
170
|
- app/models/mautic/application_record.rb
|
177
171
|
- app/models/mautic/campaign.rb
|
172
|
+
- app/models/mautic/company_field.rb
|
178
173
|
- app/models/mautic/connection.rb
|
179
174
|
- app/models/mautic/connections/oauth2.rb
|
180
175
|
- app/models/mautic/contact.rb
|
176
|
+
- app/models/mautic/contact_field.rb
|
181
177
|
- app/models/mautic/event.rb
|
182
178
|
- app/models/mautic/form.rb
|
183
179
|
- app/models/mautic/tag.rb
|
@@ -223,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
219
|
- !ruby/object:Gem::Version
|
224
220
|
version: '0'
|
225
221
|
requirements: []
|
226
|
-
rubygems_version: 3.
|
222
|
+
rubygems_version: 3.1.4
|
227
223
|
signing_key:
|
228
224
|
specification_version: 4
|
229
225
|
summary: Ruby on Rails Mautic integration
|
@@ -1,14 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
-
//
|
10
|
-
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
-
// about supported directives.
|
12
|
-
//
|
13
|
-
// require rails-ujs
|
14
|
-
//= require_tree .
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
-
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
-
* It is generally better to create a new file per style scope.
|
12
|
-
*
|
13
|
-
*= require_tree .
|
14
|
-
*= require_self
|
15
|
-
*/
|
@@ -1,80 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
background-color: #fff;
|
3
|
-
color: #333;
|
4
|
-
margin: 33px;
|
5
|
-
}
|
6
|
-
|
7
|
-
body, p, ol, ul, td {
|
8
|
-
font-family: verdana, arial, helvetica, sans-serif;
|
9
|
-
font-size: 13px;
|
10
|
-
line-height: 18px;
|
11
|
-
}
|
12
|
-
|
13
|
-
pre {
|
14
|
-
background-color: #eee;
|
15
|
-
padding: 10px;
|
16
|
-
font-size: 11px;
|
17
|
-
}
|
18
|
-
|
19
|
-
a {
|
20
|
-
color: #000;
|
21
|
-
}
|
22
|
-
|
23
|
-
a:visited {
|
24
|
-
color: #666;
|
25
|
-
}
|
26
|
-
|
27
|
-
a:hover {
|
28
|
-
color: #fff;
|
29
|
-
background-color: #000;
|
30
|
-
}
|
31
|
-
|
32
|
-
th {
|
33
|
-
padding-bottom: 5px;
|
34
|
-
}
|
35
|
-
|
36
|
-
td {
|
37
|
-
padding: 0 5px 7px;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.field,
|
41
|
-
div.actions {
|
42
|
-
margin-bottom: 10px;
|
43
|
-
}
|
44
|
-
|
45
|
-
#notice {
|
46
|
-
color: green;
|
47
|
-
}
|
48
|
-
|
49
|
-
.field_with_errors {
|
50
|
-
padding: 2px;
|
51
|
-
background-color: red;
|
52
|
-
display: table;
|
53
|
-
}
|
54
|
-
|
55
|
-
#error_explanation {
|
56
|
-
width: 450px;
|
57
|
-
border: 2px solid red;
|
58
|
-
padding: 7px 7px 0;
|
59
|
-
margin-bottom: 20px;
|
60
|
-
background-color: #f0f0f0;
|
61
|
-
}
|
62
|
-
|
63
|
-
#error_explanation h2 {
|
64
|
-
text-align: left;
|
65
|
-
font-weight: bold;
|
66
|
-
padding: 5px 5px 5px 15px;
|
67
|
-
font-size: 12px;
|
68
|
-
margin: -7px -7px 0;
|
69
|
-
background-color: #c00;
|
70
|
-
color: #fff;
|
71
|
-
}
|
72
|
-
|
73
|
-
#error_explanation ul li {
|
74
|
-
font-size: 12px;
|
75
|
-
list-style: square;
|
76
|
-
}
|
77
|
-
|
78
|
-
label {
|
79
|
-
display: block;
|
80
|
-
}
|