Skip to content

Commit

Permalink
Add support for headers.
Browse files Browse the repository at this point in the history
Resolves #4
  • Loading branch information
r38y committed Oct 5, 2015
1 parent 0148ac6 commit 6bc34ed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/griddler/postmark/adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 22,21 @@ def normalize_params
text: params[:TextBody],
html: params[:HtmlBody],
attachments: attachment_files,
headers: headers
}
end

private

attr_reader :params

def headers
Array(@params[:Headers]).inject({}) do |hash, header|
hash[header[:Name]] = header[:Value]
hash
end
end

def extract_recipients(key)
params[key].to_a.map { |recipient| full_email(recipient) }
end
Expand Down
11 changes: 10 additions & 1 deletion spec/griddler/postmark/adapter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 31,9 @@
subject: 'Reminder: First and Second Rule',
text: /Dear bob/,
html: %r{<p>Dear bob</p>},
headers: {
"Message-ID" => "<[email protected]>"
}
})
end

Expand Down Expand Up @@ -96,7 99,13 @@ def default_params
}],
Subject: 'Reminder: First and Second Rule',
TextBody: text_body,
HtmlBody: text_html
HtmlBody: text_html,
Headers: [
{
Name: "Message-ID",
Value: "<[email protected]>"
}
]
}
end

Expand Down

0 comments on commit 6bc34ed

Please sign in to comment.