mailboxer 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +92 -9
- data/mailboxer.gemspec +1 -1
- metadata +21 -23
data/README.textile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
h1. Mailboxer 0.5.x "!https://secure.travis-ci.org/ging/mailboxer.png!":http://travis-ci.org/ging/mailboxer
|
1
|
+
h1. Mailboxer 0.5.x "!https://secure.travis-ci.org/ging/mailboxer.png!":http://travis-ci.org/ging/mailboxer "!https://gemnasium.com/ging/mailboxer.png!":https://gemnasium.com/ging/mailboxer
|
2
2
|
|
3
3
|
This project is based on the need of a private message system for "ging / social_stream":https://github.com/ging/social_stream. Instead of creating our core message system heavily dependent on our development we are trying to implement a generic and potent messaging gem.
|
4
4
|
|
@@ -29,14 +29,32 @@ And don't forget to migrate you database:
|
|
29
29
|
rake db:migrate
|
30
30
|
</code></pre>
|
31
31
|
|
32
|
-
h2. Requirements
|
32
|
+
h2. Requirements & Settings
|
33
33
|
|
34
|
-
|
34
|
+
h3. Emails
|
35
|
+
|
36
|
+
We are now adding support for sending emails when a Notification or a Message is sent to one o more recipients. You should modify mailboxer initializer (/config/initializer/mailboxer.rb) to edit this settings.
|
37
|
+
<pre><code>
|
38
|
+
Mailboxer.setup do |config|
|
39
|
+
...
|
40
|
+
#Configures if you applications uses or no the email sending for Notifications and Messages
|
41
|
+
config.uses_emails = true
|
42
|
+
#Configures the default from for the email sent for Messages and Notifications of Mailboxer
|
43
|
+
config.default_from = "no-reply@dit.upm.es"
|
44
|
+
...
|
45
|
+
end
|
46
|
+
</code></pre>
|
47
|
+
|
48
|
+
h3. User identities
|
49
|
+
|
50
|
+
Users must have an identity defined by a @name@ and an @email@. So that, we must assure that Messageable models have some specific methods. These methods are:
|
35
51
|
<pre><code>
|
36
52
|
#Returning any kind of identification you want for the model
|
37
53
|
def name
|
38
54
|
return "You should add method :name in your Messageable model"
|
39
55
|
end
|
56
|
+
</code></pre>
|
57
|
+
<pre><code>
|
40
58
|
#Returning the email address of the model if an email should be sent for this object (Message or Notification).
|
41
59
|
#If no mail has to be sent, return nil.
|
42
60
|
def mailboxer_email(object)
|
@@ -47,16 +65,25 @@ We are now adding support for sending emails when a Notification or a Message is
|
|
47
65
|
#return nil
|
48
66
|
end
|
49
67
|
</code></pre>
|
50
|
-
These names are explicit enough to avoid colliding with other methods, but as long as you need to change them you can do it by using mailboxer initializer. Just add or uncomment the following lines:
|
68
|
+
These names are explicit enough to avoid colliding with other methods, but as long as you need to change them you can do it by using mailboxer initializer (/config/initializer/mailboxer.rb). Just add or uncomment the following lines:
|
51
69
|
<pre><code>
|
70
|
+
Mailboxer.setup do |config|
|
71
|
+
...
|
52
72
|
#Configures the methods needed by mailboxer
|
53
73
|
config.email_method = :mailboxer_email
|
54
74
|
config.name_method = :name
|
75
|
+
...
|
76
|
+
end
|
55
77
|
</code></pre>
|
56
78
|
You may change whatever you want or need. For example:
|
57
79
|
<pre><code>
|
58
|
-
|
59
|
-
|
80
|
+
Mailboxer.setup do |config|
|
81
|
+
...
|
82
|
+
#Configures the methods needed by mailboxer
|
83
|
+
config.email_method = :notifications_email #instead of :mailboxer_email
|
84
|
+
config.name_method = :display_name #instead of :display_name
|
85
|
+
...
|
86
|
+
end
|
60
87
|
</code></pre>
|
61
88
|
Will use the method @notification_email(object)@ instead of @mailboxer_email(object)@ and @display_name@ for @name@
|
62
89
|
|
@@ -82,13 +109,69 @@ You are not limited to User model. You can use Mailboxer in any other model and
|
|
82
109
|
end
|
83
110
|
</code></pre>
|
84
111
|
|
85
|
-
h2.
|
112
|
+
h2. Mailboxer API
|
113
|
+
|
114
|
+
h3. How can I send a message?
|
115
|
+
|
116
|
+
<pre><code>
|
117
|
+
#alfa wants to send a message to beta
|
118
|
+
alfa.send_message(beta, "Body", "subject")
|
119
|
+
</code></pre>
|
120
|
+
|
121
|
+
h3. How can I reply a message?
|
122
|
+
|
123
|
+
<pre><code>
|
124
|
+
#alfa wants to reply to all in a conversation
|
125
|
+
#using a receipt
|
126
|
+
alfa.reply_to_all(receipt, "Reply body")
|
127
|
+
#using a conversation
|
128
|
+
alfa.reply_to_conversation(conversation, "Reply body")
|
129
|
+
</code></pre>
|
130
|
+
<pre><code>
|
131
|
+
#alfa wants to reply to the sender of a message (and ONLY the sender)
|
132
|
+
#using a receipt
|
133
|
+
alfa.reply_to_sender(receipt, "Reply body")
|
134
|
+
</code></pre>
|
135
|
+
|
136
|
+
h3. How can I retrieve my conversations?
|
137
|
+
|
138
|
+
<pre><code>
|
139
|
+
#alfa wants to retrieve all his conversations
|
140
|
+
alfa.mailbox.conversations
|
141
|
+
#A wants to retrieve his inbox
|
142
|
+
alfa.mailbox.inbox
|
143
|
+
#A wants to retrieve his sent conversations
|
144
|
+
alfa.mailbox.sentbox
|
145
|
+
#alfa wants to retrieve his trashed conversations
|
146
|
+
alfa.mailbox.trash
|
147
|
+
</code></pre>
|
148
|
+
|
149
|
+
h3. How can I read the messages of a conversation?
|
150
|
+
|
151
|
+
As a messageable, what you receive receipts wich are linked with the message itself. You should retrieve your receipts for the conversation a get the message associated to them.
|
152
|
+
|
153
|
+
This is done this way because receipts save the information about the relation between messageable and the messages: is it read?, is it trashed?, etc.
|
154
|
+
<pre><code>
|
155
|
+
#alfa gets the last conversation (chronologically, the first in the inbox)
|
156
|
+
conversation = alfa.mailbox.inbox.first
|
157
|
+
#alfa gets it receipts chronologically ordered.
|
158
|
+
receipts = conversation.receipts_for alfa
|
159
|
+
#using the receipts (i.e. in the view)
|
160
|
+
receipts.each do |receipt|
|
161
|
+
...
|
162
|
+
message = receipt.message
|
163
|
+
read = receipt.is_unread? #or message.is_unread?(alfa)
|
164
|
+
...
|
165
|
+
end
|
166
|
+
</code></pre>
|
167
|
+
|
168
|
+
h3. Any other thing ...
|
86
169
|
|
87
|
-
|
170
|
+
You can take a look at the full documentation of Mailboxer in "rubydoc.info":http://rubydoc.info/gems/mailboxer/frames.
|
88
171
|
|
89
172
|
h2. License
|
90
173
|
|
91
|
-
Copyright (c)
|
174
|
+
Copyright (c) 2012 Eduardo Casanova Cuesta
|
92
175
|
|
93
176
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
94
177
|
|
data/mailboxer.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "mailboxer"
|
3
|
-
s.version = "0.5.
|
3
|
+
s.version = "0.5.5"
|
4
4
|
s.authors = ["Eduardo Casanova Cuesta"]
|
5
5
|
s.summary = "Messaging system for rails apps."
|
6
6
|
s.description = "A Rails engine that allows any model to act as messageable, allowing it to exchange messages " +
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailboxer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 5
|
10
|
+
version: 0.5.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Eduardo Casanova Cuesta
|
@@ -15,11 +15,10 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
18
|
+
date: 2012-01-19 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
21
|
+
type: :runtime
|
23
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
23
|
none: false
|
25
24
|
requirements:
|
@@ -31,11 +30,11 @@ dependencies:
|
|
31
30
|
- 9
|
32
31
|
- 1
|
33
32
|
version: 0.9.1
|
34
|
-
|
33
|
+
prerelease: false
|
35
34
|
name: foreigner
|
36
35
|
version_requirements: *id001
|
37
36
|
- !ruby/object:Gem::Dependency
|
38
|
-
|
37
|
+
type: :runtime
|
39
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
40
|
requirements:
|
@@ -47,11 +46,11 @@ dependencies:
|
|
47
46
|
- 1
|
48
47
|
- 0
|
49
48
|
version: 3.1.0
|
50
|
-
|
49
|
+
prerelease: false
|
51
50
|
name: rails
|
52
51
|
version_requirements: *id002
|
53
52
|
- !ruby/object:Gem::Dependency
|
54
|
-
|
53
|
+
type: :development
|
55
54
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
55
|
none: false
|
57
56
|
requirements:
|
@@ -61,11 +60,11 @@ dependencies:
|
|
61
60
|
segments:
|
62
61
|
- 0
|
63
62
|
version: "0"
|
64
|
-
|
63
|
+
prerelease: false
|
65
64
|
name: sqlite3-ruby
|
66
65
|
version_requirements: *id003
|
67
66
|
- !ruby/object:Gem::Dependency
|
68
|
-
|
67
|
+
type: :development
|
69
68
|
requirement: &id004 !ruby/object:Gem::Requirement
|
70
69
|
none: false
|
71
70
|
requirements:
|
@@ -77,11 +76,11 @@ dependencies:
|
|
77
76
|
- 10
|
78
77
|
- 3
|
79
78
|
version: 0.10.3
|
80
|
-
|
79
|
+
prerelease: false
|
81
80
|
name: ruby-debug
|
82
81
|
version_requirements: *id004
|
83
82
|
- !ruby/object:Gem::Dependency
|
84
|
-
|
83
|
+
type: :development
|
85
84
|
requirement: &id005 !ruby/object:Gem::Requirement
|
86
85
|
none: false
|
87
86
|
requirements:
|
@@ -93,11 +92,11 @@ dependencies:
|
|
93
92
|
- 6
|
94
93
|
- 1
|
95
94
|
version: 2.6.1
|
96
|
-
|
95
|
+
prerelease: false
|
97
96
|
name: rspec-rails
|
98
97
|
version_requirements: *id005
|
99
98
|
- !ruby/object:Gem::Dependency
|
100
|
-
|
99
|
+
type: :development
|
101
100
|
requirement: &id006 !ruby/object:Gem::Requirement
|
102
101
|
none: false
|
103
102
|
requirements:
|
@@ -109,11 +108,11 @@ dependencies:
|
|
109
108
|
- 3
|
110
109
|
- 2
|
111
110
|
version: 1.3.2
|
112
|
-
|
111
|
+
prerelease: false
|
113
112
|
name: factory_girl
|
114
113
|
version_requirements: *id006
|
115
114
|
- !ruby/object:Gem::Dependency
|
116
|
-
|
115
|
+
type: :development
|
117
116
|
requirement: &id007 !ruby/object:Gem::Requirement
|
118
117
|
none: false
|
119
118
|
requirements:
|
@@ -125,11 +124,11 @@ dependencies:
|
|
125
124
|
- 3
|
126
125
|
- 6
|
127
126
|
version: 0.3.6
|
128
|
-
|
127
|
+
prerelease: false
|
129
128
|
name: forgery
|
130
129
|
version_requirements: *id007
|
131
130
|
- !ruby/object:Gem::Dependency
|
132
|
-
|
131
|
+
type: :development
|
133
132
|
requirement: &id008 !ruby/object:Gem::Requirement
|
134
133
|
none: false
|
135
134
|
requirements:
|
@@ -141,7 +140,7 @@ dependencies:
|
|
141
140
|
- 3
|
142
141
|
- 9
|
143
142
|
version: 0.3.9
|
144
|
-
|
143
|
+
prerelease: false
|
145
144
|
name: capybara
|
146
145
|
version_requirements: *id008
|
147
146
|
description: A Rails engine that allows any model to act as messageable, allowing it to exchange messages with any other messageable model, even different ones. It supports the use of conversations with two or more recipients to organize the messages. You have a complete use of a mailbox object for each messageable model that manages an inbox, sentbox and trash for conversations. It also supports sending notifications to messageable models, intended to be used as system notifications.
|
@@ -244,7 +243,6 @@ files:
|
|
244
243
|
- spec/models/notification_spec.rb
|
245
244
|
- spec/models/receipt_spec.rb
|
246
245
|
- spec/spec_helper.rb
|
247
|
-
has_rdoc: true
|
248
246
|
homepage: https://github.com/ging/mailboxer
|
249
247
|
licenses: []
|
250
248
|
|
@@ -274,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
272
|
requirements: []
|
275
273
|
|
276
274
|
rubyforge_project:
|
277
|
-
rubygems_version: 1.
|
275
|
+
rubygems_version: 1.8.10
|
278
276
|
signing_key:
|
279
277
|
specification_version: 3
|
280
278
|
summary: Messaging system for rails apps.
|