short_message 1.0.2 → 1.1.0
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: 9590f6c08f0ffbfc791be4d7c3004d8e7a796736
|
4
|
+
data.tar.gz: 2f3d4f988d1ee22ea52171585897fe72eeead03f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6aae932d5db425590da78981d0ca6fa0c10dfb24cf7075358a93be4e161ded5b08aa7b77308c650c47cc44ab1b9194b65e80ac573d8f4320a838f1fc312274a2
|
7
|
+
data.tar.gz: 6f7705d081d0ec82146ebb419b0a8cf48ba7a1edfec8107f6f525f35ca4d8f404d8aa5e44e0665afc67d0b87cc980c0885657aada62be8cc9e088c2d17e2a4af
|
data/README.md
CHANGED
@@ -37,6 +37,10 @@ Create a message and deliver it:
|
|
37
37
|
@sms.deliver
|
38
38
|
```
|
39
39
|
|
40
|
+
## Delivery Report
|
41
|
+
|
42
|
+
ShortMessage listens for status updates on `/short_message/messages/status`. Provide `:id` and `:status` by either `POST` or `GET`.
|
43
|
+
|
40
44
|
## Customization
|
41
45
|
|
42
46
|
### Status Codes
|
@@ -59,3 +63,13 @@ ShortMessage::Message.module_eval do
|
|
59
63
|
end
|
60
64
|
end
|
61
65
|
```
|
66
|
+
|
67
|
+
### Events
|
68
|
+
|
69
|
+
ShortMessage sends event notifications on message delivery `short_message.delivered` and on status update `short_message.status_updated`. Add following code to an initializer to listen:
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
ActiveSupport::Notifications.subscribe('short_message.status_updated') do |name, start, finish, id, payload|
|
73
|
+
Activity.create(successful: true, message: "Message #{payload[:options][:key]} has now status #{payload[:options][:status]}.")
|
74
|
+
end
|
75
|
+
```
|
@@ -8,6 +8,7 @@ module ShortMessage
|
|
8
8
|
message.status_code = params[:status]
|
9
9
|
message.save!
|
10
10
|
|
11
|
+
ActiveSupport::Notifications.instrument('short_message.status_updated', options: { key: params[:id], status: params[:status] })
|
11
12
|
message = "Message #{params[:id]} has now status #{params[:status]}"
|
12
13
|
else
|
13
14
|
message = "Message #{params[:id]} not found!"
|
@@ -20,6 +20,7 @@ module ShortMessage
|
|
20
20
|
end
|
21
21
|
|
22
22
|
self.message_key = result_set[2] unless result_set[2].blank?
|
23
|
+
ActiveSupport::Notifications.instrument('short_message.delivered', options: { key: (result_set[2] unless result_set[2].blank?) })
|
23
24
|
return self.save
|
24
25
|
else
|
25
26
|
ShortMessage::Mailer.error_notification(self, response).deliver_now unless ShortMessage.config.admin_notification_email.blank?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: short_message
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andi Saurer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -95,7 +95,6 @@ files:
|
|
95
95
|
- test/dummy/config/locales/en.yml
|
96
96
|
- test/dummy/config/routes.rb
|
97
97
|
- test/dummy/config/secrets.yml
|
98
|
-
- test/dummy/log/development.log
|
99
98
|
- test/dummy/public/404.html
|
100
99
|
- test/dummy/public/422.html
|
101
100
|
- test/dummy/public/500.html
|
@@ -156,7 +155,6 @@ test_files:
|
|
156
155
|
- test/dummy/config/routes.rb
|
157
156
|
- test/dummy/config/secrets.yml
|
158
157
|
- test/dummy/config.ru
|
159
|
-
- test/dummy/log/development.log
|
160
158
|
- test/dummy/public/404.html
|
161
159
|
- test/dummy/public/422.html
|
162
160
|
- test/dummy/public/500.html
|
File without changes
|