mailjet 1.7.8 → 1.7.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa7ab8289156e4e9277f016b2e75195de319fcdfc772e3f3de7c1b227ab52a48
4
- data.tar.gz: 30de5a68c95d2dbfe3474fa3cb9d01e1b897dcea43cba3ea02acdf5c7741cfc4
3
+ metadata.gz: 79ac7a46c18530042c2b6c32c04f7fcb7ef0fac062e13e24a7bc4cf79ee3e9a8
4
+ data.tar.gz: 6f6c290689c437ab0db53504c759d79595555659c5501a57682d290bd71b62f1
5
5
  SHA512:
6
- metadata.gz: f9b4217fd1bccc44eb887e14532f5f1c8036bafc98d714743d22deac6e25fa3213d9dd8164e34a4fa3165a6b42a0503790d7d04cb3eafc0862788e2392c6ef27
7
- data.tar.gz: '08ac1f8b54f6b5e34bbd6b1bd45af8a8bcb10714a1e488ce7a9b648b309d468aaba3dd9ac6a101994e6fc5ae65d8a97957603156848c0eba12c12a1b352e2d0e'
6
+ metadata.gz: a19b7e5d407cf862b3bda199b3fbc5ad34c7f12313efb514be5d5534c319d395ea347983e3103f3dadb012a700bda741f8a11d7265fb63fdd072ab3e5c278a6b
7
+ data.tar.gz: 1404c4d766bc4b9690508daa052713bc55e0494ebd3e512ebefe4d2e8b18a453cc17edefc5a7c38e24be58430ea4f3a3f27a42c6ea07a893269f50f0c6b4fe06
@@ -1,5 +1,5 @@
1
1
  require 'rest_client'
2
- require 'yajl/json_gem'
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.to_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}.to_json
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) ? JSON.parse(payload) : payload
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 = JSON.parse(error_http_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,5 +1,3 @@
1
- require 'yajl/json_gem'
2
-
3
1
  module Mailjet
4
2
  class Error < StandardError
5
3
  attr_reader :object
@@ -54,7 +52,7 @@ module Mailjet
54
52
  end
55
53
 
56
54
  api_message = begin
57
- JSON.parse(response.body)['ErrorMessage']
55
+ Yajl::Parser.parse(response.body)['ErrorMessage']
58
56
  rescue Yajl::ParseError
59
57
  response.body
60
58
  rescue NoMethodError
@@ -1,5 +1,5 @@
1
1
  require 'rack/request'
2
- require 'yajl/json_gem'
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(JSON.parse(content))
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)
@@ -1,5 +1,5 @@
1
1
  require 'mailjet/connection'
2
- require 'yajl/json_gem'
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 = JSON.parse(response_json)
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 = JSON.parse(connection(opts).post(binary_data, default_headers))
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 = JSON.parse(response_json)
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
- JSON.parse(response)
287
+ Yajl::Parser.parse(response)
288
288
  else
289
289
  parse_api_json(response).first
290
290
  end
@@ -1,3 +1,3 @@
1
1
  module Mailjet
2
- VERSION = "1.7.8"
2
+ VERSION = "1.7.9"
3
3
  end
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.8
4
+ version: 1.7.9
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-02-13 00:00:00.000000000 Z
14
+ date: 2024-04-16 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -292,11 +292,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
292
292
  - !ruby/object:Gem::Version
293
293
  version: '0'
294
294
  requirements: []
295
- rubygems_version: 3.0.3
296
- signing_key:
295
+ rubygems_version: 3.4.21
296
+ signing_key:
297
297
  specification_version: 4
298
298
  summary: Mailjet a powerful all-in-one email service provider clients can use to get
299
299
  maximum insight and deliverability results from both their marketing and transactional
300
300
  emails. Our analytics tools and intelligent APIs give senders the best understanding
301
301
  of how to maximize benefits for each individual contact, with each email sent.
302
302
  test_files: []
303
+ ...