mail-control 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: caaf2a07f4cecd59194d9daf3e6d0e04ee9dedf7
4
- data.tar.gz: 4c943c088a90bd54ad7e7f3ae62eaf943325ebce
3
+ metadata.gz: 28eec123b42a400284f71afc92e989d4f2877ea3
4
+ data.tar.gz: 6d766275023a1500be441f65cc9d2f54d5bb9265
5
5
  SHA512:
6
- metadata.gz: 776a0118e140c9692d61cb15b728a04b932697ac4091606fa537ae61eb097792140ebc12c11a6044dc990ecbc80d26d5b37b7d67d2a102ec4b4798bcd2f79663
7
- data.tar.gz: 219ff9a4a205aea11a8144ea63164b575405dae75347dfb41275d7dae6a41a123dcd5889ce71446405b97063834500ac9e3710285964a9cfae137c399d1f6344
6
+ metadata.gz: 4a6491f83866a569a8fc84686ce88fd5eafdacab1f530755a0e3283f7bedb65b9cdc2cd69b6ad14661f85b407467a4964e29e1b08dd4ce37d2c5593a90659f74
7
+ data.tar.gz: a57e599e6528aa33a559c90f9505b8ce306d2894be50f2e380b0ae6bc1795dc3c43d19b1a294ff0c1490fc4873b52de09197ba751f6b7b5823282357c41b8242
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.1.1
4
+
5
+ * Add license to gemspec
6
+
3
7
  ## 0.1.0
4
8
 
5
9
  First version of gem
data/README.md CHANGED
@@ -16,21 +16,21 @@ This gem is inspired by Streama by Christopher Pappas.
16
16
  ### Create migration for logged_emails and migrate the database (in your Rails project):
17
17
 
18
18
  ```ruby
19
- rails g mail-control:migration
19
+ rails g mail_control:migration
20
20
  rake db:migrate
21
21
  ```
22
22
 
23
23
  ### Define Queued Task
24
24
 
25
- Create an LoggedEmail model and define the logged_emails and the fields you would like to cache within the queued_task.
25
+ Create an LoggedEmail model and define the logged_emails and the fields you would like to cache within the mailing.
26
26
 
27
- An queued_task consists of an actor, a verb, an act_object, and a target.
27
+ An mailing consists of an actor, a verb, an act_object, and a target.
28
28
 
29
29
  ``` ruby
30
30
  class LoggedEmail < ActiveRecord::Base
31
31
  include MailControl::LoggedEmail
32
32
 
33
- queued_task :new_enquiry do
33
+ mailing :new_enquiry do
34
34
  actor :User
35
35
  act_object :Article
36
36
  act_target :Volume
@@ -38,9 +38,9 @@ class LoggedEmail < ActiveRecord::Base
38
38
  end
39
39
  ```
40
40
 
41
- The queued_task verb is implied from the queued_task name, in the above example the verb is :new_enquiry
41
+ The mailing verb is implied from the mailing name, in the above example the verb is :new_enquiry
42
42
 
43
- The act_object may be the entity performing the queued_task, or the entity on which the queued_task was performed.
43
+ The act_object may be the entity performing the mailing, or the entity on which the mailing was performed.
44
44
  e.g John(actor) shared a video(act_object)
45
45
 
46
46
  The target is the act_object that the verb is enacted on.
@@ -69,18 +69,18 @@ In your controller or background worker:
69
69
  current_user.send_email(:new_enquiry, :act_object => @enquiry, :target => @listing)
70
70
  ```
71
71
 
72
- This will publish the queued_task to the mongoid act_objects returned by the #followers method in the Actor.
72
+ This will publish the mailing to the mongoid act_objects returned by the #followers method in the Actor.
73
73
 
74
74
 
75
75
  ## Retrieving LoggedEmail
76
76
 
77
- To retrieve all queued_task for an actor
77
+ To retrieve all mailing for an actor
78
78
 
79
79
  ``` ruby
80
80
  current_user.logged_emails
81
81
  ```
82
82
 
83
- To retrieve and filter to a particular queued_task type
83
+ To retrieve and filter to a particular mailing type
84
84
 
85
85
  ``` ruby
86
86
  current_user.logged_emails(:verb => 'new_enquiry')
@@ -94,7 +94,7 @@ Additional options can be required:
94
94
  class LoggedEmail < ActiveRecord::Base
95
95
  include MailControl::LoggedEmail
96
96
 
97
- queued_task :new_enquiry do
97
+ mailing :new_enquiry do
98
98
  actor :User
99
99
  act_object :Article
100
100
  act_target :Volume
@@ -110,13 +110,13 @@ The option fields are stored using the ActiveRecord 'store' feature.
110
110
  #### Bond type
