crier 0.0.2 → 0.0.3
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/README.md +2 -1
- data/lib/crier/acts_as_crier.rb +4 -3
- data/lib/crier/notification.rb +2 -1
- data/lib/crier/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27e6a18b24465a506d84988fcf4e5ed08e022f49
|
4
|
+
data.tar.gz: 86862907b749a151bf9728f9a050a67dafc4d7d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b2422f2101458a985a143e293870f1cdcacd352b4678a4292a6d926e6cd01c1afe3a87069ba0667b0d26629480e9f5c11489da4574e1a487b5a6418d098e071
|
7
|
+
data.tar.gz: 2b96e0d6230fa9f1929ff5a2ed5c417f28c31b41be39364d13d351775146ca67bc6e025b1f630b724534c851a4b8d1f05399983cd7a74fb50a9b88c67f39822f
|
data/README.md
CHANGED
@@ -59,7 +59,8 @@ someuser.cry("Lend me your ears").to_others(@other_users) # Shout only t
|
|
59
59
|
### Listening
|
60
60
|
|
61
61
|
```ruby
|
62
|
+
Crier::Notification.by(some_user) # Get all the notifications by a particular user
|
62
63
|
Crier::Notification.heard_by(some_user) # Get all the notifications the user heard
|
63
64
|
Crier::Notification.about(@record) # Get all the notifications with the given subject
|
64
65
|
Crier::Notification.in_scope(:my_town) # Get all the notifications within the given scope
|
65
|
-
```
|
66
|
+
```
|
data/lib/crier/acts_as_crier.rb
CHANGED
@@ -6,7 +6,7 @@ module Crier
|
|
6
6
|
|
7
7
|
extend Crier::ClassMethods
|
8
8
|
include Crier::InstanceMethods
|
9
|
-
end
|
9
|
+
end
|
10
10
|
end
|
11
11
|
|
12
12
|
module ClassMethods
|
@@ -14,14 +14,15 @@ module Crier
|
|
14
14
|
|
15
15
|
module InstanceMethods
|
16
16
|
def cry(message, metadata = {}, audience = nil)
|
17
|
+
metadata.symbolize_keys!
|
17
18
|
Notification.create! do |n|
|
18
19
|
n.message = message
|
19
20
|
n.crier = metadata.delete(:crier) || self
|
20
21
|
n.subject = metadata.delete(:subject) || self
|
21
22
|
n.action = metadata.delete(:action)
|
23
|
+
n.scope = metadata.delete(:scope) || Crier::HelperMethods.scope_for(n.subject)
|
22
24
|
n.metadata = metadata
|
23
25
|
n.audience = Array(audience)
|
24
|
-
n.scope = Crier::HelperMethods.scope_for(n.subject)
|
25
26
|
n.private = true if audience
|
26
27
|
end
|
27
28
|
end
|
@@ -32,4 +33,4 @@ module Crier
|
|
32
33
|
"#{record.class.name}##{record.id}"
|
33
34
|
end
|
34
35
|
end
|
35
|
-
end
|
36
|
+
end
|
data/lib/crier/notification.rb
CHANGED
@@ -10,6 +10,7 @@ module Crier
|
|
10
10
|
|
11
11
|
store :metadata
|
12
12
|
|
13
|
+
scope :by, lambda {|user| where(:crier_id => user) }
|
13
14
|
scope :heard_by, lambda {|user| joins("LEFT OUTER JOIN #{Listening.table_name} ON #{Listening.table_name}.notification_id = #{table_name}.id").where("#{Listening.table_name}.user_id = #{user.id} OR NOT private")}
|
14
15
|
scope :about, lambda {|subject| where(:subject_id => subject.id, :subject_type => subject.class) }
|
15
16
|
scope :in_scope, lambda {|scope| where(:scope => scope) }
|
@@ -26,4 +27,4 @@ module Crier
|
|
26
27
|
to(Array(audience) - [crier])
|
27
28
|
end
|
28
29
|
end
|
29
|
-
end
|
30
|
+
end
|
data/lib/crier/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Wallace
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: '3.2'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 4.
|
23
|
+
version: 4.2.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
version: '3.2'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 4.
|
33
|
+
version: 4.2.0
|
34
34
|
description: Simple notification for the whole town
|
35
35
|
email:
|
36
36
|
- contact@culturecode.ca
|
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 2.2.
|
67
|
+
rubygems_version: 2.2.2
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: Simple notification for the whole town
|