action_push_native 0.3.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1136dcc9cab40bcc1e6c8432841981cea0f21f8dc7ac70735cc595f7d79cf6a6
4
- data.tar.gz: b397de4ce3970c7c255271e184eaa49d1e15518a43c801c07397a37985f88fb8
3
+ metadata.gz: 221069cb3459cd2c07eaa4d7a3d2c98c741f2817a15a47cf27e8bc4ea6dd93fb
4
+ data.tar.gz: 5719b281f487a336d96100213946fa41ce8115a573cb1888cfe0eb4422c97bb6
5
5
  SHA512:
6
- metadata.gz: 5802271587c60f66a7aab9a99f37fa715feddb61dd6e4881fac825e2e517a6104d6144b8998125195f1742ea66152731ede28fdb792eb04db2a7ec3f8b1a3873
7
- data.tar.gz: 4044a51c31d921df83f7c451d6416d689a93f2ca8cac55ff0f50a45b186de4697f717f39d581738d69012091a61d881f5ddfadd615f2a62709d962fa2fcd56c2
6
+ metadata.gz: d308c3a5d4a6d721bfe60a09d4f3dc0fdce3c7058ecfc82ed7dfd050b10b121adeadbd89ed48b843bd53a52a62b53fc958d6fd5191b666c83441d8ae51735e62
7
+ data.tar.gz: b782ef4aac0fca069a82415cdb278c1fb5d162a3608f8cede1404934dd859583b7a54b55880925c1e12016e776b734dab352ebbb8ba31b2e95cbf1c3a31c9d3e
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionPushNative
4
- class Device < ApplicationRecord
4
+ class Device < Record
5
5
  include ActiveSupport::Rescuable
6
6
 
7
7
  rescue_from(TokenError) { destroy! }
8
8
 
9
9
  belongs_to :owner, polymorphic: true, optional: true
10
10
 
11
- enum :platform, { apple: "apple", google: "google" }
11
+ enum :platform, { apple: "apple", google: "google" }, validate: true
12
12
 
13
13
  def push(notification)
14
14
  notification.token = token
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionPushNative
4
+ class Record < ActiveRecord::Base
5
+ self.abstract_class = true
6
+ end
7
+ end
8
+
9
+ ActiveSupport.run_load_hooks :action_push_native_record, ActionPushNative::Record
@@ -1,3 +1,3 @@
1
1
  module ActionPushNative
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -27,7 +27,7 @@ module ActionPushNative
27
27
  end
28
28
 
29
29
  def self.config_for(platform, notification)
30
- platform_config = Rails.application.config_for(:push)[platform.to_sym]
30
+ platform_config = config[platform.to_sym]
31
31
  raise "ActionPushNative: '#{platform}' platform is not configured" unless platform_config.present?
32
32
 
33
33
  if notification.application.present?
@@ -38,6 +38,13 @@ module ActionPushNative
38
38
  end
39
39
  end
40
40
 
41
+ def self.config
42
+ path = Rails.application.paths["config/push"].existent.first
43
+ raise "ActionPushNative: config/push.yml not found" unless path
44
+
45
+ Rails.application.config_for(Pathname.new(path))
46
+ end
47
+
41
48
  def self.deprecator
42
49
  @deprecator ||= ActiveSupport::Deprecation.new
43
50
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_push_native
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacopo Beschi
@@ -105,6 +105,7 @@ files:
105
105
  - Rakefile
106
106
  - app/jobs/action_push_native/notification_job.rb
107
107
  - app/models/action_push_native/device.rb
108
+ - app/models/action_push_native/record.rb
108
109
  - db/migrate/20250610075650_create_action_push_native_device.rb
109
110
  - lib/action_push_native.rb
110
111
  - lib/action_push_native/configured_notification.rb