emailvision4rails 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,12 +3,15 @@ source "http://rubygems.org"
3
3
  gem "rails", "3.2.8"
4
4
  gem "capybara", ">= 0.4.0"
5
5
  gem "sqlite3"
6
+
6
7
  gem "emailvision", "~> 2.1"
7
8
  gem "premailer", "~> 1.7"
8
9
  gem "hpricot", "~> 0.8"
9
10
 
10
- gem "pry", :group => :development
11
+ group :test do
12
+ gem "rake" # Required by Travis
13
+ end
11
14
 
12
- # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
13
- # gem 'ruby-debug'
14
- # gem 'ruby-debug19'
15
+ group :development do
16
+ gem "pry"
17
+ end
data/README.markdown CHANGED
@@ -3,7 +3,7 @@ Emailvision ruby on rails library
3
3
 
4
4
  Emailvision4rails is a library used to manage messages and campaigns or more simply newsletters from your rails application.
5
5
 
6
- /!\ Not released yet /!\
6
+ [![Build Status](https://secure.travis-ci.org/basgys/emailvision4rails.png)](http://travis-ci.org/basgys/emailvision4rails)
7
7
 
8
8
  Install
9
9
  -------
@@ -29,11 +29,11 @@ Setup
29
29
  $ rails generate emailvision4rails:setup
30
30
  ```
31
31
 
32
+ This will create the following config file : **config/emailvision.yml**
33
+
32
34
  Generator
33
35
  ---------
34
36
 
35
- Emailvision4rails is bundled with a newsletter generator.
36
-
37
37
  ```shell
38
38
  $ rails generate newsletter standard daily weekly
39
39
  create app/newsletters/standard_newsletter.rb
@@ -43,156 +43,31 @@ $ rails generate newsletter standard daily weekly
43
43
  create app/views/standard_newsletter/weekly.text.emv
44
44
  ```
45
45
 
46
- Models
47
- ------
48
-
49
- Models are ActiveModel compliant
50
-
51
- **Campaign**
52
-
53
- Attributes
54
-
55
- * **name**
56
- * **mailinglist_id**
57
- * **message_id**
58
- * **send_date**
59
- * description
60
- * emaildedupflg
61
- * format
62
- * delivery_speed
63
- * notification
64
- * post_click_tracking
65
- * strategy
66
- * target
67
- * url_end_campaign
68
- * url_host
69
- * analytics
70
-
71
- *Bold attributes must be present*
72
-
73
- Example
74
-
75
- ```ruby
76
- campaign = Emailvision4rails::Campaign.new(
77
- :name => 'Campaign',
78
- :mailinglist_id => 123,
79
- :message_id => 123,
80
- :send_date => Time.now+30.minutes
81
- )
82
-
83
- if campaign.create
84
- # Campaign created
85
- else
86
- campaign.errors
87
- end
88
- ```
89
-
90
- **Message**
91
-
92
- Attributes
93
-
94
- * **name**
95
- * **subject**
96
- * **from**
97
- * **from_email**
98
- * **body**
99
- * **reply_to**
100
- * **reply_to_email**
101
- * id
102
- * create_date
103
- * to
104
- * description
105
- * encoding
106
- * hotmail_unsub_url
107
- * type
108
- * hotmail_unsub_flg
109
- * is_bounceback
110
-
111
- *Bold attributes must be present*
46
+ Publication
112
47
 
113
48
  ```ruby
114
- message = Emailvision4rails::Message.new(
115
- message_content,
116
- :name => 'My message',
117
- :subject => 'Hello',
118
- :from => 'Bastien Gysler',
119
- :from_email => 'basgys@gmail.com',
120
- :reply_to => 'Bastien Gysler',
121
- :reply_to_email => 'basgys@gmail.com'
122
- )
123
-
124
- if message.create
125
- # Message created
126
- else
127
- message.errors
128
- end
49
+ StandardNewsletter.daily.publish
129
50
  ```
130
51
 
131
- Newsletter (Controller)
132
- -----------------------
133
-
134
- Newsletters work like mailers. These are stored in the *newsletters* directory (/app/newsletters)
135
-
136
- **Example**
137
-
138
- ```shell
139
- $ rails generate newsletter standard
140
- ```
52
+ Preview
141
53
 
142
54
  ```ruby
143
- class StandardNewsletter < Emailvision4rails::AbstractNewsletter
144
-
145
- def daily_fr(params = {})
146
- newsletter(
147
- :message => default_message_params,
148
- :campaign => default_campaign_params.merge(:send_date => Time.now+1.day, :mailinglist_id => 123)
149
- )
150
- end
151
-
152
- private
153
-
154
- def default_message_params
155
- {
156
- :name => 'My message',
157
- :subject => 'Hello',
158
- :from => 'Bastien Gysler',
159
- :from_email => 'basgys@gmail.com',
160
- :body => my_body,
161
- :reply_to => 'Bastien Gysler',
162
- :reply_to_email => 'basgys@gmail.com'
163
- }
164
- end
165
-
166
- def default_campaign_params
167
- {
168
- :name => 'Campaign campaign'
169
- }
170
- end
171
-
172
- end
55
+ StandardNewsletter.daily.to_html # or to_text
173
56
  ```
174
57
 
175
- ```ruby
176
- StandardNewsletter.daily_fr.publish
177
- ```
58
+ More infos
59
+ ----------
178
60
 
179
- Views
180
- -----
181
-
182
- Views are stored in app/views and are suffixed by _newsletter.
183
-
184
- Two formats are available which are html and text and both must be present. Otherwise and ActionView::MissingTemplate error will be raised.
61
+ If you want to dig deeper, Go see our wiki pages.
185
62
 
186
- Template engine that should be used is emv, but others work too.
63
+ Meta
64
+ ----
187
65
 
188
- EMV template engine
189
- -------------------
190
-
191
- EMV is an engine built on top of ERB, but it also adds CSS inlining for HTML files.
192
-
193
- It means you can create your views just like others and EMV will do the dirty work to be "email ready".
66
+ This project uses [Semantic Versioning](http://semver.org/).
194
67
 
195
68
  Author
196
69
  ------
197
70
 
198
- Bastien Gysler :: [bastiengysler.com](http://www.bastiengysler.com/) :: @basgys
71
+ Bastien Gysler :: [bastiengysler.com](http://www.bastiengysler.com/) :: @basgys
72
+
73
+ [![githalytics.com alpha](https://cruel-carlota.pagodabox.com/29de0b7cb36b0eb1bdd31740b3056f71 "githalytics.com")](http://githalytics.com/basgys/emailvision4rails)
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ rescue LoadError
7
7
  end
8
8
 
9
9
  require 'rake'
10
- require 'rake/rdoctask'
10
+ require 'rdoc/task'
11
11
 
12
12
  require 'rake/testtask'
13
13
 
@@ -25,9 +25,16 @@ class Emailvision4rails::Campaign < Emailvision4rails::Base
25
25
  :send_date
26
26
  )
27
27
 
28
- validate :send_date_must_be_in_the_future, :message => "must be more than 5 minutes in the future"
28
+ validates_numericality_of(
29
+ :mailinglist_id,
30
+ :message_id
31
+ )
29
32
 
30
- # Validate format of email address
33
+ validate do
34
+ if send_date.blank? or (send_date < Time.now+5.minutes)
35
+ errors.add(:send_date, "must be more than 5 minutes in the future")
36
+ end
37
+ end
31
38
 
32
39
  def initialize(payload = {})
33
40
  payload.each do |attr, val|
@@ -45,11 +52,4 @@ class Emailvision4rails::Campaign < Emailvision4rails::Base
45
52
  false
46
53
  end
47
54
  end
48
-
49
- private
50
-
51
- def send_date_must_be_in_the_future
52
- # Adds 5 minutes to ensure futurness of send date between validation and publication
53
- send_date.present? ? (send_date > Time.now+5.minutes) : false
54
- end
55
55
  end
@@ -3,7 +3,7 @@ module Emailvision4rails
3
3
  def initialize(html)
4
4
  ::Premailer.send(:include, Adapter.find(Adapter.use))
5
5
 
6
- encoding = Configuration.encoding.upcase
6
+ encoding = Configuration.encoding.try(:upcase)
7
7
  options = {
8
8
  :adapter => :hpricot,
9
9
  :warn_level => Premailer::Warnings::SAFE,
@@ -1,3 +1,3 @@
1
1
  module Emailvision4rails
2
- Version = VERSION = '0.1.0'
2
+ Version = VERSION = '0.1.1'
3
3
  end
@@ -1,5 +1,5 @@
1
1
  module Emailvision4rails
2
- class Setup < Rails::Generators::Base
2
+ class SetupGenerator < Rails::Generators::Base
3
3
 
4
4
  source_root File.expand_path('../templates', __FILE__)
5
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emailvision4rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-22 00:00:00.000000000 Z
12
+ date: 2012-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails