hey-you 1.2.0 → 1.2.1
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/.travis.yml +0 -2
- data/CHANGELOG.md +5 -1
- data/README.md +4 -4
- data/hey_you.gemspec +1 -1
- data/lib/hey_you/builder.rb +10 -1
- data/lib/hey_you/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a7b3080ba368db5d653caccc37a984f7700292a54ba90204c086bdd7b95b4b6d
|
|
4
|
+
data.tar.gz: c2f589b517e59fdda778d6b9f99074a7c2fc932bbf97052a395f1b3491260d74
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3799695ed32d46f2aa0005346aa37d3b2288a373391900dedb575f90e5d71db4272d1d73edf3b5d5754066600bff886bc5e845271329bfead1dcc4f0208b3523
|
|
7
|
+
data.tar.gz: 29421836627cf3ba25e6731bca4e84830bef3f450ab5d400c85f7b80ef5a63b28c0492621e1edecb69ab2ae3506b1d178a88203ac34dec9a85a47d5171f0083a
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# Changelog for hey-you gem
|
|
2
2
|
|
|
3
|
+
### 1.2.1
|
|
4
|
+
- Improvement: Builder will not make channel builder if it skipped by only option
|
|
5
|
+
|
|
3
6
|
### 1.2.0
|
|
4
|
-
- Feature: data source extensions (check readme for more information)
|
|
7
|
+
- Feature: data source extensions (check readme for more information).
|
|
8
|
+
__Attention__: You should rewrite your configuration for use yaml data source!
|
data/README.md
CHANGED
|
@@ -20,7 +20,7 @@ him easy.
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
## Requirements
|
|
23
|
-
* Ruby 2.
|
|
23
|
+
* Ruby 2.5.0 min (rspec works with ruby 2.5.0, 2.6.0, 2.7.0)
|
|
24
24
|
* FCM - Gem send push notification using [fcm gem](https://github.com/spacialdb/fcm).
|
|
25
25
|
You need *fcm server key* to successful configure push notifications.
|
|
26
26
|
|
|
@@ -52,10 +52,12 @@ First, you must configure HeyYou. Example:
|
|
|
52
52
|
#### Required settings
|
|
53
53
|
Options for gem base work.
|
|
54
54
|
##### Data Source
|
|
55
|
-
* __config.data_source.source_class__ - Class implemented instance method `load_collections` returning hash (by default HeyYou::DataSource::Yaml)
|
|
55
|
+
* __config.data_source.source_class__ - Class implemented instance method `load_collections` returning hash (by default `HeyYou::DataSource::Yaml`)
|
|
56
56
|
* __config.data_source.options__ - Arguments for source_class. This options will be passed to init `source_class`
|
|
57
57
|
OR
|
|
58
58
|
* __config.data_source.source_instance__ - Instance of source class implemented `load_collections`
|
|
59
|
+
|
|
60
|
+
Read more about data source in [data source](#data-source-1).d
|
|
59
61
|
##### Push
|
|
60
62
|
* __config.push.fcm_token__ - Required setting for push channel. You can not send
|
|
61
63
|
push messages if setting was not set. You should set it to equal your fcm server key.
|
|
@@ -65,8 +67,6 @@ push messages if setting was not set. You should set it to equal your fcm server
|
|
|
65
67
|
#### Optional settings
|
|
66
68
|
Additional options for configure your notifications.
|
|
67
69
|
#### Base
|
|
68
|
-
* __config.env_collection_file__ - File contained all your notifications texts for
|
|
69
|
-
environment. You can set it like `notifications.#{ENV['APP_ENV]}.yml`
|
|
70
70
|
* __config.splitter__ - Chars for split notification keys for
|
|
71
71
|
builder. Default: `.`
|
|
72
72
|
* __config.registered_channels__ - Avialable channels for your
|
data/hey_you.gemspec
CHANGED
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
|
26
26
|
spec.add_runtime_dependency "mail", '~> 2.7'
|
|
27
27
|
spec.add_runtime_dependency "i18n", '~> 1.0'
|
|
28
28
|
|
|
29
|
-
spec.add_development_dependency "rake", '~>
|
|
29
|
+
spec.add_development_dependency "rake", '~> 13.0'
|
|
30
30
|
spec.add_development_dependency "rspec", '~> 3.7'
|
|
31
31
|
spec.add_development_dependency "webmock", '~> 3.4'
|
|
32
32
|
spec.add_development_dependency "ffaker", '~> 2.9'
|
data/lib/hey_you/builder.rb
CHANGED
|
@@ -13,11 +13,14 @@ module HeyYou
|
|
|
13
13
|
# Define methods for each registered channel. After initialize you can use
|
|
14
14
|
# `instance.<ch_name>`. It will be return instance of HeyYou::Builder::<YOUR_CHANNEL_NAME>
|
|
15
15
|
#
|
|
16
|
+
# Skip builder for excluded channels (not included in `only` option)
|
|
17
|
+
#
|
|
18
|
+
# @param [String] key - notification key for fetching notification data from collection
|
|
16
19
|
def initialize(key, **options)
|
|
17
20
|
@data = fetch_from_collection_by_key(key, options[:locale])
|
|
18
21
|
@options = options
|
|
19
22
|
config.registered_channels.each do |ch|
|
|
20
|
-
init_channel_builder(ch, key)
|
|
23
|
+
init_channel_builder(ch, key) if channel_allowed_by_only?(ch, options[:only])
|
|
21
24
|
end
|
|
22
25
|
end
|
|
23
26
|
|
|
@@ -61,6 +64,12 @@ module HeyYou
|
|
|
61
64
|
raise DataNotFound, "collection data not found for `#{keys.join(config.splitter)}`"
|
|
62
65
|
end
|
|
63
66
|
|
|
67
|
+
def channel_allowed_by_only?(ch, only)
|
|
68
|
+
return true unless only
|
|
69
|
+
return only.map(&:to_sym).include?(ch.to_sym) if only.is_a?(Array)
|
|
70
|
+
only.to_sym == ch.to_sym
|
|
71
|
+
end
|
|
72
|
+
|
|
64
73
|
class UnknownLocale < StandardError; end
|
|
65
74
|
class DataNotFound < StandardError; end
|
|
66
75
|
class RequiredChannelNotFound < StandardError; end
|
data/lib/hey_you/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hey-you
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sergey Nesterov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-07-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: fcm
|
|
@@ -58,14 +58,14 @@ dependencies:
|
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
61
|
+
version: '13.0'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
68
|
+
version: '13.0'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: rspec
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
166
166
|
- !ruby/object:Gem::Version
|
|
167
167
|
version: '0'
|
|
168
168
|
requirements: []
|
|
169
|
-
rubygems_version: 3.0.
|
|
169
|
+
rubygems_version: 3.0.8
|
|
170
170
|
signing_key:
|
|
171
171
|
specification_version: 4
|
|
172
172
|
summary: Send multichannel notification with one command.
|