mautic 2.6.1 → 3.0.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcc9d407cc133d52f797f177e0b7c3f2d605a88250a4fd821d3c98c215b4971f
|
4
|
+
data.tar.gz: dfdebe03cc788179e1a50e29d06f0c0a355c0e97135815af608727c5a9779e70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1074c4f45a5e034a8ad84e4f1ffe787093b8d65a771b89fa493debc4d1ede4f89cc19c88cdbadf85dd1d769ff320bf9c07d5d8772205d9f914740cb1e370d349
|
7
|
+
data.tar.gz: 731a48b00dd6bb42fe908c97fdbf14b0a8887b63858634e763e051570a16fab660bacc41a1f9f8515ad1557ab09768fc2c22ac2dd764d6269fceec1fd033e348
|
@@ -27,6 +27,8 @@ module Mautic
|
|
27
27
|
@connection = connection.refresh!
|
28
28
|
update(token: @connection.token, refresh_token: @connection.refresh_token)
|
29
29
|
@connection
|
30
|
+
rescue StandardError
|
31
|
+
raise ::Mautic::TokenExpiredError, "your refresh_token is probably expired - re-authorize your connection"
|
30
32
|
end
|
31
33
|
|
32
34
|
def request(type, path, params = {})
|
@@ -1,4 +1,5 @@
|
|
1
|
-
class CreateMauticMauticConnections <
|
1
|
+
class CreateMauticMauticConnections < ActiveRecord::Migration[6.0]
|
2
|
+
|
2
3
|
def change
|
3
4
|
create_table :mautic_connections do |t|
|
4
5
|
t.string :type
|
@@ -10,7 +11,8 @@ class CreateMauticMauticConnections < Mautic::DummyMigrationClass
|
|
10
11
|
t.string :token
|
11
12
|
t.string :refresh_token
|
12
13
|
|
13
|
-
t.timestamps
|
14
|
+
t.timestamps
|
14
15
|
end
|
15
16
|
end
|
16
|
-
|
17
|
+
|
18
|
+
end
|
data/lib/mautic/version.rb
CHANGED
data/lib/mautic.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "oauth2"
|
2
|
+
require "ostruct"
|
2
3
|
require "mautic/engine"
|
3
4
|
|
4
5
|
module Mautic
|
@@ -17,31 +18,39 @@ module Mautic
|
|
17
18
|
@errors ||= []
|
18
19
|
@response = response
|
19
20
|
@request_url = response.response&.env&.url
|
21
|
+
unless message
|
22
|
+
json_body = parse_response(response)
|
23
|
+
message = Array(json_body['errors']).collect do |error|
|
24
|
+
msg = error['code'].to_s
|
25
|
+
msg << " (#{error['type']}):" if error['type']
|
26
|
+
msg << " #{error['message']}"
|
27
|
+
@errors << error['message']
|
28
|
+
msg
|
29
|
+
end.join(', ')
|
30
|
+
end
|
31
|
+
|
32
|
+
super("#{@request_url} => #{message}")
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def parse_response(response)
|
20
38
|
body = if response.body.start_with? "<!DOCTYPE html>"
|
21
39
|
response.body.split("\n").last
|
22
40
|
else
|
23
41
|
response.body
|
24
42
|
end
|
25
43
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
message ||= Array(json_body['errors']).collect do |error|
|
32
|
-
msg = error['code'].to_s
|
33
|
-
msg << " (#{error['type']}):" if error['type']
|
34
|
-
msg << " #{error['message']}"
|
35
|
-
@errors << error['message']
|
36
|
-
msg
|
37
|
-
end.join(', ')
|
38
|
-
|
39
|
-
super("#{@request_url} => #{message}")
|
44
|
+
begin
|
45
|
+
JSON.parse(body)
|
46
|
+
rescue JSON::ParserError
|
47
|
+
{ "errors" => [{ "code" => response.status, "message" => body }] }
|
48
|
+
end
|
40
49
|
end
|
41
50
|
|
42
51
|
end
|
43
52
|
|
44
|
-
class TokenExpiredError <
|
53
|
+
class TokenExpiredError < StandardError
|
45
54
|
end
|
46
55
|
|
47
56
|
class ValidationError < RequestError
|
@@ -78,12 +87,4 @@ module Mautic
|
|
78
87
|
end
|
79
88
|
# Your code goes here...
|
80
89
|
|
81
|
-
if Rails.version.start_with? "4"
|
82
|
-
class DummyMigrationClass < ActiveRecord::Migration
|
83
|
-
end
|
84
|
-
else
|
85
|
-
class DummyMigrationClass < ActiveRecord::Migration[4.2]
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
90
|
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:
|
4
|
+
version: 3.0.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:
|
11
|
+
date: 2022-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,28 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 6.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 6.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: oauth2
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.4.9
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.4.9
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ostruct
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.5.3
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.5.3
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rest-client
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,103 +67,103 @@ dependencies:
|
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '2.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: database_cleaner
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
75
|
+
version: '1.7'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
82
|
+
version: '1.7'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: factory_bot_rails
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
89
|
+
version: '5.1'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
96
|
+
version: '5.1'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: faker
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
103
|
+
version: '2.7'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
110
|
+
version: '2.7'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
112
|
+
name: pry-rails
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
117
|
+
version: '0.3'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
124
|
+
version: '0.3'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
126
|
+
name: rspec-rails
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
131
|
+
version: '5.1'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
138
|
+
version: '5.1'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
140
|
+
name: sqlite3
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
143
|
- - "~>"
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
145
|
+
version: '1.4'
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
152
|
+
version: '1.4'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
154
|
+
name: webmock
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
159
|
+
version: '3.7'
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
166
|
+
version: '3.7'
|
153
167
|
description: Rails client for Mautic API. Provide wrapper for push to mautic form
|
154
168
|
email:
|
155
169
|
- pokorny@luk4s.cz
|
@@ -213,7 +227,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
213
227
|
requirements:
|
214
228
|
- - ">="
|
215
229
|
- !ruby/object:Gem::Version
|
216
|
-
version: '2.
|
230
|
+
version: '2.5'
|
217
231
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
232
|
requirements:
|
219
233
|
- - ">="
|