snails 0.5.1 → 0.5.3
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/snails/app.rb +2 -2
- data/lib/snails/mailer.rb +9 -6
- data/snails.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2141ab903141a92598342792b0899b2edbc2a34f5bb0b99e15fe29cfcba39b0
|
4
|
+
data.tar.gz: 4ba7c23a174c9dd87ca088e0c3a9bb3394aaf83798a8ea00bb54fbf323a00b96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82448a3d03af7f7ebf4d8a40a95c4b95c193e0cfa4f93787eb3da22fbe21e6fdeaece97673037a44d2d47ff36b8962cfde325ec943461bf85c98b5444749ea30
|
7
|
+
data.tar.gz: 21b7792db470ed2967b7961593777873af3d5b50dcc23b3ba30d37d075354c42f4c9377bea8a416c13c00a2099eab60ab2e05cbb5693e199227ed05b88f493e8
|
data/lib/snails/app.rb
CHANGED
@@ -243,7 +243,7 @@ module Snails
|
|
243
243
|
value += checked ? " checked='true'" : ''
|
244
244
|
end
|
245
245
|
|
246
|
-
label + raw_input(index, type, id, name, value, options[:placeholder], classes: classes, disabled: options[:disabled])
|
246
|
+
label + raw_input(index, type, id, name, value, placeholder: options[:placeholder], classes: classes, disabled: options[:disabled])
|
247
247
|
end
|
248
248
|
|
249
249
|
def form_textarea(object, field, options = {})
|
@@ -414,7 +414,7 @@ module Snails
|
|
414
414
|
|
415
415
|
set :protection, except: :frame_options
|
416
416
|
set :views, Snails.root.join('lib', 'views')
|
417
|
-
set :static_paths, %w(/css /img /js /files /fonts favicon.ico)
|
417
|
+
set :static_paths, %w(/css /img /js /files /fonts /favicon.ico)
|
418
418
|
|
419
419
|
enable :method_override
|
420
420
|
enable :logging
|
data/lib/snails/mailer.rb
CHANGED
@@ -187,7 +187,7 @@ A <%= @exception.class %> occurred in <%= @url %>:
|
|
187
187
|
resp, email = Tuktuk.deliver(email, debug: debug)
|
188
188
|
|
189
189
|
if resp.is_a?(Tuktuk::Bounce)
|
190
|
-
puts "[#{to}] Email bounced! [#{resp.code}] #{resp.message}"
|
190
|
+
puts "[#{email[:to]}] Email bounced! [#{resp.code}] #{resp.message}"
|
191
191
|
end
|
192
192
|
|
193
193
|
return resp, email
|
@@ -201,8 +201,8 @@ A <%= @exception.class %> occurred in <%= @url %>:
|
|
201
201
|
class MailgunBackend < Backend
|
202
202
|
|
203
203
|
def initialize(api_key:, domain_name:)
|
204
|
-
@key = api_key
|
205
|
-
@url = "https://api.mailgun.net/v3/#{domain_name}/messages"
|
204
|
+
# @key = api_key
|
205
|
+
@url = "https://api:#{api_key}@api.mailgun.net/v3/#{domain_name}/messages"
|
206
206
|
end
|
207
207
|
|
208
208
|
def deliver(email, options = {})
|
@@ -221,9 +221,12 @@ A <%= @exception.class %> occurred in <%= @url %>:
|
|
221
221
|
raise ArgumentError, "Either text or html required"
|
222
222
|
end
|
223
223
|
|
224
|
-
|
225
|
-
|
226
|
-
|
224
|
+
if email[:attachments]
|
225
|
+
data[:attachment] = email[:attachments].map { |att| { att[:content] }
|
226
|
+
end
|
227
|
+
|
228
|
+
resp = RestClient.post(@url, data)
|
229
|
+
resp.code == 200 ? [resp.body, data[:to]] : nil
|
227
230
|
end
|
228
231
|
|
229
232
|
end
|
data/snails.gemspec
CHANGED