mailjet 1.7.8 → 1.7.10
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 +4 -4
- data/lib/mailjet/connection.rb +5 -5
- data/lib/mailjet/exception/errors.rb +3 -2
- data/lib/mailjet/mailer.rb +1 -1
- data/lib/mailjet/rack/endpoint.rb +2 -2
- data/lib/mailjet/resource.rb +5 -5
- data/lib/mailjet/version.rb +1 -1
- metadata +20 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a012dee3be1fc91064fb9295b7fe8b5a5b95785ccdd309b316ef36b38015b8ed
|
4
|
+
data.tar.gz: 0e178063bcafbe5fc50630d0571821b0088dd85c05f8461eb0fecd64f3ab9855
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f97b0f87b954c4d44496138a3dc278f662de15bba33b4a3975abc227a3b1ff91e75c1bb7fa56361f1bcc3ff2aa9d22918e8e127bfbec23a26c271268b7046aa5
|
7
|
+
data.tar.gz: cefc2978569f6082de806bdc60b2d7ae86eb646ab2c9070d1c503a9da24992066bec53bf4eed1f9ba7f980ace1a2b4ff476935a72c11b3c676abacb220d687e0
|
data/lib/mailjet/connection.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rest_client'
|
2
|
-
require 'yajl
|
2
|
+
require 'yajl'
|
3
3
|
|
4
4
|
module Mailjet
|
5
5
|
class Connection
|
@@ -69,7 +69,7 @@ module Mailjet
|
|
69
69
|
private
|
70
70
|
|
71
71
|
def handle_api_call(method, additional_headers = {}, payload = {}, &block)
|
72
|
-
formatted_payload = (additional_headers[:content_type] == :json) ? payload
|
72
|
+
formatted_payload = (additional_headers[:content_type] == :json) ? Yajl::Encoder.encode(payload) : payload
|
73
73
|
raise Mailjet::MethodNotAllowed unless method_allowed(method)
|
74
74
|
|
75
75
|
if self.perform_api_call
|
@@ -79,7 +79,7 @@ module Mailjet
|
|
79
79
|
@adapter.send(method, formatted_payload, additional_headers, &block)
|
80
80
|
end
|
81
81
|
else
|
82
|
-
return {'Count' => 0, 'Data' => [mock_api_call: true], 'Total' => 0}
|
82
|
+
return Yajl::Encoder.encode({'Count' => 0, 'Data' => [mock_api_call: true], 'Total' => 0})
|
83
83
|
end
|
84
84
|
rescue RestClient::Exception => e
|
85
85
|
handle_exception(e, additional_headers, formatted_payload)
|
@@ -94,7 +94,7 @@ module Mailjet
|
|
94
94
|
return e.http_body if e.http_headers[:content_type].include?("text/plain")
|
95
95
|
|
96
96
|
params = additional_headers[:params] || {}
|
97
|
-
formatted_payload = (additional_headers[:content_type] == :json) ?
|
97
|
+
formatted_payload = (additional_headers[:content_type] == :json) ? Yajl::Parser.parse(payload) : payload
|
98
98
|
params = params.merge!(formatted_payload) if formatted_payload.is_a?(Hash)
|
99
99
|
|
100
100
|
http_body = if e.http_headers[:content_type].include?("application/json")
|
@@ -128,7 +128,7 @@ module Mailjet
|
|
128
128
|
return false unless url.include?('v3.1/send')
|
129
129
|
return unless error_http_body
|
130
130
|
|
131
|
-
parsed_body =
|
131
|
+
parsed_body = Yajl::Parser.parse(error_http_body)
|
132
132
|
error_message = parsed_body.dig('Messages')&.first&.dig('Errors')&.first&.dig('ErrorMessage') || []
|
133
133
|
error_message.include?('is an invalid email address.')
|
134
134
|
rescue
|
@@ -1,4 +1,5 @@
|
|
1
|
-
require 'yajl
|
1
|
+
require 'yajl'
|
2
|
+
require 'json'
|
2
3
|
|
3
4
|
module Mailjet
|
4
5
|
class Error < StandardError
|
@@ -54,7 +55,7 @@ module Mailjet
|
|
54
55
|
end
|
55
56
|
|
56
57
|
api_message = begin
|
57
|
-
|
58
|
+
Yajl::Parser.parse(response.body)['ErrorMessage']
|
58
59
|
rescue Yajl::ParseError
|
59
60
|
response.body
|
60
61
|
rescue NoMethodError
|
data/lib/mailjet/mailer.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rack/request'
|
2
|
-
require 'yajl
|
2
|
+
require 'yajl'
|
3
3
|
|
4
4
|
module Mailjet
|
5
5
|
module Rack
|
@@ -12,7 +12,7 @@ module Mailjet
|
|
12
12
|
|
13
13
|
def call(env)
|
14
14
|
if env['PATH_INFO'] == @path && (content = env['rack.input'].read)
|
15
|
-
@block.call(
|
15
|
+
@block.call(Yajl::Parser.parse(content))
|
16
16
|
[200, { 'Content-Type' => 'text/html', 'Content-Length' => '0' }, []]
|
17
17
|
else
|
18
18
|
@app.call(env)
|
data/lib/mailjet/resource.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'mailjet/connection'
|
2
|
-
require 'yajl
|
2
|
+
require 'yajl'
|
3
3
|
require 'active_support'
|
4
4
|
require 'active_support/core_ext/string'
|
5
5
|
require 'active_support/core_ext/hash/indifferent_access'
|
@@ -78,7 +78,7 @@ module Mailjet
|
|
78
78
|
def count(options = {})
|
79
79
|
opts = define_options(options)
|
80
80
|
response_json = connection(opts).get(default_headers.merge!(params: {limit: 1, countrecords: 1}))
|
81
|
-
response_hash =
|
81
|
+
response_hash = Yajl::Parser.parse(response_json)
|
82
82
|
response_hash['Total']
|
83
83
|
rescue Mailjet::ApiError => error
|
84
84
|
raise error
|
@@ -140,7 +140,7 @@ module Mailjet
|
|
140
140
|
opts = define_options(options)
|
141
141
|
self.resource_path = create_action_resource_path(id) if self.action
|
142
142
|
|
143
|
-
response_hash =
|
143
|
+
response_hash = Yajl::Parser.parse(connection(opts).post(binary_data, default_headers))
|
144
144
|
response_hash['ID'] ? response_hash['ID'] : response_hash
|
145
145
|
end
|
146
146
|
|
@@ -157,7 +157,7 @@ module Mailjet
|
|
157
157
|
end
|
158
158
|
|
159
159
|
def parse_api_json(response_json)
|
160
|
-
response_hash =
|
160
|
+
response_hash = Yajl::Parser.parse(response_json)
|
161
161
|
|
162
162
|
#Take the response from the API and put it through a method -- taken from the ActiveSupport library -- which converts
|
163
163
|
#the date-time from "2014-05-19T15:31:09Z" to "Mon, 19 May 2014 15:31:09 +0000" format.
|
@@ -284,7 +284,7 @@ module Mailjet
|
|
284
284
|
if opts[:perform_api_call] && !persisted?
|
285
285
|
# get attributes only for entity creation
|
286
286
|
self.attributes = if self.resource_path == 'send'
|
287
|
-
|
287
|
+
Yajl::Parser.parse(response)
|
288
288
|
else
|
289
289
|
parse_api_json(response).first
|
290
290
|
end
|
data/lib/mailjet/version.rb
CHANGED
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.7.
|
4
|
+
version: 1.7.10
|
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: 2024-
|
14
|
+
date: 2024-04-16 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -97,6 +97,20 @@ dependencies:
|
|
97
97
|
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
|
+
- !ruby/object:Gem::Dependency
|
101
|
+
name: json
|
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'
|
100
114
|
- !ruby/object:Gem::Dependency
|
101
115
|
name: webmock
|
102
116
|
requirement: !ruby/object:Gem::Requirement
|
@@ -292,11 +306,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
292
306
|
- !ruby/object:Gem::Version
|
293
307
|
version: '0'
|
294
308
|
requirements: []
|
295
|
-
rubygems_version: 3.
|
296
|
-
signing_key:
|
309
|
+
rubygems_version: 3.4.21
|
310
|
+
signing_key:
|
297
311
|
specification_version: 4
|
298
312
|
summary: Mailjet a powerful all-in-one email service provider clients can use to get
|
299
313
|
maximum insight and deliverability results from both their marketing and transactional
|
300
314
|
emails. Our analytics tools and intelligent APIs give senders the best understanding
|
301
315
|
of how to maximize benefits for each individual contact, with each email sent.
|
302
316
|
test_files: []
|
317
|
+
...
|