111
111
 
112
112
  A verb can have one bond type. This bond type can be used to classify and quickly retrieve
113
- queued_task feed items that belong to a particular aggregate feed, like e.g the global feed.
113
+ mailing feed items that belong to a particular aggregate feed, like e.g the global feed.
114
114
 
115
115
  ``` ruby
116
116
  class LoggedEmail < ActiveRecord::Base
117
117
  include MailControl::LoggedEmail
118
118
 
119
- queued_task :new_enquiry do
119
+ mailing :new_enquiry do
120
120
  actor :User
121
121
  act_object :Article
122
122
  act_target :Volume
@@ -7,7 +7,7 @@ module MailControl
7
7
  module Base
8
8
  # Get path for migration template
9
9
  def source_root
10
- @_mail_control_source_root ||= File.expand_path(File.join('../mail-control', generator_name, 'templates'), __FILE__)
10
+ @_mail_control_source_root ||= File.expand_path(File.join('../mail_control', generator_name, 'templates'), __FILE__)
11
11
  end
12
12
  end
13
13
  end
@@ -1,9 +1,9 @@
1
- require 'generators/mail-control'
1
+ require 'generators/mail_control'
2
2
  require 'rails/generators/active_record'
3
3
 
4
4
  module MailControl
5
5
  module Generators
6
- # LoggedEmail generator that creates queued_task model file from template
6
+ # LoggedEmail generator that creates mailing model file from template
7
7
  class LoggedEmailGenerator < ActiveRecord::Generators::Base
8
8
  extend Base
9
9
 
@@ -1,7 +1,7 @@
1
- require 'generators/mail-control'
1
+ require 'generators/mail_control'
2
2
  require 'rails/generators/active_record'
3
3
 
4
- module LiveStream
4
+ module MailControl
5
5
  module Generators
6
6
  # Migration generator that creates migration file from template
7
7
  class MigrationGenerator < ActiveRecord::Generators::Base
@@ -4,7 +4,7 @@ module MailControl
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
7
- cattr_accessor :queued_task_klass
7
+ cattr_accessor :mailing_klass
8
8
 
9
9
  has_many :logged_emails, :class_name => "LoggedEmail", :as => :actor
10
10
  has_many :act_object_logged_emails, :class_name => "LoggedEmail", :as => :act_object
@@ -16,17 +16,17 @@ module MailControl
16
16
  module ClassMethods
17
17
 
18
18
  def mail_control_class(klass)
19
- self.queued_task_klass = klass.to_s
19
+ self.mailing_klass = klass.to_s
20
20
  end
21
21
 
22
22
  end
23
23
 
24
24
 
25
- # Publishes the queued_task to the receivers
25
+ # Publishes the mailing to the receivers
26
26
  #
27
27
  # @param [ Hash ] options The options to publish with.
28
28
  #
29
- # @example publish an queued_task with a act_object and act_target
29
+ # @example publish an mailing with a act_object and act_target
30
30
  # current_user.send_email(:enquiry, :act_object => @enquiry, :act_target => @listing)
31
31
  #
32
32
  def send_email(name, options={})
@@ -40,7 +40,7 @@ module MailControl
40
40
  end
41
41
 
42
42
  def mail_control_class
43
- @queued_task_klass ||= queued_task_klass ? queued_task_klass.classify.constantize : ::LoggedEmail
43
+ @mailing_klass ||= mailing_klass ? mailing_klass.classify.constantize : ::LoggedEmail
44
44
  end
45
45
 
46
46
  def actor_logged_emails(options = {})
@@ -42,26 +42,26 @@ module MailControl
42
42
 
43
43
  # Defines a new LoggedEmail2 type and registers a definition
44
44
  #
45
- # @param [ String ] name The name of the queued_task
45
+ # @param [ String ] name The name of the mailing
46
46
  #
47
- # @example Define a new queued_task
48
- # queued_task(:enquiry) do
47
+ # @example Define a new mailing
48
+ # mailing(:enquiry) do
49
49
  # actor :user, :cache => [:full_name]
50
50
  # act_object :enquiry, :cache => [:subject]
51
51
  # act_target :listing, :cache => [:title]
52
52
  # end
53
53
  #
54
54
  # @return [Definition] Returns the registered definition
55
- def queued_task(name, &block)
55
+ def mailing(name, &block)
56
56
  definition = MailControl::DefinitionDSL.new(name)
57
57
  definition.instance_eval(&block)
58
58
  MailControl::Definition.register(definition)
59
59
  end
60
60
 
61
- # Publishes an queued_task using an queued_task name and data
61
+ # Publishes an mailing using an mailing name and data
62
62
  #
63
- # @param [ String ] verb The verb of the queued_task
64
- # @param [ Hash ] data The data to initialize the queued_task with.
63
+ # @param [ String ] verb The verb of the mailing
64
+ # @param [ Hash ] data The data to initialize the mailing with.
65
65
  #
66
66
  # @return [MailControl::LoggedEmail2] An LoggedEmail instance with data
67
67
  def send_email(verb, data)
@@ -72,7 +72,7 @@ module MailControl
72
72
 
73
73
 
74
74
 
75
- # Publishes the queued_task to the receivers
75
+ # Publishes the mailing to the receivers
76
76
  #
77
77
  # @param [ Hash ] options The options to send_email with.
78
78
  #
@@ -1,3 +1,3 @@
1
1
  module MailControl
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.summary = %q{LoggedEmail Streams for rails}
12
12
  s.description = %q{MailControl is a simple gem for giving both your app and users control over when, if and how emails are sent out.}
13
13
  s.homepage = 'https://github.com/digitalplaywright/mail-control'
14
+ s.license = 'MIT'
14
15
 
15
16
  s.rubyforge_project = "mail-control"
16
17
 
@@ -26,7 +26,7 @@ end
26
26
  class LoggedEmail < ActiveRecord::Base
27
27
  include MailControl::LoggedEmail
28
28
 
29
- queued_task :new_enquiry do
29
+ mailing :new_enquiry do
30
30
  actor :User
31
31
  act_object :Article
32
32
  act_target :User
@@ -34,7 +34,7 @@ class LoggedEmail < ActiveRecord::Base
34
34
  unsubscribe_by :option_1
35
35
  end
36
36
 
37
- queued_task :test_description do
37
+ mailing :test_description do
38
38
  actor :User
39
39
  act_object :Article
40
40
  act_target :User
@@ -42,7 +42,7 @@ class LoggedEmail < ActiveRecord::Base
42
42
  unsubscribe_by :option_1
43
43
  end
44
44
 
45
- queued_task :test_option do
45
+ mailing :test_option do
46
46
  actor :User
47
47
  act_object :Article
48
48
  act_target :User
@@ -50,7 +50,7 @@ class LoggedEmail < ActiveRecord::Base
50
50
  unsubscribe_by :option_1
51
51
  end
52
52
 
53
- queued_task :test_bond_type do
53
+ mailing :test_bond_type do
54
54
  actor :User
55
55
  act_object :Article
56
56
  act_target :User
@@ -6,7 +6,7 @@ class LoggedEmailTest < ActiveSupport::TestCase
6
6
 
7
7
  def test_register_definition
8
8
 
9
- @definition = LoggedEmail.queued_task(:test_queued_task) do
9
+ @definition = LoggedEmail.mailing(:test_mailing) do
10
10
  actor :user, :cache => [:full_name]
11
11
  act_object :listing, :cache => [:title, :full_address]
12
12
  act_target :listing, :cache => [:title]
@@ -16,15 +16,15 @@ class LoggedEmailTest < ActiveSupport::TestCase
16
16
 
17
17
  end
18
18
 
19
- def test_publish_new_queued_task
19
+ def test_publish_new_mailing
20
20
  _user = User.create()
21
21
  _article = Article.create()
22
22
  _user_t = User.create()
23
23
 
24
- _queued_task = LoggedEmail.send_email(:new_enquiry, :send_after => Time.now, :send_before => Time.now + 1.hour, :actor => _user, :act_object => _article, :act_target => _user_t )
24
+ _mailing = LoggedEmail.send_email(:new_enquiry, :send_after => Time.now, :send_before => Time.now + 1.hour, :actor => _user, :act_object => _article, :act_target => _user_t )
25
25
 
26
- assert _queued_task.persisted?
27
- #_queued_task.should be_an_instance_of LoggedEmail
26
+ assert _mailing.persisted?
27
+ #_mailing.should be_an_instance_of LoggedEmail
28
28
 
29
29
  end
30
30
 
@@ -34,10 +34,10 @@ class LoggedEmailTest < ActiveSupport::TestCase
34
34
  _user_t = User.create()
35
35
 
36
36
  _description = "this is a test"
37
- _queued_task = LoggedEmail.send_email(:test_description, :send_after => Time.now, :send_before => Time.now + 1.hour, :actor => _user, :act_object => _article, :act_target => _user_t ,
37
+ _mailing = LoggedEmail.send_email(:test_description, :send_after => Time.now, :send_before => Time.now + 1.hour, :actor => _user, :act_object => _article, :act_target => _user_t ,
38
38
  :description => _description )
39
39
 
40
- assert _queued_task.description == _description
40
+ assert _mailing.description == _description
41
41
 
42
42
  end
43
43
 
@@ -47,10 +47,10 @@ class LoggedEmailTest < ActiveSupport::TestCase
47
47
  _user_t = User.create()
48
48
 
49
49
  _country = "denmark"
50
- _queued_task = LoggedEmail.send_email(:test_option, :send_after => Time.now, :send_before => Time.now + 1.hour, :actor => _user, :act_object => _article, :act_target => _user_t ,
50
+ _mailing = LoggedEmail.send_email(:test_option, :send_after => Time.now, :send_before => Time.now + 1.hour, :actor => _user, :act_object => _article, :act_target => _user_t ,
51
51
  :country => _country )
52
52
 
53
- assert _queued_task.options[:country] == _country
53
+ assert _mailing.options[:country] == _country
54
54
 
55
55
  end
56
56
 
@@ -59,9 +59,9 @@ class LoggedEmailTest < ActiveSupport::TestCase
59
59
  _article = Article.create()
60
60
  _user_t = User.create()
61
61
 
62
- _queued_task = LoggedEmail.send_email(:test_bond_type, :send_after => Time.now, :send_before => Time.now + 1.hour, :actor => _user, :act_object => _article, :act_target => _user_t )
62
+ _mailing = LoggedEmail.send_email(:test_bond_type, :send_after => Time.now, :send_before => Time.now + 1.hour, :actor => _user, :act_object => _article, :act_target => _user_t )
63
63
 
64
- assert _queued_task.bond_type == 'global'
64
+ assert _mailing.bond_type == 'global'
65
65
 
66
66
  end
67
67
 
@@ -7,9 +7,9 @@ class ActorTest < ActiveSupport::TestCase
7
7
  _article = Article.create()
8
8
  _user_t = User.create()
9
9
 
10
- queued_task = _user.send_email(:new_enquiry, :send_after => Time.now, :send_before => Time.now + 1.hour, :act_object => _article, :act_target => _user_t )
10
+ mailing = _user.send_email(:new_enquiry, :send_after => Time.now, :send_before => Time.now + 1.hour, :act_object => _article, :act_target => _user_t )
11
11
 
12
- assert queued_task.persisted?
12
+ assert mailing.persisted?
13
13
 
14
14
  end
15
15
 
@@ -26,7 +26,7 @@ class ActorTest < ActiveSupport::TestCase
26
26
  end
27
27
 
28
28
 
29
- def test_retrieves_the_stream_for_a_particular_queued_task_type
29
+ def test_retrieves_the_stream_for_a_particular_mailing_type
30
30
  _user = User.create()
31
31
  _article = Article.create()
32
32
  _user_t = User.create()
@@ -42,9 +42,9 @@ class DefinitionTest < ActiveSupport::TestCase
42
42
 
43
43
  end
44
44
 
45
- def test_raise_exception_if_invalid_queued_task
45
+ def test_raise_exception_if_invalid_mailing
46
46
 
47
- assert_raises(MailControl::InvalidLoggedEmail){ MailControl::Definition.find(:unknown_queued_task) }
47
+ assert_raises(MailControl::InvalidLoggedEmail){ MailControl::Definition.find(:unknown_mailing) }
48
48
 
49
49
  end
50
50
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail-control
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
  - Andreas Saebjoernsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-10 00:00:00.000000000 Z
11
+ date: 2013-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -83,11 +83,11 @@ files:
83
83
  - LICENSE.txt
84
84
  - README.md
85
85
  - Rakefile
86
- - lib/generators/mail-control.rb
87
- - lib/generators/mail-control/activity/activity_generator.rb
88
- - lib/generators/mail-control/activity/templates/logged_email.rb
89
- - lib/generators/mail-control/migration/migration_generator.rb
90
- - lib/generators/mail-control/migration/templates/migration.rb
86
+ - lib/generators/mail_control.rb
87
+ - lib/generators/mail_control/logged_email/activity_generator.rb
88
+ - lib/generators/mail_control/logged_email/templates/logged_email.rb
89
+ - lib/generators/mail_control/migration/migration_generator.rb
90
+ - lib/generators/mail_control/migration/templates/migration.rb
91
91
  - lib/mail-control.rb
92
92
  - lib/mail-control/actor.rb
93
93
  - lib/mail-control/definition.rb
@@ -107,7 +107,8 @@ files:
107
107
  - test/unit/definition_dsl_test.rb
108
108
  - test/unit/definition_test.rb
109
109
  homepage: https://github.com/digitalplaywright/mail-control
110
- licenses: []
110
+ licenses:
111
+ - MIT
111
112
  metadata: {}
112
113
  post_install_message:
113
114
  rdoc_options: []