mailjet 1.0.1 → 1.0.2

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
  SHA1:
3
- metadata.gz: 2be6a74fb51bd389bb3891306adda8484d6502f8
4
- data.tar.gz: fe9905f9978f227106ee168e241be967af1dacb8
3
+ metadata.gz: 5b099b2cb56312e539e49fe4ef484811cc78759d
4
+ data.tar.gz: 8afee6d3003543cd89580ad10d2919966bf559f3
5
5
  SHA512:
6
- metadata.gz: 0a0e85431e034bea7ae72d69c88a4f0350b7050f5b43ec27b5e5f0528524e1cd13cbd80f82b9a81aea997dddbdfb0c96963f2eebdd56a9e4c3475bccd3818cb5
7
- data.tar.gz: 4ec68185cb8d717dc824da84eb35ba9a3bcf2596f8bdc3df4b68ad6bfc83f286741379691b89ac87da125c2aee3b961a2d8b0742b931aa98392bffba27b5d0d5
6
+ metadata.gz: c9bfa9d80dc50955a7694f280c7ad89695f26ee22bc01ac241e5f141d3e88734fb31902f9728b5faa697e812a3f4ae02bd0ae1a7d65beaefe69a47c0c7ca4343
7
+ data.tar.gz: e768169fee0d10f1e4cc735ce796913332989531b960d509c585a7b51c070422d224108aac620dacbd39623a81ab74b3e8e6586aa2a5581c71d78d7240daaee6
data/README.md CHANGED
@@ -39,7 +39,7 @@ This gem helps you to:
39
39
  Compatibility:
40
40
 
41
41
  - Ruby 1.9.X
42
- - Ruby 2.0.0
42
+ - Ruby 2.X.X
43
43
 
44
44
  Rails ActionMailer integration designed for Rails 3.X and 4.X
45
45
 
@@ -53,10 +53,15 @@ Add the following in your Gemfile:
53
53
 
54
54
  ```ruby
55
55
  # Gemfile
56
-
57
56
  gem 'mailjet'
58
57
  ```
59
58
 
59
+ If you wish to use the most up to date version from Github, add the following in your Gemfile instead:
60
+
61
+ ```ruby
62
+ #Gemfile
63
+ gem 'mailjet', :git => 'https://github.com/mailjet/mailjet-gem.git'
64
+ ```
60
65
  and let the bundler magic happen
61
66
 
