noticed 2.5.0 → 2.5.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: 5d93cc608d5422344ca6aff8b4941508dc76b3192e9052c853677f2bc222a98e
4
- data.tar.gz: 7932559c8b60c97b0798815872f8146588bfb7bb3b82cb5a3a60e53fbe49bf14
3
+ metadata.gz: 8e02a5a52bcb1a03842de3987b485c1b9dcfa061ec9ebec81c30188d1f7f17ac
4
+ data.tar.gz: e53c49649b8e3fb960f2bf00ba041e2c6790e755dcf5e470ca6a22d95c7e9e7b
5
5
  SHA512:
6
- metadata.gz: 223e40cacfffb9da94953284319f5fb865161996daf39d0c7b3c5697cd41e1923fc394e3d3ee782d1eba8513adcb91006ef6bc962fb1908672181eb024de880c
7
- data.tar.gz: aac70f09103d1737c5cef2cbfdf87275cc5f595dc84ffd38500561585c4f89574e427448fc8011cbc0bb16b9b06f191cecbadc9831ed8c60a857b0cf9e2d330b
6
+ metadata.gz: 94906ad5fdc52cd42968466db06b9d013732bff427e758626fd255b7405a4741c355bf2fe3451a4b2c554362e5084e42590ab9f1253e3a8bac091c7e2ea93c94
7
+ data.tar.gz: c78a8e906f66e791f22410466d1b80319689060249dd17702c9c5c85bd836ab6ea5212bd5258733973f9f790f0d20e3226e0e6920f9dbf1b16b879a5d5a074d3
@@ -1,5 +1,5 @@
1
1
  module Noticed
2
- class BulkDeliveryMethod < ApplicationJob
2
+ class BulkDeliveryMethod < Noticed.parent_class.constantize
3
3
  include ApiClient
4
4
  include RequiredOptions
5
5
 
@@ -6,12 +6,25 @@ module Noticed
6
6
  required_options :json
7
7
 
8
8
  def deliver
9
- post_request url, headers: evaluate_option(:headers), json: evaluate_option(:json)
9
+ headers = evaluate_option(:headers)
10
+ json = evaluate_option(:json)
11
+ response = post_request url, headers: headers, json: json
12
+
13
+ if raise_if_not_ok?
14
+ raise ResponseUnsuccessful.new(response, url, {headers: headers, json: json}) unless JSON.parse(response.body)["ok"]
15
+ end
16
+
17
+ response
10
18
  end
11
19
 
12
20
  def url
13
21
  evaluate_option(:url) || DEFAULT_URL
14
22
  end
23
+
24
+ def raise_if_not_ok?
25
+ value = evaluate_option(:raise_if_not_ok)
26
+ value.nil? ? true : value
27
+ end
15
28
  end
16
29
  end
17
30
  end
@@ -6,12 +6,25 @@ module Noticed
6
6
  required_options :json
7
7
 
8
8
  def deliver
9
- post_request url, headers: evaluate_option(:headers), json: evaluate_option(:json)
9
+ headers = evaluate_option(:headers)
10
+ json = evaluate_option(:json)
11
+ response = post_request url, headers: headers, json: json
12
+
13
+ if raise_if_not_ok?
14
+ raise ResponseUnsuccessful.new(response, url, {headers: headers, json: json}) unless JSON.parse(response.body)["ok"]
15
+ end
16
+
17
+ response
10
18
  end
11
19
 
12
20
  def url
13
21
  evaluate_option(:url) || DEFAULT_URL
14
22
  end
23
+
24
+ def raise_if_not_ok?
25
+ value = evaluate_option(:raise_if_not_ok)
26
+ value.nil? ? true : value
27
+ end
15
28
  end
16
29
  end
17
30
  end
@@ -1,3 +1,3 @@
1
1
  module Noticed
2
- VERSION = "2.5.0"
2
+ VERSION = "2.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noticed
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-17 00:00:00.000000000 Z
10
+ date: 2025-01-09 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
@@ -86,7 +85,6 @@ homepage: https://github.com/excid3/noticed
86
85
  licenses:
87
86
  - MIT
88
87
  metadata: {}
89
- post_install_message:
90
88
  rdoc_options: []
91
89
  require_paths:
92
90
  - lib
@@ -101,8 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
99
  - !ruby/object:Gem::Version
102
100
  version: '0'
103
101
  requirements: []
104
- rubygems_version: 3.5.23
105
- signing_key:
102
+ rubygems_version: 3.6.2
106
103
  specification_version: 4
107
104
  summary: Notifications for Ruby on Rails applications
108
105
  test_files: []