mailjet 1.8.3 → 1.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d20c3811d37360e2c0da2176c227b7328f3e4f329fd36c1e91c723e28b3946d9
4
- data.tar.gz: d13fbd83f731ddcb162ac9776af0261971bba3d0dac4887d7088c4f1b788c110
3
+ metadata.gz: 966d15689307bd9561460419db93e8de8e8bcc4cf2f9d392339edfb8c73d1635
4
+ data.tar.gz: 8b2d2d8baaeb3701b743322ecf1d5a209052327c887bab34eabeb4525a8c93b3
5
5
  SHA512:
6
- metadata.gz: 7780c42117a2b9e6601f18a9480c0368cf33f4e7723091970dd28817affe727de3540d19c849daa56c1e3c65e0e9d8d4703e9765a73b0344cbc9263be37eae2a
7
- data.tar.gz: 5aa121079dc94441e0bd876b7090ceac961a6a84c6264f73d8f65bd1242ff1182b2796d2b7dc0c2dc0b727159e10155c85c969b095df8cc101bab088a416d194
6
+ metadata.gz: 5f9f8fd4344c61259f7ea13ccf59de0a35ee15cb6a171322dda20033f7f8db8652c3c0cd0f52f04aac6db7aafb676b7341ab581ec82e0d3abe1b41e6e35cf623
7
+ data.tar.gz: b311a067e80b8ba6b14d407c2fdca0c37062862695f243c31973d37d64367ac27637507ddaf1c77ed2360cbca24fe14f74c2d7bf9b623a9fecd97e7faebfb845
data/README.md CHANGED
@@ -8,29 +8,15 @@
8
8
 
