volt-mailer 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: ac84cefe672745a926338885673a025532738ba1
4
- data.tar.gz: 174a2ded619a67af01da3cae548be84349a1b32a
3
+ metadata.gz: d4443ba2cab47ae8310de857d279a1429adc4812
4
+ data.tar.gz: 483ac8ed5d0b1e881956dcfad7b7fda56e4fa97a
5
5
  SHA512:
6
- metadata.gz: 63d219d0d83e2959f5415061ff1b5a6db25888194e0f060938a63a60d685f9f5a2dc900304ad5a7d28b9a10b5dbb496298851a08a1169cd74a66b6db3c57e4f2
7
- data.tar.gz: ec322d89bcd242c4ee165938471d9ed16f0ab5a4886efbe0c1caa0ef5d3de7ceac400adfea246ec17c173cb56faee6b03046216464e8f5751e0ec284bc4df224
6
+ metadata.gz: 10b83d122290d4e269fa0e014d35138fa3dfc54d104b1afeea72cace4acf7c3daa0dac055f2534543f34263d64e3fe5188facdc694efd6046e96d780a5f70c59
7
+ data.tar.gz: 7980a20f309ae3f729bf1d093113cefa51acb361d1a0f4a15430d82b089200ee8c0ac09e8c10dff4a36a32cb49f18f848560c1fd1e03edf375e52b74f340dc0a
data/README.md CHANGED
@@ -38,22 +38,16 @@ Welcome
38
38
 
39
39
  ## Delivery
40
40
 
41
- On the client or the server you can send an e-mail with:
41
+ On the the server you can send an e-mail with:
42
42
 
43
43
  ```ruby
44
- Mailer.deliver('path/to/views', {to: 'someone@address.com'}).then do
45
- # email sent
46
- end.fail do |errors|
47
- # failed to send, handle errors
48
- end
44
+ Mailer.deliver('path/to/views', {to: 'someone@address.com'})
49
45
  ```
50
46
 
51
47
  Mailer.deliver takes two arguments, the path to your mailer and a hash of options. In a new volt project, there will be an "app/main/views/mailer" folder. Any view with .email (or .html) can be used. Normally you would use a .email view. Views with the .email extension will not be loaded on the client.
52
48
 
53
49
  If you skip the :Html section, the :Text section will be used for the html e-mail.
54
50
 
55
- The ```Mailer``` class is a Volt::Task, so the deliver method returns a promise. Be sure to handle the fail.
56
-
57
51
  The second argument is a hash of options. volt-mailer uses the [pony gem](https://github.com/benprew/pony) under the hood to deliver the mail. Any supported pony options will be passed to pony during the sending. All options passed in will be exposed as methods inside of the email template. If a matching controller is provided, the options will be set as the controllers model.
58
52
 
59
53
  ## Attachments
@@ -3,8 +3,8 @@ unless RUBY_PLATFORM == 'opal'
3
3
  require 'volt/page/path_string_renderer'
4
4
  end
5
5
 
6
- class Mailer < Volt::Task
7
- def deliver(view_path, attrs)
6
+ module Mailer
7
+ def self.deliver(view_path, attrs)
8
8
  attrs = attrs.symbolize_keys
9
9
 
10
10
  raise ":to must be supplied when delivering e-mail" unless attrs[:to]
@@ -43,7 +43,5 @@ class Mailer < Volt::Task
43
43
 
44
44
  # Send the e-mail
45
45
  Pony.mail(pony_options)
46
-
47
- true
48
46
  end
49
47
  end
@@ -0,0 +1,7 @@
1
+ unless RUBY_PLATFORM == 'opal'
2
+ require 'pony'
3
+ require 'volt/page/path_string_renderer'
4
+ end
5
+
6
+ class Mailer < Volt::Task
7
+ end
@@ -1,5 +1,5 @@
1
1
  module Volt
2
2
  module Mailer
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
data/lib/volt/mailer.rb CHANGED
@@ -1,5 +1,4 @@
1
- # Add mailer to the list of default loaded components
2
- Volt.config.default_components << 'mailer'
1
+ require 'volt/mailer/mailer'
3
2
 
4
3
  module Volt
5
4
  module Mailer
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: volt-mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Stout
@@ -64,8 +64,9 @@ files:
64
64
  - README.md
65
65
  - Rakefile
66
66
  - app/mailer/config/dependencies.rb
67
- - app/mailer/tasks/mailer_task.rb
68
67
  - lib/volt/mailer.rb
68
+ - lib/volt/mailer/mailer.rb
69
+ - lib/volt/mailer/mailer_task.rb
69
70
  - lib/volt/mailer/version.rb
70
71
  - volt-mailer.gemspec
71
72
  homepage: ''