Skip to content

Commit

Permalink
APIMailer: add @Version in options given to Mailjet::Send.create onfl…
Browse files Browse the repository at this point in the history
…y if exists
  • Loading branch information
Lorel authored and arnaudbreton committed Jul 3, 2017
1 parent 2473742 commit 51bed9b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/mailjet/mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ def deliver!(mail, opts = {})
# add `@connection_options` in `options` only if not exist yet (values in `options` prime)
options.reverse_merge!(@connection_options)

# `options[:version]` primes on attribute, both of them on global config
options[:version] ||= (@version || Mailjet.config.api_version)
# add `@version` in options if set
options[:version] = @version if @version

if (options[:version] == 'v3.1')
# `options[:version]` primes on global config
version = options[:version] || Mailjet.config.api_version

if (version == 'v3.1')
Mailjet::Send.create({ :Messages => [setContentV3_1(mail)] }, options)
else
Mailjet::Send.create(setContentV3_0(mail), options)
Expand Down

0 comments on commit 51bed9b

Please sign in to comment.