mailjet 1.5.4 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,5 +8,21 @@ module Mailjet
8
8
 
9
9
  self.read_only = true
10
10
 
11
+ def self.find(id, job_id = nil, options = {})
12
+ opts = define_options(options)
13
+ self.resource_path = create_action_resource_path(id, job_id) if self.action
14
+
15
+ raw_data = parse_api_json(connection(opts)[id].get(default_headers))
16
+
17
+ raw_data.map do |entity|
18
+ instanciate_from_api(entity)
19
+ end
20
+ rescue Mailjet::ApiError => e
21
+ if e.code == 404
22
+ nil
23
+ else
24
+ raise e
25
+ end
26
+ end
11
27
  end
12
28
  end
@@ -8,5 +8,22 @@ module Mailjet
8
8
 
9
9
  self.read_only = true
10
10
 
11
+ def self.find(id, job_id = nil, options = {})
12
+ opts = define_options(options)
13
+ self.resource_path = create_action_resource_path(id, job_id) if self.action
14
+
15
+ raw_data = parse_api_json(connection(opts)[id].get(default_headers))
16
+
17
+ raw_data.map do |entity|
18
+ instanciate_from_api(entity)
19
+ end
20
+ rescue Mailjet::ApiError => e
21
+ if e.code == 404
22
+ nil
23
+ else
24
+ raise e
25
+ end
26
+ end
27
+
11
28
  end
12
29
  end
@@ -4,7 +4,6 @@ module Mailjet
4
4
  self.resource_path = 'REST/newsletter'
5
5
  self.public_operations = [:get, :put, :post]
6
6
  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
- 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, :sender, :sender_email, :sender_name, :status, :subject, :template, :test_address, :title, :url, 'CampaignID', 'CampaignALT', 'ContactsListID', 'ContactsListALT', 'SegmentationID', 'SegmentationALT', :contacts_list_id]
8
-
7
+ 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]
9
8
  end
10
9
  end
@@ -8,5 +8,22 @@ module Mailjet
8
8
 
9
9
  self.read_only = true
10
10
 
11
+ def self.find(id, job_id = nil, options = {})
12
+ opts = define_options(options)
13
+ self.resource_path = create_action_resource_path(id, job_id) if self.action
14
+
15
+ raw_data = parse_api_json(connection(opts)[id].get(default_headers))
16
+
17
+ raw_data.map do |entity|
18
+ instanciate_from_api(entity)
19
+ end
20
+ rescue Mailjet::ApiError => e
21
+ if e.code == 404
22
+ nil
23
+ else
24
+ raise e
25
+ end
26
+ end
27
+
11
28
  end
12
29
  end
@@ -1,7 +1,7 @@
1
1
  module Mailjet
2
2
  class Send
3
3
  include Mailjet::Resource
4
- # self.version = 'v3.1'
4
+
5
5
  self.resource_path = 'send'
6
6
  self.public_operations = [:post]
7
7
  end
@@ -0,0 +1,33 @@
1
+ module Mailjet
2
+ class Statcounters
3
+ include Mailjet::Resource
4
+ self.resource_path = 'REST/statcounters'
5
+ self.public_operations = [:get]
6
+ self.filters = [:source_id, :counter_resolution, :counter_source, :counter_timing]
7
+ self.resourceprop = [
8
+ :api_key_id,
9
+ :event_click_delay,
10
+ :event_clicked_count,
11
+ :event_open_delay,
12
+ :event_opened_count,
13
+ :event_spam_count,
14
+ :event_unsubscribed_count,
15
+ :event_workflow_exited_count,
16
+ :message_blocked_count,
17
+ :message_clicked_count,
18
+ :message_deferred_count,
19
+ :message_hard_bounced_count,
20
+ :message_opened_count,
21
+ :message_queued_count,
22
+ :message_sent_count,
23
+ :message_soft_bounced_count,
24
+ :message_spam_count,
25
+ :message_unsubscribed_count,
26
+ :message_work_flow_exited_count,
27
+ :source_id,
28
+ :timeslice,
29
+ :total,
30
+ ]
31
+ self.read_only = true
32
+ end
33
+ end
@@ -0,0 +1,12 @@
1
+ module Mailjet
2
+ class Statistics_linkclick
3
+ include Mailjet::Resource
4
+ self.resource_path = 'REST/statistics/link-click'
5
+ self.public_operations = [:get]
6
+ self.filters = [:campaign_id]
7
+ self.resourceprop = [:url, :position_index, :clicked_messages_count, :clicked_events_count]
8
+
9
+ self.read_only = true
10
+
11
+ end
12
+ end
@@ -1,10 +1,26 @@
1
1
  module Mailjet
2
2
  class Template_detailcontent
3
3
  include Mailjet::Resource
4
- self.resource_path = 'REST/template/id/${self.action}'
5
- self.public_operations = [:get, :put, :post, :delete]
4
+ self.action = 'detailcontent'
5
+ self.resource_path = "REST/template/id/#{self.action}"
6
+ self.public_operations = [:get,:post]
6
7
  self.filters = [:api_key, :categories, :categories_selection_method, :edit_mode, :name, :owner_type, :purposes, :purposes_selection_method, :user]
