apostle-rails 0.1.0 → 0.1.1
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/.travis.yml +9 -0
- data/README.md +14 -3
- data/apostle-rails.gemspec +1 -1
- data/lib/apostle_rails.rb +7 -0
- data/lib/apostle_rails/mailer.rb +3 -3
- data/lib/apostle_rails/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 820ba8052c67159b8831ba1bbbf574194dd6294d
|
4
|
+
data.tar.gz: f03e43cbbda3b74b1990868e173a6d7ca9587131
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75f1e252eb9f2834b916a0ea7f565bd4e3e657859db02ce40bf8bb53d17f2a194de3db301c59a58f0f5b39b391b62ec95b68cb2cf0dea1879da376beebd056b7
|
7
|
+
data.tar.gz: bee4a097b19fa528b0feb63426f0634a77cf8368407fea42465b6324718c3917692f69542d733382854db0aab8548abe0e2b4efe3bbaf5a1e51130bb595ddee7
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
# Apostle
|
1
|
+
# Apostle Rails
|
2
|
+
[](http://badge.fury.io/rb/apostle-rails)
|
2
3
|
|
3
|
-
Rails Bindings for Apostle
|
4
|
+
Rails Bindings for [Apostle.io](http://apostle.io)
|
4
5
|
|
5
6
|
## Installation
|
6
7
|
|
@@ -45,7 +46,7 @@ end
|
|
45
46
|
|
46
47
|
The first param passed to `mail` is the template slug, and instead of `to`, use `email`. `Apostle::Mailer` automatically adds any instance variables you set to the `Apostle::Mail` instance.
|
47
48
|
|
48
|
-
Instead of returning an `ActionMailer` object when `MyMailer.my_mail` you get an instance of `Apostle::Mail`, which you can then call `deliver` on.
|
49
|
+
Instead of returning an `ActionMailer` object when you call `MyMailer.my_mail` you get an instance of `Apostle::Mail`, which you can then call `deliver` on.
|
49
50
|
|
50
51
|
```ruby
|
51
52
|
MyMailer.
|
@@ -53,6 +54,16 @@ MyMailer.
|
|
53
54
|
deliver!
|
54
55
|
```
|
55
56
|
|
57
|
+
### Instance variables
|
58
|
+
Any instance variables you assign will be converted to their `JSON` representation via `#as_json`. This can end up adding extra information which you may not want to send, so it might be easier to create your own hash representations of information.
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
def new_book book, email
|
62
|
+
@book = { title: book.title, author: book.author.name }
|
63
|
+
mail "new_book", email: email
|
64
|
+
end
|
65
|
+
```
|
66
|
+
|
56
67
|
## Who
|
57
68
|
Created with ♥ by [Mal Curtis](http://github.com/snikch) ([@snikchnz](http://twitter.com/snikchnz))
|
58
69
|
|
data/apostle-rails.gemspec
CHANGED
data/lib/apostle_rails.rb
CHANGED
data/lib/apostle_rails/mailer.rb
CHANGED
@@ -53,10 +53,10 @@ module Apostle
|
|
53
53
|
all_instance_vars - @_apostle_known_instance_vars
|
54
54
|
).
|
55
55
|
each do |attr|
|
56
|
-
value = self.instance_variable_get(attr).
|
56
|
+
value = self.instance_variable_get(attr).as_json
|
57
57
|
attr = attr.to_s.gsub('@', '')
|
58
|
-
if m.respond_to?(attr)
|
59
|
-
m.send(attr, value)
|
58
|
+
if m.respond_to?("#{attr}=")
|
59
|
+
m.send("#{attr}=", value)
|
60
60
|
else
|
61
61
|
m.data[attr] = value
|
62
62
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apostle-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mal Curtis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -60,6 +60,7 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- .gitignore
|
63
|
+
- .travis.yml
|
63
64
|
- Gemfile
|
64
65
|
- LICENSE.txt
|
65
66
|
- README.md
|