mailjet 1.5.4 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +298 -183
- data/Rakefile +23 -14
- data/lib/mailjet/configuration.rb +56 -4
- data/lib/mailjet/connection.rb +68 -33
- data/lib/mailjet/exception/errors.rb +94 -0
- data/lib/mailjet/mailer.rb +45 -16
- data/lib/mailjet/rack/endpoint.rb +2 -3
- data/lib/mailjet/resource.rb +105 -72
- data/lib/mailjet/resources/campaigndraft.rb +1 -1
- data/lib/mailjet/resources/campaigndraft_detailcontent.rb +17 -1
- data/lib/mailjet/resources/campaigndraft_schedule.rb +1 -1
- data/lib/mailjet/resources/campaigndraft_send.rb +1 -1
- data/lib/mailjet/resources/campaigndraft_status.rb +1 -1
- data/lib/mailjet/resources/campaigndraft_test.rb +1 -1
- data/lib/mailjet/resources/contact.rb +11 -2
- data/lib/mailjet/resources/contact_getcontactslists.rb +17 -0
- data/lib/mailjet/resources/contact_pii.rb +8 -0
- data/lib/mailjet/resources/contactslist_csv.rb +8 -0
- data/lib/mailjet/resources/csvimport.rb +0 -1
- data/lib/mailjet/resources/listrecipient.rb +2 -1
- data/lib/mailjet/resources/messagehistory.rb +16 -0
- data/lib/mailjet/resources/messageinformation.rb +17 -0
- data/lib/mailjet/resources/newsletter.rb +1 -2
- data/lib/mailjet/resources/openinformation.rb +17 -0
- data/lib/mailjet/resources/retrieve_errors_csv.rb +8 -0
- data/lib/mailjet/resources/send.rb +1 -1
- data/lib/mailjet/resources/statcounters.rb +33 -0
- data/lib/mailjet/resources/statistics_linkclick.rb +12 -0
- data/lib/mailjet/resources/template_detailcontent.rb +18 -2
- data/lib/mailjet/version.rb +1 -1
- data/lib/mailjet.rb +4 -6
- metadata +25 -120
- data/lib/mailjet/api_error.rb +0 -29
- data/lib/mailjet/core_extensions/ostruct.rb +0 -9
- data/lib/mailjet/gem_extensions/rest_client.rb +0 -19
data/lib/mailjet.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
require 'mailjet/core_extensions/ostruct'
|
1
|
+
require 'json/ext'
|
2
|
+
require 'yajl'
|
4
3
|
require 'mailjet/configuration'
|
5
|
-
require 'mailjet/api_error'
|
6
4
|
|
7
5
|
require 'mailjet/resource'
|
8
6
|
require 'mailjet/message_delivery'
|
9
7
|
|
10
|
-
Dir[File.expand_path("../mailjet/resources/*.rb", __FILE__)].each do |file|
|
8
|
+
Dir[File.expand_path("../mailjet/{resources,exception}/*.rb", __FILE__)].each do |file|
|
11
9
|
require file
|
12
10
|
end
|
13
11
|
|
@@ -21,7 +19,7 @@ module Mailjet
|
|
21
19
|
end
|
22
20
|
end
|
23
21
|
|
24
|
-
|
22
|
+
ActiveSupport.on_load(:action_mailer) do
|
25
23
|
require 'action_mailer/version'
|
26
24
|
require 'mailjet/mailer' if ActionMailer::Base.respond_to?(:add_delivery_method)
|
27
25
|
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailjet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Nappy
|
8
8
|
- Jean-Baptiste Escoyez
|
9
9
|
- Aurélien AMILIN
|
10
10
|
- Benoit Bénézech
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2024-08-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -19,14 +19,14 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 5.0.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 5.0.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rack
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,69 +42,27 @@ dependencies:
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 1.4.0
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
|
-
name:
|
45
|
+
name: faraday
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- - "
|
48
|
+
- - "~>"
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: '
|
50
|
+
version: '2.1'
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- - "
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: '0'
|
58
|
-
- !ruby/object:Gem::Dependency
|
59
|
-
name: actionmailer
|
60
|
-
requirement: !ruby/object:Gem::Requirement
|
61
|
-
requirements:
|
62
|
-
- - ">="
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: 3.0.9
|
65
|
-
type: :development
|
66
|
-
prerelease: false
|
67
|
-
version_requirements: !ruby/object:Gem::Requirement
|
68
|
-
requirements:
|
69
|
-
- - ">="
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: 3.0.9
|
72
|
-
- !ruby/object:Gem::Dependency
|
73
|
-
name: minitest
|
74
|
-
requirement: !ruby/object:Gem::Requirement
|
75
|
-
requirements:
|
76
|
-
- - ">="
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: '0'
|
79
|
-
type: :development
|
80
|
-
prerelease: false
|
81
|
-
version_requirements: !ruby/object:Gem::Requirement
|
82
|
-
requirements:
|
83
|
-
- - ">="
|
55
|
+
- - "~>"
|
84
56
|
- !ruby/object:Gem::Version
|
85
|
-
version: '
|
57
|
+
version: '2.1'
|
86
58
|
- !ruby/object:Gem::Dependency
|
87
|
-
name:
|
59
|
+
name: yajl-ruby
|
88
60
|
requirement: !ruby/object:Gem::Requirement
|
89
61
|
requirements:
|
90
62
|
- - ">="
|
91
63
|
- !ruby/object:Gem::Version
|
92
64
|
version: '0'
|
93
|
-
type: :
|
94
|
-
prerelease: false
|
95
|
-
version_requirements: !ruby/object:Gem::Requirement
|
96
|
-
requirements:
|
97
|
-
- - ">="
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: '0'
|
100
|
-
- !ruby/object:Gem::Dependency
|
101
|
-
name: minitest-spec-context
|
102
|
-
requirement: !ruby/object:Gem::Requirement
|
103
|
-
requirements:
|
104
|
-
- - ">="
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
version: '0'
|
107
|
-
type: :development
|
65
|
+
type: :runtime
|
108
66
|
prerelease: false
|
109
67
|
version_requirements: !ruby/object:Gem::Requirement
|
110
68
|
requirements:
|
@@ -112,19 +70,19 @@ dependencies:
|
|
112
70
|
- !ruby/object:Gem::Version
|
113
71
|
version: '0'
|
114
72
|
- !ruby/object:Gem::Dependency
|
115
|
-
name:
|
73
|
+
name: actionmailer
|
116
74
|
requirement: !ruby/object:Gem::Requirement
|
117
75
|
requirements:
|
118
76
|
- - ">="
|
119
77
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
78
|
+
version: 5.0.0
|
121
79
|
type: :development
|
122
80
|
prerelease: false
|
123
81
|
version_requirements: !ruby/object:Gem::Requirement
|
124
82
|
requirements:
|
125
83
|
- - ">="
|
126
84
|
- !ruby/object:Gem::Version
|
127
|
-
version:
|
85
|
+
version: 5.0.0
|
128
86
|
- !ruby/object:Gem::Dependency
|
129
87
|
name: rake
|
130
88
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,20 +111,6 @@ dependencies:
|
|
153
111
|
- - ">="
|
154
112
|
- !ruby/object:Gem::Version
|
155
113
|
version: '0'
|
156
|
-
- !ruby/object:Gem::Dependency
|
157
|
-
name: mocha
|
158
|
-
requirement: !ruby/object:Gem::Requirement
|
159
|
-
requirements:
|
160
|
-
- - ">="
|
161
|
-
- !ruby/object:Gem::Version
|
162
|
-
version: '0'
|
163
|
-
type: :development
|
164
|
-
prerelease: false
|
165
|
-
version_requirements: !ruby/object:Gem::Requirement
|
166
|
-
requirements:
|
167
|
-
- - ">="
|
168
|
-
- !ruby/object:Gem::Version
|
169
|
-
version: '0'
|
170
114
|
- !ruby/object:Gem::Dependency
|
171
115
|
name: webmock
|
172
116
|
requirement: !ruby/object:Gem::Requirement
|
@@ -195,34 +139,6 @@ dependencies:
|
|
195
139
|
- - ">="
|
196
140
|
- !ruby/object:Gem::Version
|
197
141
|
version: '0'
|
198
|
-
- !ruby/object:Gem::Dependency
|
199
|
-
name: guard
|
200
|
-
requirement: !ruby/object:Gem::Requirement
|
201
|
-
requirements:
|
202
|
-
- - ">="
|
203
|
-
- !ruby/object:Gem::Version
|
204
|
-
version: '0'
|
205
|
-
type: :development
|
206
|
-
prerelease: false
|
207
|
-
version_requirements: !ruby/object:Gem::Requirement
|
208
|
-
requirements:
|
209
|
-
- - ">="
|
210
|
-
- !ruby/object:Gem::Version
|
211
|
-
version: '0'
|
212
|
-
- !ruby/object:Gem::Dependency
|
213
|
-
name: guard-minitest
|
214
|
-
requirement: !ruby/object:Gem::Requirement
|
215
|
-
requirements:
|
216
|
-
- - ">="
|
217
|
-
- !ruby/object:Gem::Version
|
218
|
-
version: '0'
|
219
|
-
type: :development
|
220
|
-
prerelease: false
|
221
|
-
version_requirements: !ruby/object:Gem::Requirement
|
222
|
-
requirements:
|
223
|
-
- - ">="
|
224
|
-
- !ruby/object:Gem::Version
|
225
|
-
version: '0'
|
226
142
|
- !ruby/object:Gem::Dependency
|
227
143
|
name: rspec
|
228
144
|
requirement: !ruby/object:Gem::Requirement
|
@@ -237,20 +153,6 @@ dependencies:
|
|
237
153
|
- - ">="
|
238
154
|
- !ruby/object:Gem::Version
|
239
155
|
version: '0'
|
240
|
-
- !ruby/object:Gem::Dependency
|
241
|
-
name: rspec-expectations
|
242
|
-
requirement: !ruby/object:Gem::Requirement
|
243
|
-
requirements:
|
244
|
-
- - ">="
|
245
|
-
- !ruby/object:Gem::Version
|
246
|
-
version: '0'
|
247
|
-
type: :development
|
248
|
-
prerelease: false
|
249
|
-
version_requirements: !ruby/object:Gem::Requirement
|
250
|
-
requirements:
|
251
|
-
- - ">="
|
252
|
-
- !ruby/object:Gem::Version
|
253
|
-
version: '0'
|
254
156
|
- !ruby/object:Gem::Dependency
|
255
157
|
name: dotenv
|
256
158
|
requirement: !ruby/object:Gem::Requirement
|
@@ -280,12 +182,10 @@ files:
|
|
280
182
|
- lib/generators/mailjet/initializer_generator.rb
|
281
183
|
- lib/generators/mailjet/templates/mailjet.rb.erb
|
282
184
|
- lib/mailjet.rb
|
283
|
-
- lib/mailjet/api_error.rb
|
284
185
|
- lib/mailjet/collection_proxy.rb
|
285
186
|
- lib/mailjet/configuration.rb
|
286
187
|
- lib/mailjet/connection.rb
|
287
|
-
- lib/mailjet/
|
288
|
-
- lib/mailjet/gem_extensions/rest_client.rb
|
188
|
+
- lib/mailjet/exception/errors.rb
|
289
189
|
- lib/mailjet/mailer.rb
|
290
190
|
- lib/mailjet/message_delivery.rb
|
291
191
|
- lib/mailjet/rack/endpoint.rb
|
@@ -315,11 +215,13 @@ files:
|
|
315
215
|
- lib/mailjet/resources/contact_getcontactslists.rb
|
316
216
|
- lib/mailjet/resources/contact_managecontactslists.rb
|
317
217
|
- lib/mailjet/resources/contact_managemanycontacts.rb
|
218
|
+
- lib/mailjet/resources/contact_pii.rb
|
318
219
|
- lib/mailjet/resources/contactdata.rb
|
319
220
|
- lib/mailjet/resources/contactfilter.rb
|
320
221
|
- lib/mailjet/resources/contacthistorydata.rb
|
321
222
|
- lib/mailjet/resources/contactmetadata.rb
|
322
223
|
- lib/mailjet/resources/contactslist.rb
|
224
|
+
- lib/mailjet/resources/contactslist_csv.rb
|
323
225
|
- lib/mailjet/resources/contactslist_managecontact.rb
|
324
226
|
- lib/mailjet/resources/contactslist_managemanycontacts.rb
|
325
227
|
- lib/mailjet/resources/contactslistsignup.rb
|
@@ -360,10 +262,13 @@ files:
|
|
360
262
|
- lib/mailjet/resources/openstatistics.rb
|
361
263
|
- lib/mailjet/resources/parseroute.rb
|
362
264
|
- lib/mailjet/resources/preferences.rb
|
265
|
+
- lib/mailjet/resources/retrieve_errors_csv.rb
|
363
266
|
- lib/mailjet/resources/send.rb
|
364
267
|
- lib/mailjet/resources/sender.rb
|
365
268
|
- lib/mailjet/resources/sender_validate.rb
|
366
269
|
- lib/mailjet/resources/senderstatistics.rb
|
270
|
+
- lib/mailjet/resources/statcounters.rb
|
271
|
+
- lib/mailjet/resources/statistics_linkclick.rb
|
367
272
|
- lib/mailjet/resources/template.rb
|
368
273
|
- lib/mailjet/resources/template_detailcontent.rb
|
369
274
|
- lib/mailjet/resources/toplinkclicked.rb
|
@@ -394,19 +299,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
394
299
|
requirements:
|
395
300
|
- - ">="
|
396
301
|
- !ruby/object:Gem::Version
|
397
|
-
version:
|
302
|
+
version: 2.2.0
|
398
303
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
399
304
|
requirements:
|
400
305
|
- - ">="
|
401
306
|
- !ruby/object:Gem::Version
|
402
307
|
version: '0'
|
403
308
|
requirements: []
|
404
|
-
|
405
|
-
|
406
|
-
signing_key:
|
309
|
+
rubygems_version: 3.1.6
|
310
|
+
signing_key:
|
407
311
|
specification_version: 4
|
408
312
|
summary: Mailjet a powerful all-in-one email service provider clients can use to get
|
409
313
|
maximum insight and deliverability results from both their marketing and transactional
|
410
314
|
emails. Our analytics tools and intelligent APIs give senders the best understanding
|
411
315
|
of how to maximize benefits for each individual contact, with each email sent.
|
412
316
|
test_files: []
|
317
|
+
...
|
data/lib/mailjet/api_error.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'active_support'
|
3
|
-
|
4
|
-
module Mailjet
|
5
|
-
class ApiError < StandardError
|
6
|
-
|
7
|
-
attr_accessor :code, :reason
|
8
|
-
|
9
|
-
|
10
|
-
def initialize(code, res, request, request_path, params)
|
11
|
-
self.code = code
|
12
|
-
self.reason = ""
|
13
|
-
unless res.blank?
|
14
|
-
resdec = ActiveSupport::JSON.decode(res)
|
15
|
-
self.reason = resdec['ErrorMessage']
|
16
|
-
end
|
17
|
-
# code is ugly, output is pretty
|
18
|
-
super("error #{code} while sending #{request.inspect} to #{request_path} with #{params.inspect}\n\n" +
|
19
|
-
if res['errors'].present?
|
20
|
-
[(res['errors'] || [])].flatten.map do |param, text|
|
21
|
-
[param, text].map(&:to_s).reject(&:blank?).join(': ')
|
22
|
-
end.join("\n")
|
23
|
-
else
|
24
|
-
res.inspect
|
25
|
-
end + "\n\nPlease see https://dev.mailjet.com/guides/#status-codes for more informations on error numbers.\n\n"
|
26
|
-
)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
class OpenStruct
|
2
|
-
|
3
|
-
# when asked for id, ruby 1.8.7's implementation of OpenStruct returns object's inner id instead of table's value if present. Evilishish infamous Monkey-Patch.
|
4
|
-
if RUBY_VERSION =~ /1\.8\./
|
5
|
-
def id
|
6
|
-
send(:eval, "@table[:id]")
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module RestClient
|
2
|
-
module Payload
|
3
|
-
class Base
|
4
|
-
def flatten_params_array value, calculated_key
|
5
|
-
result = []
|
6
|
-
value.each do |elem|
|
7
|
-
if elem.is_a? Hash
|
8
|
-
result += flatten_params(elem, calculated_key)
|
9
|
-
elsif elem.is_a? Array
|
10
|
-
result += flatten_params_array(elem, calculated_key)
|
11
|
-
else
|
12
|
-
result << ["#{calculated_key}", elem]
|
13
|
-
end
|
14
|
-
end
|
15
|
-
result
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|