9
9
  [![Build Status](https://secure.travis-ci.org/jbescoyez/mailjet.png?branch=master)][travis]
10
10
  [![Dependency Status](https://gemnasium.com/jbescoyez/mailjet.png)][gemnasium]
11
- [![Maintainance status](http://stillmaintained.com/jbescoyez/mailjet.png)][stillmaintained]
11
+ [![Maintainance status](https://stillmaintained.com/jbescoyez/mailjet.png)][stillmaintained]
12
12
  ![Current Version](https://img.shields.io/badge/version-1.5.0-green.svg)
13
13
 
14
14
  -->
15
15
 
16
- [travis]: http://travis-ci.org/jbescoyez/mailjet
16
+ [travis]: https://travis-ci.org/jbescoyez/mailjet
17
17
  [gemnasium]: https://gemnasium.com/jbescoyez/mailjet
18
- [stillmaintained]: http://stillmaintained.com/jbescoyez/mailjet
19
- [mailjet]: http://www.mailjet.com
20
- [rubinius]: http://rubini.us/
21
- [ree]: http://www.rubyenterpriseedition.com/
22
- [jruby]: http://jruby.org/
18
+ [stillmaintained]: https://stillmaintained.com/jbescoyez/mailjet
23
19
  [mailjetter]: https://github.com/holinnn/mailjetter/
24
- [activeresource]: https://github.com/rails/activeresource
25
- [apidoc]: http://dev.mailjet.com/guides
26
- [apidoc-recipient]: http://mjdemo.poxx.net/~shubham/listrecipient.html?utm_source=github&utm_medium=link&utm_content=readme&utm_campaign=mailjet-gem
27
- [camelcase-api]: http://api.rubyonrails.org/classes/String.html#method-i-camelcase
28
- [underscore-api]: http://api.rubyonrails.org/classes/String.html#method-i-underscore
29
- [actionmailerdoc]: http://guides.rubyonrails.org/action_mailer_basics.html#sending-emails-with-dynamic-delivery-options
30
- [send-api-doc]: http://dev.mailjet.com/guides/?ruby#choose-sending-method
31
- [v1-branch]: https://github.com/mailjet/mailjet-gem/tree/v1
32
- [mailjet_doc]: http://dev.mailjet.com/guides/?ruby#
33
- [api_doc]: https://github.com/mailjet/api-documentation
34
20
 
35
21
  <!-- You can read this readme file in other languages:
36
22
  english | [french](./README.fr.md) -->
@@ -53,6 +39,7 @@ Check out all the resources and Ruby code examples in the [Offical Documentation
53
39
  - [Call configuration specifics](#call-configuration-specifics)
54
40
  - [API versioning](#api-versioning)
55
41
  - [Base URL](#base-url)
42
+ - [Timeouts](#timeouts)
56
43
  - [List of resources](#list-of-resources)
57
44
  - [Naming conventions](#naming-conventions)
58
45
  - [Request examples](#request-examples)
@@ -67,6 +54,10 @@ Check out all the resources and Ruby code examples in the [Offical Documentation
67
54
  - [Retrieve the first object matching the query](retrieve-the-first-object-matching-the-query)
68
55
  - [PUT request](#put-request)
69
56
  - [DELETE request](#delete-request)
57
+ - [Deprecated resources](#deprecated-resources)
58
+ - [Newsletters to campaign drafts](#newsletters-to-campaign-drafts)
59
+ - [Legacy statistics to statcounters](#legacy-statistics-to-statcounters)
60
+ - [Domain statistics to recipient ESP statistics](#domain-statistics-to-recipient-esp-statistics)
70
61
  - [Send emails with ActionMailer](#send-emails-with-actionmailer)
71
62
  - [Track email delivery](#track-email-delivery)
72
63
  - [Testing](#testing)
@@ -197,6 +188,18 @@ end
197
188
 
198
189
  If your account has been moved to Mailjet's **US architecture**, the URL value you need to set is `https://api.us.mailjet.com`.
199
190
 
191
+ Always use an `https://` URL. If `end_point`, or a `url:` passed to a call, starts with `http://`, your API keys travel unencrypted and the gem prints a warning the first time it connects.
192
+
193
+ ### Timeouts
194
+
195
+ By default the gem uses Faraday's timeouts. Pass `open_timeout` (seconds to open the connection) and `read_timeout` (seconds to wait for each read) on a call to change them:
196
+
197
+ ```ruby
198
+ Mailjet::Contact.all({ limit: 10 }, open_timeout: 2, read_timeout: 10)
199
+ ```
200
+
201
+ A call that times out raises `Mailjet::CommunicationError`.
202
+
200
203
  ## List of resources
201
204
 
202
205
  You can find the list of all available resources for this library, as well as their configuration, in [/lib/mailjet/resources](https://github.com/mailjet/mailjet-gem/tree/master/lib/mailjet/resources).
@@ -204,7 +207,7 @@ You can find the list of all available resources for this library, as well as th
204
207
  ### Naming conventions
205
208
 
206
209
  - Class names' first letter is capitalized followed by the rest of the resource name in lowercase (e.g. `listrecipient` will be `Listrecipient` in ruby)
207
- - Ruby attribute names are the underscored versions of API attributes names (e.g. `IsActive` will be `is_active` in ruby)
210
+ - Ruby attribute names are the underscored versions of API attributes names (e.g. `IsUnsubscribed` will be `is_unsubscribed` in ruby)
208
211
 
209
212
  ## Request examples
210
213
 
@@ -314,13 +317,13 @@ Here's an example of a PUT request:
314
317
  ```ruby
315
318
  > recipient = Mailjet::Listrecipient.first
316
319
  => #<Mailjet::Listrecipient>
317
- > recipient.is_active = false
318
- => false
320
+ > recipient.is_unsubscribed = true
321
+ => true
319
322
  > recipient.attributes
320
323
  => {...} # attributes hash
321
324
  > recipient.save
322
325
  => true
323
- > recipient.update_attributes(is_active: true)
326
+ > recipient.update_attributes(is_unsubscribed: false)
324
327
  => true
325
328
  ```
326
329
 
@@ -338,9 +341,101 @@ Here's an example of a `DELETE` request:
338
341
 
339
342
  Upon a successful `DELETE` request the response will not include a response body, but only a `204 No Content` response code.
340
343
 
344
+ ## Deprecated resources
345
+
346
+ Mailjet has [deprecated some Email API endpoints](https://dev.mailjet.com/openapi/openapi-mailjet/deprecated-endpoints) and plans to shut them down. Since 1.9.0, the classes that wrap them print a warning the first time they are used, naming the replacement; run Ruby with `-W0` to silence it. They will be removed in 2.0.0, once Mailjet shuts the endpoints down.
347
+
348
+ | Deprecated class | Replacement |
349
+ | --- | --- |
350
+ | `Newsletter` | `Campaigndraft` |
351
+ | `Newsletter_detailcontent` | `Campaigndraft_detailcontent` |
352
+ | `Newsletter_schedule` | `Campaigndraft_schedule` |
353
+ | `Newsletter_send` | `Campaigndraft_send` |
354
+ | `Newsletter_status` | `Campaigndraft_status` |
355
+ | `Newsletter_test` | `Campaigndraft_test` |
356
+ | `Apikeytotals` | `Statcounters` with `counter_source: "APIKey"` |
357
+ | `Campaigngraphstatistics` | `Statcounters` with `counter_source: "Campaign"` |
358
+ | `Campaignstatistics` | `Statcounters` with `counter_source: "Campaign"` |
359
+ | `Graphstatistics` | `Statcounters` with `counter_resolution: "Day"` or `"Hour"` |
360
+ | `Liststatistics` | `Statcounters` with `counter_source: "List"` |
361
+ | `Messagestatistics` | `Statcounters` with `counter_timing: "Message"` |
362
+ | `Openstatistics` | `Statcounters` with `counter_timing: "Message"` |
363
+ | `Senderstatistics` | `Statcounters` with `counter_source: "Sender"` |
364
+ | `Domainstatistics` | `Statistics_recipient_esp` |
365
+
366
+ ### Newsletters to campaign drafts
367
+
368
+ The `Campaigndraft` classes take the same calls as the `Newsletter` ones. `Sender` is the ID of a validated sender (see `Mailjet::Sender`).
369
+
370
+ ```ruby
371
+ draft = Mailjet::Campaigndraft.create(
372
+ "Locale" => "en_US",
373
+ "Title" => "October news",
374
+ "Subject" => "October news",
375
+ "Sender" => sender_id,
376
+ "SenderEmail" => "sender@example.com",
377
+ "ContactsListID" => contacts_list_id
378
+ )
379
+ Mailjet::Campaigndraft_detailcontent.create(id: draft.id, "Text-part" => "Hello", "Html-part" => "<p>Hello</p>")
380
+ Mailjet::Campaigndraft_send.create(id: draft.id)
381
+ ```
382
+
383
+ One call behaves differently: `Campaigndraft_detailcontent.find` returns an array, where `Newsletter_detailcontent.find` returned a single object.
384
+
385
+ ```ruby
386
+ # Before
387
+ content = Mailjet::Newsletter_detailcontent.find(newsletter_id)
388
+
389
+ # After
390
+ content = Mailjet::Campaigndraft_detailcontent.find(draft_id).first
391
+ ```
392
+
393
+ ### Legacy statistics to statcounters
394
+
395
+ `Statcounters` takes a source, a timing and a resolution. The `Day` and `Hour` resolutions also need a `from_ts`/`to_ts` range; without one the API answers 400.
396
+
397
+ ```ruby
398
+ # Before
399
+ Mailjet::Campaignstatistics.find(campaign_id)
400
+
401
+ # After
402
+ Mailjet::Statcounters.all(
403
+ source_id: campaign_id,
404
+ counter_source: "Campaign",
405
+ counter_timing: "Message",
406
+ counter_resolution: "Lifetime"
407
+ )
408
+
409
+ # Totals for your API key, replacing Apikeytotals
410
+ Mailjet::Statcounters.all(counter_source: "APIKey", counter_timing: "Message", counter_resolution: "Lifetime")
411
+
412
+ # Daily counts, replacing the graph statistics
413
+ Mailjet::Statcounters.all(
414
+ source_id: campaign_id,
415
+ counter_source: "Campaign",
416
+ counter_timing: "Message",
417
+ counter_resolution: "Day",
418
+ from_ts: Time.utc(2026, 10, 1).to_i,
419
+ to_ts: Time.utc(2026, 11, 1).to_i
420
+ )
421
+ ```
422
+
423
+ ### Domain statistics to recipient ESP statistics
424
+
425
+ `Statistics_recipient_esp` groups a campaign's statistics by recipient email service provider (Gmail, Microsoft and so on) rather than by domain, and it needs a campaign ID.
426
+
427
+ ```ruby
428
+ # Before
429
+ Mailjet::Domainstatistics.all
430
+
431
+ # After
432
+ Mailjet::Statistics_recipient_esp.all(campaign_id: campaign_id)
433
+ Mailjet::Statistics_recipient_esp.all(campaign_id: campaign_id, esp_name: "gmail")
434
+ ```
435
+
341
436
  ## Send emails with ActionMailer
342
437
 
343
- A quick walkthrough to use Rails Action Mailer [here](http://guides.rubyonrails.org/action_mailer_basics.html).
438
+ A quick walkthrough to use Rails Action Mailer [here](https://guides.rubyonrails.org/action_mailer_basics.html).
344
439
 
345
440
  First set your delivery method (here Mailjet SMTP relay servers):
346
441
 
@@ -350,14 +445,14 @@ config.action_mailer.delivery_method = :mailjet
350
445
 
351
446
  ```
352
447
 
353
- Or if you prefer sending messages through [Mailjet Send API](http://dev.mailjet.com/guides/#send-transactional-email):
448
+ Or if you prefer sending messages through [Mailjet Send API](https://dev.mailjet.com/guides/#send-transactional-email):
354
449
 
355
450
  ```ruby
356
451
  # application.rb
357
452
  config.action_mailer.delivery_method = :mailjet_api
358
453
  ```
359
454
 
360
- You can use Mailjet specific options with `delivery_method_options` as detailed in the official [ActionMailer doc](http://guides.rubyonrails.org/action_mailer_basics.html#sending-emails-with-dynamic-delivery-options):
455
+ You can use Mailjet specific options with `delivery_method_options` as detailed in the official [ActionMailer doc](https://guides.rubyonrails.org/action_mailer_basics.html#sending-emails-with-dynamic-delivery-options):
361
456
 
362
457
  ```ruby
363
458
  class AwesomeMailer < ApplicationMailer
@@ -459,7 +554,7 @@ Hello world in HTML!
459
554
  Hello world in plain text!
460
555
  ```
461
556
 
462
- There's also the ability to set [Mailjet custom headers](http://dev.mailjet.com/guides/#send-api-json-properties)
557
+ There's also the ability to set [Mailjet custom headers](https://dev.mailjet.com/guides/#send-api-json-properties)
463
558
  ```ruby
464
559
  #app/mailers/user_mailer.rb
465
560
  class UserMailer < ApplicationMailer
@@ -481,7 +576,7 @@ For sending email, you can call the method:
481
576
  UserMailer.welcome_email.deliver_now!
482
577
  ```
483
578
 
484
- For more information on `ActionMailer::MessageDelivery`, see the documentation [HERE](http://edgeapi.rubyonrails.org/classes/ActionMailer/MessageDelivery.html)
579
+ For more information on `ActionMailer::MessageDelivery`, see the documentation [HERE](https://edgeapi.rubyonrails.org/classes/ActionMailer/MessageDelivery.html)
485
580
 
486
581
  #### Manage contacts via CSV Upload
487
582
  Create the CSV content in a format compatible with the Mailjet API, see the documentation [HERE](https://dev.mailjet.com/email/guides/contact-management/#manage-contacts-via-csv-upload)
@@ -498,7 +593,7 @@ Mailjet::ContactPii.delete(contact_ID)
498
593
 
499
594
  You can setup your Rack application in order to receive feedback on emails you sent (clicks, etc.)
500
595
 
501
- First notify Mailjet of your desired endpoint (say: 'http://www.my_domain.com/mailjet/callback') at https://app.mailjet.com/account/triggers
596
+ First notify Mailjet of your desired endpoint (say: 'https://www.my_domain.com/mailjet/callback') at https://app.mailjet.com/account/triggers
502
597
 
503
598
  Then configure Mailjet's Rack application to catch these callbacks.
504
599
 
data/Rakefile CHANGED
@@ -2,25 +2,7 @@ require "rspec/core/rake_task"
2
2
  require 'bundler/gem_tasks'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec) do |t|
5
- t.pattern = [
6
- "spec/mailjet/rack/endpoint_spec.rb",
7
- "spec/mailjet/api_error_spec.rb",
8
- "spec/mailjet/apikey_spec.rb",
9
- "spec/mailjet/mailer_spec.rb",
10
- "spec/mailjet/resource_spec.rb",
11
- "spec/configuration_spec.rb",
12
- "spec/mailjet_spec.rb",
13
- "spec/resources/contact_spec.rb",
14
- "spec/resources/contactmetadata_spec.rb",
15
- "spec/resources/messagehistory_spec.rb",
16
- "spec/resources/getcontactslists_spec.rb",
17
- "spec/resources/template_detailcontent_spec.rb",
18
- "spec/resources/integration_spec.rb",
19
- "spec/resources/newsletter_spec.rb",
20
- "spec/resources/statcounters_spec.rb",
21
- "spec/resources/send_spec.rb",
22
- "spec/resources/resource_spec.rb",
23
- ]
5
+ t.pattern = "spec/**/*_spec.rb"
24
6
  end
25
7
 
26
8
  task default: [:spec]
@@ -16,13 +16,25 @@ module Mailjet
16
16
  end
17
17
  end
18
18
 
19
+ # plain HTTP sends the API keys unencrypted; warn once per process
20
+ def self.warn_if_insecure(end_point)
21
+ return if @insecure_warned
22
+
23
+ origin = end_point.to_s[%r{\Ahttp://[^/]*}i]
24
+ return unless origin
25
+
26
+ @insecure_warned = true
27
+ warn("[mailjet] #{origin} uses plain HTTP, which sends your API keys and data unencrypted. Set end_point or url: to an https:// URL instead.")
28
+ end
29
+
19
30
  def initialize(end_point, api_key, secret_key, options = {})
31
+ self.class.warn_if_insecure(end_point)
20
32
  self.options = options
21
33
  self.api_key = api_key
22
34
  self.secret_key = secret_key
23
35
  self.public_operations = options[:public_operations] || []
24
36
  self.read_only = options[:read_only]
25
- self.adapter = Faraday.new(end_point, ssl: { verify: false }) do |conn|
37
+ self.adapter = Faraday.new(end_point, request: timeout_options) do |conn|
26
38
  conn.response :raise_error, include_request: true
27
39
  conn.request :authorization, :basic, api_key, secret_key
28
40
  conn.headers['Content-Type'] = 'application/json'
@@ -56,6 +68,13 @@ module Mailjet
56
68
 
57
69
  private
58
70
 
71
+ def timeout_options
72
+ {
73
+ open_timeout: options[:open_timeout],
74
+ read_timeout: options[:read_timeout],
75
+ }.compact
76
+ end
77
+
59
78
  def handle_api_call(method, additional_headers = {}, payload = {}, &block)
60
79
  formatted_payload = (additional_headers["Content-Type"] == 'application/json') ? Yajl::Encoder.encode(payload) : payload
61
80
  raise Mailjet::MethodNotAllowed unless method_allowed(method)
@@ -16,7 +16,7 @@ require 'active_support/core_ext/object/blank'
16
16
  module Mailjet
17
17
  module Resource
18
18
  # define here available options for filtering
19
- OPTIONS = [:version, :url, :perform_api_call, :api_key, :secret_key]
19
+ OPTIONS = [:version, :url, :perform_api_call, :api_key, :secret_key, :read_timeout, :open_timeout]
20
20
 
21
21
  NON_JSON_URLS = ['v3/send/message'] # urls that don't accept JSON input
22
22
  DATA_URLS = ['plain', 'csv'] # url for send binary data , 'CSVError/text:csv'
@@ -24,12 +24,13 @@ module Mailjet
24
24
  def self.included(base)
25
25
  base.extend ClassMethods
26
26
  base.class_eval do
27
- cattr_accessor :resource_path, :public_operations, :read_only, :filters, :resourceprop, :read_only_attributes, :action, :non_json_urls, :version
27
+ cattr_accessor :resource_path, :public_operations, :read_only, :filters, :resourceprop, :read_only_attributes, :action, :non_json_urls, :version, :replaced_by
28
28
  cattr_writer :connection
29
29
 
30
30
  self.read_only_attributes = []
31
31
 
32
32
  def self.connection(options = {})
33
+ warn_if_deprecated
33
34
  class_variable_get(:@@connection) || default_connection(options)
34
35
  end
35
36
 
@@ -40,7 +41,9 @@ module Mailjet
40
41
  options[:secret_key] || Mailjet.config.secret_key,
41
42
  public_operations: public_operations,
42
43
  read_only: read_only,
43
- perform_api_call: options[:perform_api_call])
44
+ perform_api_call: options[:perform_api_call],
45
+ open_timeout: options[:open_timeout],
46
+ read_timeout: options[:read_timeout])
44
47
  end
45
48
 
46
49
  def self.default_headers
@@ -241,6 +244,8 @@ module Mailjet
241
244
  'Html-part'
242
245
  elsif key == "inline_attachments"
243
246
  'Inline_attachments'
247
+ elsif method == :camelcase && key.to_s == "esp_name"
248
+ 'ESP_Name'
244
249
  else
245
250
  key.to_s.send(method)
246
251
  end
@@ -259,6 +264,14 @@ module Mailjet
259
264
  .merge(options.symbolize_keys.slice(*OPTIONS))
260
265
  end
261
266
 
267
+ # deprecated resources set replaced_by and warn once, on first use
268
+ def warn_if_deprecated
269
+ return if replaced_by.nil? || @deprecation_warned
270
+
271
+ @deprecation_warned = true
272
+ warn("[mailjet] #{name} is deprecated and will be removed in 2.0.0. Use #{replaced_by} instead.")
273
+ end
274
+
262
275
  end
263
276
 
264
277
  attr_accessor :attributes, :persisted
@@ -306,8 +319,11 @@ module Mailjet
306
319
  end
307
320
 
308
321
  def attributes=(attribute_hash = {})
322
+ # write straight to the attributes hash: going through send would call
323
+ # the class-wide setters (version=, action=, ...) for API fields that
324
+ # share their names, such as the Version field of an eventcallbackurl
309
325
  attribute_hash.each do |attribute_name, value|
310
- self.send("#{attribute_name}=", value)
326
+ attributes[attribute_name] = value
311
327
  end
312
328
  end
313
329
 
@@ -3,6 +3,7 @@ module Mailjet
3
3
  include Mailjet::Resource
4
4
  self.resource_path = 'REST/apikeytotals'
5
5
  self.public_operations = [:get]
6
+ self.replaced_by = 'Mailjet::Statcounters with counter_source: "APIKey"'
6
7
  self.filters = []
7
8
  self.resourceprop = [:blocked_count, :bounced_count, :clicked_count, :delivered_count, :last_activity, :opened_count, :processed_count, :queued_count, :spamcomplaint_count, :unsubscribed_count]
8
9
 
@@ -3,6 +3,7 @@ module Mailjet
3
3
  include Mailjet::Resource
4
4
  self.resource_path = 'REST/campaigngraphstatistics'
5
5
  self.public_operations = [:get]
6
+ self.replaced_by = 'Mailjet::Statcounters with counter_source: "Campaign"'
6
7
  self.filters = [:click, :ids, :open, :range, :spam, :unsub]
7
8
  self.resourceprop = [:click_count, :id, :opencount, :spamcount, :tick, :unsubcount]
8
9
 
@@ -3,6 +3,7 @@ module Mailjet
3
3
  include Mailjet::Resource
4
4
  self.resource_path = 'REST/campaignstatistics'
5
5
  self.public_operations = [:get]
6
+ self.replaced_by = 'Mailjet::Statcounters with counter_source: "Campaign"'
6
7
  self.filters = [:blocked, :bounced, :campaign_status, :click, :contacts_list, :from_type, :is_deleted, :is_starred, :last_activity_at, :max_last_activity_at, :min_last_activity_at, :news_letter, :open, :queued, :sender, :sent, :spam, :subject, :unsubscribed]
7
8
  self.resourceprop = [:blocked_count, :bounced_count, :campaign, :clicked_count, :delivered_count, :last_activity_at, :news_letter, :opened_count, :processed_count, :queued_count, :spam_complaint_count, :unsubscribed_count]
8
9
 
@@ -3,6 +3,7 @@ module Mailjet
3
3
  include Mailjet::Resource
4
4
  self.resource_path = 'REST/domainstatistics'
5
5
  self.public_operations = [:get]
6
+ self.replaced_by = 'Mailjet::Statistics_recipient_esp'
6
7
  self.filters = [:campaign_id, :campaign_status, :contacts_list, :custom_campaign, :from, :from_domain, :from_id, :from_ts, :from_type, :is_deleted, :is_newsletter_tool, :is_starred, :message_status, :period, :to_ts]
7
8
  self.resourceprop = [:blocked_count, :bounced_count, :clicked_count, :delivered_count, :domain, :id, :opened_count, :processed_count, :queued_count, :spam_complaint_count, :unsubscribed_count]
8
9
 
@@ -3,6 +3,7 @@ module Mailjet
3
3
  include Mailjet::Resource
4
4
  self.resource_path = 'REST/graphstatistics'
5
5
  self.public_operations = [:get]
6
+ self.replaced_by = 'Mailjet::Statcounters with counter_resolution: "Day" or "Hour"'
6
7
  self.filters = [:campaign_id, :campaign_status, :contact, :contacts_list, :custom_campaign, :from, :from_domain, :from_id, :from_ts, :from_type, :is_deleted, :is_newsletter_tool, :is_starred, :message_status, :period, :scale, :to_ts]
7
8
  self.resourceprop = [:blocked_count, :bounced_count, :clicked_count, :delivered_count, :opened_count, :processed_count, :queued_count, :ref_timestamp, :sendtime_start, :spamcomplaint_count, :unsubscribed_count]
8
9
 
@@ -3,6 +3,7 @@ module Mailjet
3
3
  include Mailjet::Resource
4
4
  self.resource_path = 'REST/liststatistics'
5
5
  self.public_operations = [:get]
6
+ self.replaced_by = 'Mailjet::Statcounters with counter_source: "List"'
6
7
  self.filters = [:address, :calc_active_unsub, :exclude_id, :is_deleted, :name]
7
8
  self.resourceprop = [:active_count, :active_unsubscribed_count, :address, :blocked_count, :bounced_count, :clicked_count, :created_at, :delivered_count, :id, :is_deleted, :last_activity_at, :name, :opened_count, :spam_complaint_count, :subscriber_count, :unsubscribed_count]
8
9
 
@@ -3,6 +3,7 @@ module Mailjet
3
3
  include Mailjet::Resource
4
4
  self.resource_path = 'REST/messagestatistics'
5
5
  self.public_operations = [:get]
6
+ self.replaced_by = 'Mailjet::Statcounters with counter_timing: "Message"'
6
7
  self.filters = [:campaign_id, :campaign_status, :contact_email, :contact_id, :custom_campaign, :from, :from_domain, :from_id, :from_ts, :from_type, :is_deleted, :is_newsletter_tool, :is_starred, :message_status, :period, :to_ts]
7
8
  self.resourceprop = [:average_click_delay, :average_clicked_count, :average_open_delay, :average_opened_count, :blocked_count, :bounced_count, :campaign_count, :clicked_count, :delivered_count, :opened_count, :processed_count, :queued_count, :spam_complaint_count, :transactional_count, :unsubscribed_count]
8
9
 
@@ -3,6 +3,7 @@ module Mailjet
3
3
  include Mailjet::Resource
4
4
  self.resource_path = 'REST/newsletter'
5
5
  self.public_operations = [:get, :put, :post]
6
+ self.replaced_by = 'Mailjet::Campaigndraft'
6
7
  self.filters = [:campaign, :contacts_list, :delivered_at, :edit_mode, :is_archived, :is_campaign, :is_deleted, :is_handled, :is_starred, :modified, :news_letter_template, :segmentation, :status, :subject]
7
8
  self.resourceprop = [:callback, :campaign, :contacts_list, :created_at, :delivered_at, :edit_mode, :edit_type, :footer, :footer_address, :footer_wysiwyg_type, :header_filename, :header_link, :header_text, :header_url, :id, :ip, :is_handled, :is_starred, :is_text_part_included, :locale, :modified_at, :permalink, :permalink_host, :permalink_wysiwyg_type, :politeness_mode, :reply_email, :segmentation, :segmentation_id, :sender, :sender_email, :sender_name, :status, :subject, :template, :test_address, :title, :url, 'CampaignID', 'CampaignALT', 'ContactsListID', 'ContactsListALT', 'SegmentationID', 'SegmentationALT', :contacts_list_id]
8
9
  end
@@ -4,6 +4,7 @@ module Mailjet
4
4
  self.action = "detailcontent"
5
5
  self.resource_path = "REST/newsletter/id/#{self.action}"
6
6
  self.public_operations = [:get, :post]
7
+ self.replaced_by = 'Mailjet::Campaigndraft_detailcontent'
7
8
  self.filters = []
8
9
  self.resourceprop = [:text_part, :html_part, :headers, :mjml_content]
9
10
 
@@ -4,6 +4,7 @@ module Mailjet
4
4
  self.action = "schedule"
5
5
  self.resource_path = "REST/newsletter/id/#{self.action}"
6
6
  self.public_operations = [:get, :post, :delete]
7
+ self.replaced_by = 'Mailjet::Campaigndraft_schedule'
7
8
  self.filters = []
8
9
  self.resourceprop = [:date]
9
10
 
@@ -4,6 +4,7 @@ module Mailjet
4
4
  self.action = "send"
5
5
  self.resource_path = "REST/newsletter/id/#{self.action}"
6
6
  self.public_operations = [:post]
7
+ self.replaced_by = 'Mailjet::Campaigndraft_send'
7
8
  self.filters = []
8
9
  self.resourceprop = []
9
10
  end
@@ -4,6 +4,7 @@ module Mailjet
4
4
  self.action = 'status'
5
5
  self.resource_path = "REST/newsletter/id/#{self.action}"
6
6
  self.public_operations = [:get]
7
+ self.replaced_by = 'Mailjet::Campaigndraft_status'
7
8
  self.filters = []
8
9
  self.resourceprop = []
9
10
 
@@ -4,6 +4,7 @@ module Mailjet
4
4
  self.action = "test"
5
5
  self.resource_path = "REST/newsletter/id/#{self.action}"
6
6
  self.public_operations = [:post]
7
+ self.replaced_by = 'Mailjet::Campaigndraft_test'
7
8
  self.filters = []
8
9
  self.resourceprop = [:email, :name]
9
10
 
@@ -3,6 +3,7 @@ module Mailjet
3
3
  include Mailjet::Resource
4
4
  self.resource_path = 'REST/openstatistics'
5
5
  self.public_operations = [:get]
6
+ self.replaced_by = 'Mailjet::Statcounters with counter_timing: "Message"'
6
7
  self.filters = [:campaign_id, :campaign_status, :contacts_list, :custom_campaign, :from, :from_domain, :from_id, :from_ts, :from_type, :is_deleted, :is_newsletter_tool, :is_starred, :message_status, :period, :to_ts]
7
8
  self.resourceprop = [:opened_count, :opened_delay, :processed_count]
8
9
 
@@ -3,6 +3,7 @@ module Mailjet
3
3
  include Mailjet::Resource
4
4
  self.resource_path = 'REST/senderstatistics'
5
5
  self.public_operations = [:get]
6
+ self.replaced_by = 'Mailjet::Statcounters with counter_source: "Sender"'
6
7
  self.filters = [:domain, :email, :sender]
7
8
  self.resourceprop = [:blocked_count, :bounced_count, :clicked_count, :delivered_count, :last_activity_at, :opened_count, :processed_count, :queued_count, :sender, :spam_complaint_count, :unsubscribed_count]
8
9
 
@@ -3,7 +3,7 @@ module Mailjet
3
3
  include Mailjet::Resource
4
4
  self.resource_path = 'REST/statcounters'
5
5
  self.public_operations = [:get]
6
- self.filters = [:source_id, :counter_resolution, :counter_source, :counter_timing]
6
+ self.filters = [:source_id, :counter_resolution, :counter_source, :counter_timing, :from_ts, :to_ts]
7
7
  self.resourceprop = [
8
8
  :api_key_id,
9
9
  :event_click_delay,
@@ -0,0 +1,30 @@
1
+ module Mailjet
2
+ class Statistics_recipient_esp
3
+ include Mailjet::Resource
4
+ self.resource_path = 'REST/statistics/recipient-esp'
5
+ self.public_operations = [:get]
6
+ self.filters = [:campaign_id, :esp_name]
7
+ self.resourceprop = [
8
+ :attempted_messages_count,
9
+ :click_through_rate,
10
+ :clicked_messages_count,
11
+ :deferred_messages_count,
12
+ :deferred_rate,
13
+ :delivered_messages_count,
14
+ :esp_name,
15
+ :hard_bounced_messages_count,
16
+ :hard_bounced_rate,
17
+ :open_rate,
18
+ :opened_messages_count,
19
+ :soft_bounced_messages_count,
20
+ :soft_bounced_rate,
21
+ :spam_reports_count,
22
+ :spam_reports_rate,
23
+ :unsubscribed_messages_count,
24
+ :unsubscribed_rate,
25
+ ]
26
+
27
+ self.read_only = true
28
+
29
+ end
30
+ end
@@ -1,3 +1,3 @@
1
1
  module Mailjet
2
- VERSION = "1.8.3"
2
+ VERSION = "1.10.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailjet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.3
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Nappy
@@ -268,6 +268,7 @@ files:
268
268
  - lib/mailjet/resources/senderstatistics.rb
269
269
  - lib/mailjet/resources/statcounters.rb
270
270
  - lib/mailjet/resources/statistics_linkclick.rb
271
+ - lib/mailjet/resources/statistics_recipient_esp.rb
271
272
  - lib/mailjet/resources/template.rb
272
273
  - lib/mailjet/resources/template_detailcontent.rb
273
274
  - lib/mailjet/resources/toplinkclicked.rb
@@ -277,7 +278,7 @@ files:
277
278
  - lib/mailjet/resources/widget.rb
278
279
  - lib/mailjet/resources/widgetcustomvalue.rb
279
280
  - lib/mailjet/version.rb
280
- homepage: http://www.mailjet.com
281
+ homepage: https://www.mailjet.com
281
282
  licenses: []
282
283
  metadata: {}
283
284
  post_install_message: |2+
@@ -305,7 +306,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
306
  - !ruby/object:Gem::Version
306
307
  version: '0'
307
308
  requirements: []
308
- rubygems_version: 3.6.9
309
+ rubygems_version: 4.0.20
309
310
  specification_version: 4
310
311
  summary: Mailjet a powerful all-in-one email service provider clients can use to get
311
312
  maximum insight and deliverability results from both their marketing and transactional