apostle-rails 0.1.0 → 0.1.1

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: 17814d82810c73973e55d1f9789db778a98f460a
4
- data.tar.gz: 441d08eca18a45fb03a8a35a0559fe2b537b5fe7
3
+ metadata.gz: 820ba8052c67159b8831ba1bbbf574194dd6294d
4
+ data.tar.gz: f03e43cbbda3b74b1990868e173a6d7ca9587131
5
5
  SHA512:
6
- metadata.gz: e79d4f8f7ee52128e635926a9d7fcec8b6783ab864998737f9a3665dfdcf91b9b990bd9b4d627f12f4fb7db2ea1b0e364e1cd3cb725f16d3d51066d8ef01a265
7
- data.tar.gz: fefbf49180076092c8b941b14f48fa8f46d783793c62f81250813fff3f944b3dddbae5eaa4b2696208563435eaef72b64e846f11198bd29ccd0bd1fdc9016e18
6
+ metadata.gz: 75f1e252eb9f2834b916a0ea7f565bd4e3e657859db02ce40bf8bb53d17f2a194de3db301c59a58f0f5b39b391b62ec95b68cb2cf0dea1879da376beebd056b7
7
+ data.tar.gz: bee4a097b19fa528b0feb63426f0634a77cf8368407fea42465b6324718c3917692f69542d733382854db0aab8548abe0e2b4efe3bbaf5a1e51130bb595ddee7
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - 1.9.2
6
+ - jruby-19mode # JRuby in 1.9 mode
7
+ - rbx-19mode
8
+ - ruby-head
9
+ - jruby-head
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
- # Apostle::Rails
1
+ # Apostle Rails
2
+ [![Gem Version](https://badge.fury.io/rb/apostle-rails.png)](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
 
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.4"
22
22
  spec.add_development_dependency "rake"
23
23
 
24
- spec.add_dependency "apostle"
24
+ spec.add_runtime_dependency "apostle"
25
25
  end
data/lib/apostle_rails.rb CHANGED
@@ -1,2 +1,9 @@
1
+ require 'apostle'
1
2
  require "apostle_rails/version"
2
3
  require "apostle_rails/mailer"
4
+
5
+ if defined?(Rails) && Rails.env.test?
6
+ Apostle.configure do |config|
7
+ config.deliver = false
8
+ end
9
+ end
@@ -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).to_json
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
@@ -1,3 +1,3 @@
1
1
  module ApostleRails
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  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.0
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-10-13 00:00:00.000000000 Z
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