mailjet 1.5.3 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  module Mailjet
2
2
  class Campaigndraft
3
3
  include Mailjet::Resource
4
- self.resource_path = 'v3/REST/campaigndraft'
4
+ self.resource_path = 'REST/campaigndraft'
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, :template]
7
7
  self.resourceprop = [:campaign, :contacts_list, :created_at, :delivered_at, :edit_mode, :id, :is_starred, :is_text_part_included, :locale, :modified_at, :preset, :reply_email, :segmentation, :sender, :sender_email, :sender_name, :status, :subject, :template_id, :title, :url, :used, 'CampaignID', 'CampaignALT', 'ContactsListID', 'ContactsListALT', 'SegmentationID', 'SegmentationALT', :contacts_list_id,'TemplateID']
@@ -2,10 +2,26 @@ module Mailjet
2
2
  class Campaigndraft_detailcontent
3
3
  include Mailjet::Resource
4
4
  self.action = "detailcontent"
5
- self.resource_path = "v3/REST/campaigndraft/id/#{self.action}"
5
+ self.resource_path = "REST/campaigndraft/id/#{self.action}"
6
6
  self.public_operations = [:get, :post]
7
7
  self.filters = []
8
8
  self.resourceprop = [:text_part, :html_part, :headers, :mjml_content]
9
9
 
10
+ def self.find(id, job_id = nil, options = {})
11
+ opts = define_options(options)
12
+ self.resource_path = create_action_resource_path(id, job_id) if self.action
13
+
14
+ raw_data = parse_api_json(connection(opts)[id].get(default_headers))
15
+
16
+ raw_data.map do |entity|
17
+ instanciate_from_api(entity)
18
+ end
19
+ rescue Mailjet::ApiError => e
20
+ if e.code == 404
21
+ nil
22
+ else
23
+ raise e
24
+ end
25
+ end
10
26
  end
11
27
  end
@@ -2,7 +2,7 @@ module Mailjet
2
2
  class Campaigndraft_schedule
3
3
  include Mailjet::Resource
4
4
  self.action = "schedule"
5
- self.resource_path = "v3/REST/campaigndraft/id/#{self.action}"
5
+ self.resource_path = "REST/campaigndraft/id/#{self.action}"
6
6
  self.public_operations = [:post, :delete , :get]
7
7
  self.filters = []
8
8
  self.resourceprop = [:date]
@@ -2,7 +2,7 @@ module Mailjet
2
2
  class Campaigndraft_send
3
3
  include Mailjet::Resource
4
4
  self.action = "send"
5
- self.resource_path = "v3/REST/campaigndraft/id/#{self.action}"
5
+ self.resource_path = "REST/campaigndraft/id/#{self.action}"
6
6
  self.public_operations = [:post]
7
7
  self.filters = []
8
8
  self.resourceprop = []
@@ -2,7 +2,7 @@ module Mailjet
2
2
  class Campaigndraft_status
3
3
  include Mailjet::Resource
4
4
  self.action = 'status'
5
- self.resource_path = "v3/REST/campaigndraft/id/#{self.action}"
5
+ self.resource_path = "REST/campaigndraft/id/#{self.action}"
6
6
  self.public_operations = [:get]
7
7
  self.filters = []
8
8
  self.resourceprop = []
@@ -2,7 +2,7 @@ module Mailjet
2
2
  class Campaigndraft_test
3
3
  include Mailjet::Resource
4
4
  self.action = "test"
5
- self.resource_path = "v3/REST/campaigndraft/id/#{self.action}"
5
+ self.resource_path = "REST/campaigndraft/id/#{self.action}"
6
6
  self.public_operations = [:post]
7
7
  self.filters = []
8
8
  self.resourceprop = [:email, :name]
@@ -6,5 +6,22 @@ module Mailjet
6
6
  self.public_operations = [:get]
7
7
  self.filters = []
8
8
  self.resourceprop = []
9
+
10
+ def self.find(id, job_id = nil, options = {})
11
+ opts = define_options(options)
12
+ self.resource_path = create_action_resource_path(id, job_id) if self.action
13
+
14
+ raw_data = parse_api_json(connection(opts).get(default_headers))
15
+
16
+ raw_data.map do |entity|
17
+ instanciate_from_api(entity)
18
+ end
19
+ rescue Mailjet::ApiError => e
20
+ if e.code == 404
21
+ nil
22
+ else
23
+ raise e
24
+ end
25
+ end
9
26
  end
10
27
  end
@@ -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
@@ -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.3"
2
+ VERSION = "1.7.0"
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.3
4
+ version: 1.7.0
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-06-30 00:00:00.000000000 Z
14
+ date: 2022-04-22 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
@@ -277,6 +165,8 @@ files:
277
165
  - MIT-LICENSE
278
166
  - README.md
279
167
  - Rakefile
168
+ - lib/generators/mailjet/initializer_generator.rb
169
+ - lib/generators/mailjet/templates/mailjet.rb.erb
280
170
  - lib/mailjet.rb
281
171
  - lib/mailjet/api_error.rb
282
172
  - lib/mailjet/collection_proxy.rb
@@ -362,6 +252,7 @@ files:
362
252
  - lib/mailjet/resources/sender.rb
363
253
  - lib/mailjet/resources/sender_validate.rb
364
254
  - lib/mailjet/resources/senderstatistics.rb
255
+ - lib/mailjet/resources/statcounters.rb
365
256
  - lib/mailjet/resources/template.rb
366
257
  - lib/mailjet/resources/template_detailcontent.rb
367
258
  - lib/mailjet/resources/toplinkclicked.rb
@@ -374,7 +265,17 @@ files:
374
265
  homepage: http://www.mailjet.com
375
266
  licenses: []
376
267
  metadata: {}
377
- post_install_message:
268
+ post_install_message: |2+
269
+
270
+ The Ruby wrapper for Mailjet has just been installed successfully, congrats!
271
+ Maybe you want to configure your credentials to use your account.
272
+ All informations available on https://github.com/mailjet/mailjet-gem.
273
+ But if you are using Rails, you'll be glad to generate it easily using:
274
+
275
+ $ rails generate mailjet:initializer
276
+
277
+ We hope you will enjoy Mailjet!
278
+
378
279
  rdoc_options: []
379
280
  require_paths:
380
281
  - lib
@@ -382,15 +283,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
382
283
  requirements:
383
284
  - - ">="
384
285
  - !ruby/object:Gem::Version
385
- version: '0'
286
+ version: 2.2.0
386
287
  required_rubygems_version: !ruby/object:Gem::Requirement
387
288
  requirements:
388
289
  - - ">="
389
290
  - !ruby/object:Gem::Version
390
291
  version: '0'
391
292
  requirements: []
392
- rubyforge_project:
393
- rubygems_version: 2.4.8
293
+ rubygems_version: 3.0.3
394
294
  signing_key:
395
295
  specification_version: 4
396
296
  summary: Mailjet a powerful all-in-one email service provider clients can use to get