jera_push 1.2.3 → 1.2.4

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
  SHA256:
3
- metadata.gz: 94afb52f8fb32e6554bdb73f7b03ba48a1ea0cc57cd1789df19f914593739b45
4
- data.tar.gz: 7586cb6aebe1df7119a2bd9a87ec1cb9de37ac8343c8488477cc5cc99dfc234c
3
+ metadata.gz: e6f63d90cf49a65d29029d1c6597afb8e813537a7b60ed9b045a885eb1799f81
4
+ data.tar.gz: 57af32466be12fbc0828920abc1f556b9351452f491e4981cf54a93a1dda060e
5
5
  SHA512:
6
- metadata.gz: 9d917503e6bc9904fab6e3c309856491f2c1230baa7b8cd8e946c9560c9aa938a0be3fc40dbb9e9329869cad622cbf49bf9e88701204b383a94f11e871f7858b
7
- data.tar.gz: b2147d84acdead00ff1351f65e5da1e2ff1061c397b5a754a870f4c112f7bb9c84b57849653fd8bef7adadb0d9207a070755f91a35ad1e1942ea3311114273b0
6
+ metadata.gz: 7bfd9f73d69b6650e536549022c378eb34404ff494ff71d718974af27236f3b0cfe56107c130b6149485398675b86b47cc02815e3a0cb487691c86ca0d99b2b9
7
+ data.tar.gz: 7c6c7e81a5efb2eff4de42167b54d55953d8ac8522e0a74628146b911c6a5cb2de2dbe38df5e13b03d182a7b2df8ada0874c55f89cb8389259f8b8180bc8119a
@@ -28,7 +28,7 @@ module JeraPush
28
28
  end
29
29
 
30
30
  def create
31
- push_message = JeraPush::Service::SendMessage.new(params).call
31
+ push_message = JeraPush::Service::SendMessage.new(message_params).call
32
32
 
33
33
  if push_message
34
34
  flash[:notice] = t('jera_push.admin.messages.new.toast.success')
@@ -48,6 +48,10 @@ module JeraPush
48
48
  @message_devices = JeraPush::MessageDevice.includes(:device).where('message_id = :id and device_id in (:device_ids)', id: params[:id], device_ids: @devices.pluck(:id))
49
49
  end
50
50
 
51
+ def message_params
52
+ params.permit(:type, devices: [], message: [:key, :value])
53
+ end
54
+
51
55
  def device_filter_params
52
56
  params.permit(:value, :field, :resource_name, platform: []).merge({ message_id: params[:id] })
53
57
  end
@@ -3,15 +3,16 @@ module JeraPush
3
3
  class SendMessage
4
4
 
5
5
  def initialize(*args)
6
- args[0].map { |attr_name, value| instance_variable_set("@#{attr_name}", value) }
6
+ @type = args.first[:type].to_sym
7
+ @message = args.first[:message]
8
+ @devices = args.first[:devices]
7
9
  end
8
10
 
9
11
  def call
10
12
  return false unless valid?
11
13
 
12
14
  message_content = JeraPush::Message.format_hash @message
13
-
14
- case @type.to_sym
15
+ case @type
15
16
  when :broadcast
16
17
  JeraPush::Message.send_broadcast(content: message_content)
17
18
  when :specific
@@ -1,3 +1,3 @@
1
1
  module JeraPush
2
- VERSION = "1.2.3"
2
+ VERSION = "1.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jera_push
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jera
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-22 00:00:00.000000000 Z
11
+ date: 2020-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails