activenotifier 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +2 -0
- data/VERSION +1 -1
- data/activenotifier.gemspec +5 -3
- data/lib/active_notifier/base.rb +19 -11
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5df65c7bcc1513f0c6cdbe689bd75e49f1c68f0f
|
4
|
+
data.tar.gz: 4e2a856eaeea9a8e09f8f1cfe7ec15a3dec6b925
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7add84224f58a402986ab6a8b1fe70f75641fe70577f477825e288c72ffbedf5e43c7e107f3ff96fc0c5307b82db06befb52d0eabc208fd215d852f8a8311fcf
|
7
|
+
data.tar.gz: a41ca59f634d2e5af9a1878c49ea5eb7ff2bf6e5d3e06be42dbc56994bb362b477829593761231b602858515f0220bb7718432e4e865d98a745805dfb951eb2c
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
|
+
|
6
|
+
## [Unreleased][unreleased]
|
7
|
+
|
8
|
+
## [0.0.2] - 2015-05-11
|
9
|
+
|
10
|
+
### Added
|
11
|
+
- Support for locale
|
12
|
+
|
13
|
+
## [0.0.1] - 2015-05-11
|
14
|
+
|
15
|
+
### Added
|
16
|
+
- Support for push (pushmeup) and email (ActionMailer) notifications
|
17
|
+
|
18
|
+
[unreleased]: https://github.com/Skalar/activenotifier/compare/v0.0.2...HEAD
|
19
|
+
[0.0.2]: https://github.com/Skalar/activenotifier/compare/v0.0.1...v0.0.2
|
20
|
+
[0.0.1]: https://github.com/Skalar/activenotifier/compare/a0352762...v0.0.1
|
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
[![Codeship](https://img.shields.io/codeship/8c098d90-da0a-0132-b325-528f3b81d645.svg?style=plastic)](https://codeship.com/projects/79171)
|
2
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/Skalar/activenotifier.svg?style=plastic)](https://codeclimate.com/github/Skalar/activenotifier)
|
3
|
+
[![Code Climate](https://img.shields.io/codeclimate/coverage/github/Skalar/activenotifier.svg?style=plastic)](https://codeclimate.com/github/Skalar/activenotifier)
|
2
4
|
|
3
5
|
# ActiveNotifier
|
4
6
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/activenotifier.gemspec
CHANGED
@@ -2,23 +2,25 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: activenotifier 0.0.
|
5
|
+
# stub: activenotifier 0.0.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "activenotifier"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.3"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Theodor Tonum"]
|
14
|
-
s.date = "2015-05-
|
14
|
+
s.date = "2015-05-13"
|
15
15
|
s.description = "Simplifies sending notifications to your end users through multiple channels"
|
16
16
|
s.email = "tt@skalar.no"
|
17
17
|
s.extra_rdoc_files = [
|
18
|
+
"CHANGELOG.md",
|
18
19
|
"LICENSE.txt",
|
19
20
|
"README.md"
|
20
21
|
]
|
21
22
|
s.files = [
|
23
|
+
"CHANGELOG.md",
|
22
24
|
"Gemfile",
|
23
25
|
"Gemfile.lock",
|
24
26
|
"Guardfile",
|
data/lib/active_notifier/base.rb
CHANGED
@@ -12,22 +12,24 @@ module ActiveNotifier
|
|
12
12
|
|
13
13
|
def deliver_now
|
14
14
|
delivered = false
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
15
|
+
locale = self.class.locale_for(recipient)
|
16
|
+
I18n.with_locale(locale) do
|
17
|
+
until channels.empty? || delivered
|
18
|
+
channel = channels.shift
|
19
|
+
begin
|
20
|
+
deliverable(channel).deliver_now
|
21
|
+
delivered = true
|
22
|
+
rescue ActiveNotifier::DeliveryImpossible => e
|
23
|
+
delivered = false
|
24
|
+
msg = "Unable to deliver to channel #{channel}: #{e.message}"
|
25
|
+
ActiveNotifier.logger && ActiveNotifier.logger.warn(msg)
|
26
|
+
end
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
29
31
|
class << self
|
30
|
-
attr_accessor :configurations
|
32
|
+
attr_accessor :configurations, :locale_attribute
|
31
33
|
|
32
34
|
def deliver_now(attributes)
|
33
35
|
new(attributes).deliver_now
|
@@ -38,6 +40,12 @@ module ActiveNotifier
|
|
38
40
|
config = Configuration.new.tap(&blk)
|
39
41
|
configurations[channel] = config
|
40
42
|
end
|
43
|
+
|
44
|
+
def locale_for(recipient)
|
45
|
+
recipient.public_send(locale_attribute)
|
46
|
+
rescue
|
47
|
+
I18n.default_locale
|
48
|
+
end
|
41
49
|
end
|
42
50
|
|
43
51
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activenotifier
|
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
|
- Theodor Tonum
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -197,9 +197,11 @@ email: tt@skalar.no
|
|
197
197
|
executables: []
|
198
198
|
extensions: []
|
199
199
|
extra_rdoc_files:
|
200
|
+
- CHANGELOG.md
|
200
201
|
- LICENSE.txt
|
201
202
|
- README.md
|
202
203
|
files:
|
204
|
+
- CHANGELOG.md
|
203
205
|
- Gemfile
|
204
206
|
- Gemfile.lock
|
205
207
|
- Guardfile
|