7
8
  self.resourceprop = [:author, :categories, :copyright, :description, :edit_mode, :is_starred, :name, :owner_type, :presets, :purposes]
8
9
 
10
+ def self.find(id, options = {})
11
+ self.resource_path = create_action_resource_path(id)
12
+
13
+ opts = define_options(options)
14
+ response = connection(opts).get(default_headers)
15
+ attributes = parse_api_json(response).first
16
+
17
+ instanciate_from_api(attributes)
18
+ rescue Mailjet::ApiError => e
19
+ if e.code == 404
20
+ nil
21
+ else
22
+ raise e
23
+ end
24
+ end
9
25
  end
10
26
  end
@@ -1,3 +1,3 @@
1
1
  module Mailjet
2
- VERSION = "1.5.4"
2
+ VERSION = "1.7.1"
3
3
  end
data/lib/mailjet.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'active_support'
1
+ require 'json/ext'
2
2
  require 'ostruct'
3
3
  require 'mailjet/core_extensions/ostruct'
4
4
  require 'mailjet/configuration'
@@ -21,7 +21,7 @@ module Mailjet
21
21
  end
22
22
  end
23
23
 
24
- if defined?(ActionMailer)
24
+ ActiveSupport.on_load(:action_mailer) do
25
25
  require 'action_mailer/version'
26
26
  require 'mailjet/mailer' if ActionMailer::Base.respond_to?(:add_delivery_method)
27
27
  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.5.4
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Nappy
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-07-03 00:00:00.000000000 Z
14
+ date: 2022-08-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -47,14 +47,14 @@ dependencies:
47
47
  requirements:
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: '0'
50
+ version: 2.0.0
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - ">="
56
56
  - !ruby/object:Gem::Version
57
- version: '0'
57
+ version: 2.0.0
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: actionmailer
60
60
  requirement: !ruby/object:Gem::Requirement
@@ -69,62 +69,6 @@ dependencies:
69
69
  - - ">="
70
70
  - !ruby/object:Gem::Version
71
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
- - - ">="
84
- - !ruby/object:Gem::Version
85
- version: '0'
86
- - !ruby/object:Gem::Dependency
87
- name: minitest-matchers
88
- requirement: !ruby/object:Gem::Requirement
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: '0'
93
- type: :development
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
108
- prerelease: false
109
- version_requirements: !ruby/object:Gem::Requirement
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- version: '0'
114
- - !ruby/object:Gem::Dependency
115
- name: turn
116
- requirement: !ruby/object:Gem::Requirement
117
- requirements:
118
- - - ">="
119
- - !ruby/object:Gem::Version
120
- version: '0'
121
- type: :development
122
- prerelease: false
123
- version_requirements: !ruby/object:Gem::Requirement
124
- requirements:
125
- - - ">="
126
- - !ruby/object:Gem::Version
127
- version: '0'
128
72
  - !ruby/object:Gem::Dependency
129
73
  name: rake
130
74
  requirement: !ruby/object:Gem::Requirement
@@ -153,20 +97,6 @@ dependencies:
153
97
  - - ">="
154
98
  - !ruby/object:Gem::Version
155
99
  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
100
  - !ruby/object:Gem::Dependency
171
101
  name: webmock
172
102
  requirement: !ruby/object:Gem::Requirement
@@ -195,34 +125,6 @@ dependencies:
195
125
  - - ">="
196
126
  - !ruby/object:Gem::Version
197
127
  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
128
  - !ruby/object:Gem::Dependency
227
129
  name: rspec
228
130
  requirement: !ruby/object:Gem::Requirement
@@ -237,20 +139,6 @@ dependencies:
237
139
  - - ">="
238
140
  - !ruby/object:Gem::Version
239
141
  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
142
  - !ruby/object:Gem::Dependency
255
143
  name: dotenv
256
144
  requirement: !ruby/object:Gem::Requirement
@@ -364,6 +252,8 @@ files:
364
252
  - lib/mailjet/resources/sender.rb
365
253
  - lib/mailjet/resources/sender_validate.rb
366
254
  - lib/mailjet/resources/senderstatistics.rb
255
+ - lib/mailjet/resources/statcounters.rb
256
+ - lib/mailjet/resources/statistics_linkclick.rb
367
257
  - lib/mailjet/resources/template.rb
368
258
  - lib/mailjet/resources/template_detailcontent.rb
369
259
  - lib/mailjet/resources/toplinkclicked.rb
@@ -394,15 +284,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
394
284
  requirements:
395
285
  - - ">="
396
286
  - !ruby/object:Gem::Version
397
- version: '0'
287
+ version: 2.2.0
398
288
  required_rubygems_version: !ruby/object:Gem::Requirement
399
289
  requirements:
400
290
  - - ">="
401
291
  - !ruby/object:Gem::Version
402
292
  version: '0'
403
293
  requirements: []
404
- rubyforge_project:
405
- rubygems_version: 2.5.1
294
+ rubygems_version: 3.0.3
406
295
  signing_key:
407
296
  specification_version: 4
408
297
  summary: Mailjet a powerful all-in-one email service provider clients can use to get