62
67
  ```bash
@@ -10,13 +10,13 @@ module Mailjet
10
10
  self.code = code
11
11
  # code is ugly, output is pretty
12
12
  super("error #{code} while sending #{request.inspect} to #{request_path} with #{params.inspect}\n\n" +
13
- (res['errors'].present? ?
13
+ if res['errors'].present?
14
14
  [(res['errors'] || [])].flatten.map do |param, text|
15
15
  [param, text].map(&:to_s).reject(&:blank?).join(': ')
16
- end.join("\n") :
16
+ end.join("\n")
17
+ else
17
18
  res.inspect
18
- ) +
19
- "\n\nPlease see http://api.mailjet.com/0.1/HelpStatus for more informations on error numbers.\n\n"
19
+ end + "\n\nPlease see http://api.mailjet.com/0.1/HelpStatus for more informations on error numbers.\n\n"
20
20
  )
21
21
  end
22
22
  end
@@ -19,7 +19,7 @@ module Mailjet
19
19
  extend ActiveSupport::Concern
20
20
 
21
21
  included do
22
- cattr_accessor :resource_path, :public_operations, :read_only, :filters, :properties
22
+ cattr_accessor :resource_path, :public_operations, :read_only, :filters, :properties, :action
23
23
  cattr_writer :connection
24
24
 
25
25
  def self.connection
@@ -58,6 +58,9 @@ module Mailjet
58
58
  end
59
59
 
60
60
  def find(id)
61
+ # if action method, ammend url to appropriate id
62
+ self.resource_path = create_action_resource_path(id) if self.action
63
+ #
61
64
  attributes = parse_api_json(connection[id].get(default_headers)).first
62
65
  instanciate_from_api(attributes)
63
66
  rescue Mailjet::ApiError => e
@@ -69,6 +72,9 @@ module Mailjet
69
72
  end
70
73
 
71
74
  def create(attributes = {})
75
+ # if action method, ammend url to appropriate id
76
+ self.resource_path = create_action_resource_path(attributes[:id]) if self.action
77
+ #
72
78
  self.new(attributes).tap do |resource|
73
79
  resource.save!
74
80
  resource.persisted = true
@@ -76,6 +82,9 @@ module Mailjet
76
82
  end
77
83
 
78
84
  def delete(id)
85
+ # if action method, ammend url to appropriate id
86
+ self.resource_path = create_action_resource_path(id) if self.action
87
+ #
79
88
  connection[id].delete(default_headers)
80
89
  end
81
90
 
@@ -94,6 +103,13 @@ module Mailjet
94
103
  response_data_array.map{ |response_data| underscore_keys(response_data) }
95
104
  end
96
105
 
106
+ def create_action_resource_path(id)
107
+ url_elements = self.resource_path.split("/")
108
+ url_elements[3] = id.to_s
109
+ return url_elements.join("/")
110
+ end
111
+
112
+
97
113
  # Method -- taken from the ActiveSupport library -- which converts the date-time from
98
114
  #"2014-05-19T15:31:09Z" to "Mon, 19 May 2014 15:31:09 +0000" format.
99
115
  #We may have to change this in the future if ActiveSupport's JSON implementation changes
@@ -6,7 +6,7 @@ module Mailjet
6
6
  self.resource_path = 'v3/REST/newsletter'
7
7
  self.public_operations = [:get, :put, :post]
8
8
  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]
9
- self.properties = [: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]
9
+ self.properties = [: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']
10
10
 
11
11
  end
12
12
  end
@@ -0,0 +1,13 @@
1
+ require 'mailjet/resource'
2
+
3
+ module Mailjet
4
+ class Newsletter_detailcontent
5
+ include Mailjet::Resource
6
+ self.action = "detailcontent"
7
+ self.resource_path = "v3/REST/newsletter/id/#{self.action}"
8
+ self.public_operations = [:get, :put, :post, :delete]
9
+ self.filters = []
10
+ self.properties = ["Text-part", "Html-part"]
11
+
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'mailjet/resource'
2
+
3
+ module Mailjet
4
+ class Newsletter_schedule
5
+ include Mailjet::Resource
6
+ self.action = "schedule"
7
+ self.resource_path = "v3/REST/newsletter/id/#{self.action}"
8
+ self.public_operations = [:post, :delete]
9
+ self.filters = []
10
+ self.properties = [:date]
11
+
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ require 'mailjet/resource'
2
+
3
+ module Mailjet
4
+ class Newsletter_send
5
+ include Mailjet::Resource
6
+ self.action = "send"
7
+ self.resource_path = "v3/REST/newsletter/id/#{self.action}"
8
+ self.public_operations = [:post]
9
+ self.filters = []
10
+ self.properties = []
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ require 'mailjet/resource'
2
+
3
+ module Mailjet
4
+ class Newsletter_test
5
+ include Mailjet::Resource
6
+ self.action = "test"
7
+ self.resource_path = "v3/REST/newsletter/id/#{self.action}"
8
+ self.public_operations = [:post]
9
+ self.filters = []
10
+ self.properties = [:email, :name]
11
+
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Mailjet
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,285 +1,288 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailjet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
+ - Tyler Nappy
7
8
  - Jean-Baptiste Escoyez
8
9
  - Aurélien AMILIN
9
10
  - Benoit Bénézech
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2014-11-13 00:00:00.000000000 Z
14
+ date: 2015-01-20 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: activesupport
17
18
  requirement: !ruby/object:Gem::Requirement
18
19
  requirements:
19
- - - '>='
20
+ - - ">="
20
21
  - !ruby/object:Gem::Version
21
22
  version: 3.1.0
22
23
  type: :runtime
23
24
  prerelease: false
24
25
  version_requirements: !ruby/object:Gem::Requirement
25
26
  requirements:
26
- - - '>='
27
+ - - ">="
27
28
  - !ruby/object:Gem::Version
28
29
  version: 3.1.0
29
30
  - !ruby/object:Gem::Dependency
30
31
  name: rack
31
32
  requirement: !ruby/object:Gem::Requirement
32
33
  requirements:
33
- - - '>='
34
+ - - ">="
34
35
  - !ruby/object:Gem::Version
35
36
  version: 1.4.0
36
37
  type: :runtime
37
38
  prerelease: false
38
39
  version_requirements: !ruby/object:Gem::Requirement
39
40
  requirements:
40
- - - '>='
41
+ - - ">="
41
42
  - !ruby/object:Gem::Version
42
43
  version: 1.4.0
43
44
  - !ruby/object:Gem::Dependency
44
45
  name: rest-client
45
46
  requirement: !ruby/object:Gem::Requirement
46
47
  requirements:
47
- - - '>='
48
+ - - ">="
48
49
  - !ruby/object:Gem::Version
49
50
  version: '0'
50
51
  type: :runtime
51
52
  prerelease: false
52
53
  version_requirements: !ruby/object:Gem::Requirement
53
54
  requirements:
54
- - - '>='
55
+ - - ">="
55
56
  - !ruby/object:Gem::Version
56
57
  version: '0'
57
58
  - !ruby/object:Gem::Dependency
58
59
  name: actionmailer
59
60
  requirement: !ruby/object:Gem::Requirement
60
61
  requirements:
61
- - - '>='
62
+ - - ">="
62
63
  - !ruby/object:Gem::Version
63
64
  version: 3.0.9
64
65
  type: :development
65
66
  prerelease: false
66
67
  version_requirements: !ruby/object:Gem::Requirement
67
68
  requirements:
68
- - - '>='
69
+ - - ">="
69
70
  - !ruby/object:Gem::Version
70
71
  version: 3.0.9
71
72
  - !ruby/object:Gem::Dependency
72
73
  name: minitest
73
74
  requirement: !ruby/object:Gem::Requirement
74
75
  requirements:
75
- - - '>='
76
+ - - ">="
76
77
  - !ruby/object:Gem::Version
77
78
  version: '0'
78
79
  type: :development
79
80
  prerelease: false
80
81
  version_requirements: !ruby/object:Gem::Requirement
81
82
  requirements:
82
- - - '>='
83
+ - - ">="
83
84
  - !ruby/object:Gem::Version
84
85
  version: '0'
85
86
  - !ruby/object:Gem::Dependency
86
87
  name: minitest-matchers
87
88
  requirement: !ruby/object:Gem::Requirement
88
89
  requirements:
89
- - - '>='
90
+ - - ">="
90
91
  - !ruby/object:Gem::Version
91
92
  version: '0'
92
93
  type: :development
93
94
  prerelease: false
94
95
  version_requirements: !ruby/object:Gem::Requirement
95
96
  requirements:
96
- - - '>='
97
+ - - ">="
97
98
  - !ruby/object:Gem::Version
98
99
  version: '0'
99
100
  - !ruby/object:Gem::Dependency
100
101
  name: minitest-spec-context
101
102
  requirement: !ruby/object:Gem::Requirement
102
103
  requirements:
103
- - - '>='
104
+ - - ">="
104
105
  - !ruby/object:Gem::Version
105
106
  version: '0'
106
107
  type: :development
107
108
  prerelease: false
108
109
  version_requirements: !ruby/object:Gem::Requirement
109
110
  requirements:
110
- - - '>='
111
+ - - ">="
111
112
  - !ruby/object:Gem::Version
112
113
  version: '0'
113
114
  - !ruby/object:Gem::Dependency
114
115
  name: turn
115
116
  requirement: !ruby/object:Gem::Requirement
116
117
  requirements:
117
- - - '>='
118
+ - - ">="
118
119
  - !ruby/object:Gem::Version
119
120
  version: '0'
120
121
  type: :development
121
122
  prerelease: false
122
123
  version_requirements: !ruby/object:Gem::Requirement
123
124
  requirements:
124
- - - '>='
125
+ - - ">="
125
126
  - !ruby/object:Gem::Version
126
127
  version: '0'
127
128
  - !ruby/object:Gem::Dependency
128
129
  name: rake
129
130
  requirement: !ruby/object:Gem::Requirement
130
131
  requirements:
131
- - - '>='
132
+ - - ">="
132
133
  - !ruby/object:Gem::Version
133
134
  version: '0'
134
135
  type: :development
135
136
  prerelease: false
136
137
  version_requirements: !ruby/object:Gem::Requirement
137
138
  requirements:
138
- - - '>='
139
+ - - ">="
139
140
  - !ruby/object:Gem::Version
140
141
  version: '0'
141
142
  - !ruby/object:Gem::Dependency
142
143
  name: json
143
144
  requirement: !ruby/object:Gem::Requirement
144
145
  requirements:
145
- - - '>='
146
+ - - ">="
146
147
  - !ruby/object:Gem::Version
147
148
  version: '0'
148
149
  type: :development
149
150
  prerelease: false
150
151
  version_requirements: !ruby/object:Gem::Requirement
151
152
  requirements:
152
- - - '>='
153
+ - - ">="
153
154
  - !ruby/object:Gem::Version
154
155
  version: '0'
155
156
  - !ruby/object:Gem::Dependency
156
157
  name: mocha
157
158
  requirement: !ruby/object:Gem::Requirement
158
159
  requirements:
159
- - - '>='
160
+ - - ">="
160
161
  - !ruby/object:Gem::Version
161
162
  version: '0'
162
163
  type: :development
163
164
  prerelease: false
164
165
  version_requirements: !ruby/object:Gem::Requirement
165
166
  requirements:
166
- - - '>='
167
+ - - ">="
167
168
  - !ruby/object:Gem::Version
168
169
  version: '0'
169
170
  - !ruby/object:Gem::Dependency
170
171
  name: webmock
171
172
  requirement: !ruby/object:Gem::Requirement
172
173
  requirements:
173
- - - '>='
174
+ - - ">="
174
175
  - !ruby/object:Gem::Version
175
176
  version: '0'
176
177
  type: :development
177
178
  prerelease: false
178
179
  version_requirements: !ruby/object:Gem::Requirement
179
180
  requirements:
180
- - - '>='
181
+ - - ">="
181
182
  - !ruby/object:Gem::Version
182
183
  version: '0'
183
184
  - !ruby/object:Gem::Dependency
184
185
  name: vcr
185
186
  requirement: !ruby/object:Gem::Requirement
186
187
  requirements:
187
- - - '>='
188
+ - - ">="
188
189
  - !ruby/object:Gem::Version
189
190
  version: '0'
190
191
  type: :development
191
192
  prerelease: false
192
193
  version_requirements: !ruby/object:Gem::Requirement
193
194
  requirements:
194
- - - '>='
195
+ - - ">="
195
196
  - !ruby/object:Gem::Version
196
197
  version: '0'
197
198
  - !ruby/object:Gem::Dependency
198
199
  name: guard
199
200
  requirement: !ruby/object:Gem::Requirement
200
201
  requirements:
201
- - - '>='
202
+ - - ">="
202
203
  - !ruby/object:Gem::Version
203
204
  version: '0'
204
205
  type: :development
205
206
  prerelease: false
206
207
  version_requirements: !ruby/object:Gem::Requirement
207
208
  requirements:
208
- - - '>='
209
+ - - ">="
209
210
  - !ruby/object:Gem::Version
210
211
  version: '0'
211
212
  - !ruby/object:Gem::Dependency
212
213
  name: guard-minitest
213
214
  requirement: !ruby/object:Gem::Requirement
214
215
  requirements:
215
- - - '>='
216
+ - - ">="
216
217
  - !ruby/object:Gem::Version
217
218
  version: '0'
218
219
  type: :development
219
220
  prerelease: false
220
221
  version_requirements: !ruby/object:Gem::Requirement
221
222
  requirements:
222
- - - '>='
223
+ - - ">="
223
224
  - !ruby/object:Gem::Version
224
225
  version: '0'
225
226
  - !ruby/object:Gem::Dependency
226
227
  name: debugger
227
228
  requirement: !ruby/object:Gem::Requirement
228
229
  requirements:
229
- - - '>='
230
+ - - ">="
230
231
  - !ruby/object:Gem::Version
231
232
  version: '0'
232
233
  type: :development
233
234
  prerelease: false
234
235
  version_requirements: !ruby/object:Gem::Requirement
235
236
  requirements:
236
- - - '>='
237
+ - - ">="
237
238
  - !ruby/object:Gem::Version
238
239
  version: '0'
239
240
  - !ruby/object:Gem::Dependency
240
241
  name: rspec
241
242
  requirement: !ruby/object:Gem::Requirement
242
243
  requirements:
243
- - - '>='
244
+ - - ">="
244
245
  - !ruby/object:Gem::Version
245
246
  version: '0'
246
247
  type: :development
247
248
  prerelease: false
248
249
  version_requirements: !ruby/object:Gem::Requirement
249
250
  requirements:
250
- - - '>='
251
+ - - ">="
251
252
  - !ruby/object:Gem::Version
252
253
  version: '0'
253
254
  - !ruby/object:Gem::Dependency
254
255
  name: rspec-expectations
255
256
  requirement: !ruby/object:Gem::Requirement
256
257
  requirements:
257
- - - '>='
258
+ - - ">="
258
259
  - !ruby/object:Gem::Version
259
260
  version: '0'
260
261
  type: :development
261
262
  prerelease: false
262
263
  version_requirements: !ruby/object:Gem::Requirement
263
264
  requirements:
264
- - - '>='
265
+ - - ">="
265
266
  - !ruby/object:Gem::Version
266
267
  version: '0'
267
268
  - !ruby/object:Gem::Dependency
268
269
  name: dotenv
269
270
  requirement: !ruby/object:Gem::Requirement
270
271
  requirements:
271
- - - '>='
272
+ - - ">="
272
273
  - !ruby/object:Gem::Version
273
274
  version: '0'
274
275
  type: :development
275
276
  prerelease: false
276
277
  version_requirements: !ruby/object:Gem::Requirement
277
278
  requirements:
278
- - - '>='
279
+ - - ">="
279
280
  - !ruby/object:Gem::Version
280
281
  version: '0'
281
- description: Cloud Emailing for easy delivery.
282
+ description: Ruby wrapper for Mailjet's v3 API
282
283
  email:
284
+ - tyler@mailjet.com
285
+ - devrel-team@mailjet.com
283
286
  - jbescoyez@gmail.com
284
287
  executables: []
285
288
  extensions: []
@@ -337,6 +340,10 @@ files:
337
340
  - lib/mailjet/resources/metasender.rb
338
341
  - lib/mailjet/resources/myprofile.rb
339
342
  - lib/mailjet/resources/newsletter.rb
343
+ - lib/mailjet/resources/newsletter_detailcontent.rb
344
+ - lib/mailjet/resources/newsletter_schedule.rb
345
+ - lib/mailjet/resources/newsletter_send.rb
346
+ - lib/mailjet/resources/newsletter_test.rb
340
347
  - lib/mailjet/resources/newsletterblock.rb
341
348
  - lib/mailjet/resources/newsletterproperties.rb
342
349
  - lib/mailjet/resources/newslettertemplate.rb
@@ -365,18 +372,21 @@ require_paths:
365
372
  - lib
366
373
  required_ruby_version: !ruby/object:Gem::Requirement
367
374
  requirements:
368
- - - '>='
375
+ - - ">="
369
376
  - !ruby/object:Gem::Version
370
377
  version: '0'
371
378
  required_rubygems_version: !ruby/object:Gem::Requirement
372
379
  requirements:
373
- - - '>='
380
+ - - ">="
374
381
  - !ruby/object:Gem::Version
375
382
  version: '0'
376
383
  requirements: []
377
384
  rubyforge_project:
378
- rubygems_version: 2.4.1
385
+ rubygems_version: 2.2.2
379
386
  signing_key:
380
387
  specification_version: 4
381
- summary: Cloud Emailing for easy delivery.
388
+ summary: Mailjet a powerful all-in-one email service provider clients can use to get
389
+ maximum insight and deliverability results from both their marketing and transactional
390
+ emails. Our analytics tools and intelligent APIs give senders the best understanding
391
+ of how to maximize benefits for each individual contact, with each email sent.
382
392
  test_files: []