wor-push-notifications-aws 0.1.1 → 0.1.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3aed8f38a01364430d92a20a147a62d40d605882
|
4
|
+
data.tar.gz: 6cfc3f08dec5d5cecc6e0459901fd3519b5f84d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b354e3fe8d72aed6dc0bfed248b0507d7d9c38ccae5c4fdd39f187b97324c21108c8218c1b92491aa8daf64b75a5655b5dd1a3eac3b7cf3a8cf4fe2c1f84d3c8
|
7
|
+
data.tar.gz: eb2e65945a6b76d8b0ab703c72618005838ad3257f64dc849040699d910bd1620a624e0027d50e0cee8851940c1e9710a438d59fe06471f8a69529b160a993bf
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Change log
|
2
|
+
|
3
|
+
[0.1.2] - 2017-08-04
|
4
|
+
|
5
|
+
- Adds validations for the `message_content`
|
6
|
+
- Accepts `message_content` with Strings or Symbols as keys
|
7
|
+
|
8
|
+
[0.1.1]
|
9
|
+
|
10
|
+
- Fixes SNS::Client location
|
11
|
+
|
12
|
+
[0.1.0]
|
13
|
+
|
14
|
+
- wor-push-notifications-aws gem first release.
|
@@ -31,8 +31,10 @@ module Wor
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def send_message(user, message_content)
|
34
|
-
PushNotificationsValidator.new(user).
|
35
|
-
message_content =
|
34
|
+
PushNotificationsValidator.new(user).validate_model
|
35
|
+
message_content = PushNotificationsValidator.validate_message_content(
|
36
|
+
message_content
|
37
|
+
)
|
36
38
|
send_notifications_to_user(user, message_content)
|
37
39
|
end
|
38
40
|
|
@@ -83,11 +85,6 @@ module Wor
|
|
83
85
|
}
|
84
86
|
}
|
85
87
|
end
|
86
|
-
|
87
|
-
def badge_check(message_content)
|
88
|
-
message_content[:badge] = 1 if message_content[:badge].nil?
|
89
|
-
message_content
|
90
|
-
end
|
91
88
|
end
|
92
89
|
end
|
93
90
|
end
|
@@ -20,10 +20,33 @@ module Wor
|
|
20
20
|
validate_existence_of_attributes_in_model
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def validate_model
|
24
24
|
validate_model_existance
|
25
25
|
validate_existence_of_attributes_in_model
|
26
|
-
|
26
|
+
end
|
27
|
+
|
28
|
+
class << self
|
29
|
+
def validate_message_content(message_content)
|
30
|
+
raise ArgumentError, message_content_type_error unless message_content.is_a?(Hash)
|
31
|
+
message_content = message_content.with_indifferent_access
|
32
|
+
raise ArgumentError, message_content_error if message_content[:message].blank?
|
33
|
+
badge_check(message_content)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def message_content_error
|
39
|
+
"the message_content must have a 'message' field"
|
40
|
+
end
|
41
|
+
|
42
|
+
def message_content_type_error
|
43
|
+
'message_content must be a Hash'
|
44
|
+
end
|
45
|
+
|
46
|
+
def badge_check(message_content)
|
47
|
+
message_content[:badge] ||= 1
|
48
|
+
message_content
|
49
|
+
end
|
27
50
|
end
|
28
51
|
|
29
52
|
private
|
@@ -38,10 +61,6 @@ module Wor
|
|
38
61
|
message_for_missing_attribute_in_model
|
39
62
|
end
|
40
63
|
|
41
|
-
def validate_message_content(message_content)
|
42
|
-
raise ArgumentError, message_content_error_message if message_content[:message].blank?
|
43
|
-
end
|
44
|
-
|
45
64
|
def validate_parameters
|
46
65
|
raise ArgumentError, message_for_invalid_device_type unless device_type_valid?
|
47
66
|
raise ArgumentError, message_for_nil_device_token if @device_token.blank?
|
@@ -64,10 +83,6 @@ module Wor
|
|
64
83
|
'your entity instance cannot be nil.'
|
65
84
|
end
|
66
85
|
|
67
|
-
def message_content_error_message
|
68
|
-
"the message_content must have a 'message' field"
|
69
|
-
end
|
70
|
-
|
71
86
|
def device_type_valid?
|
72
87
|
Wor::Push::Notifications::Aws.device_types.include? @device_type
|
73
88
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wor-push-notifications-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Masello
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-08-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- ".rspec"
|
60
60
|
- ".rubocop.yml"
|
61
61
|
- ".travis.yml"
|
62
|
+
- CHANGELOG.md
|
62
63
|
- Gemfile
|
63
64
|
- LICENSE.txt
|
64
65
|
- README.md
|