peak_flow_utils 0.1.18 → 0.1.19

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: 1d6ad793f87d038dc928420a3c35e046fa1fcfb4f610e4fd6bd1c9f8fa445a9e
4
- data.tar.gz: 9abdb774bfa6fd91896dfdbe55b6d6d7e931804035712aa51e1c576ab9d4d6cf
3
+ metadata.gz: bbb8a48ea294481df8df3c87b5b17eca7c7b2715027a512655f66a318acb8e2e
4
+ data.tar.gz: 1970d5b4843db5df6396e12d6cacfa70049af0ac8946f4e7243d3a7f70b5d981
5
5
  SHA512:
6
- metadata.gz: ef054a48493eb11175e79cfdac7b9c2ae5258c8d67c3113bb0c61633404df7c6b674dc2fda6809a3c0ded02533f7fe88407bc4b8693a6c982d772f84a1f2de51
7
- data.tar.gz: 6b4cd15ee4e07feabc1e0c4b6bb9efc59aff36dad76c8fae97ff9f8d1d486dc570ae5e69997f872105dffc6036e167beb00e0995b5b115561964facc12b63da2
6
+ metadata.gz: d1866c116955f38e9f2dc3c2e06fbeca908ed4c0bb425348a82fa8f1522fcfb1e47d1c96fe1a32328bd44f439f26dfddb97285dd0c19b0725f5241dcdb671d51
7
+ data.tar.gz: ac9fa1d930c30b5d32d450b10bd2af6ec95ead713b64e686ab07de7cbec5db94e5b4048e0a16e13657d06f1d483a5d4252d1c3d4068e188cfcd4586cc55a1349
@@ -0,0 +1,39 @@
1
+ class PeakFlowUtils::ParseJson
2
+ def initialize(object)
3
+ @object = object
4
+ end
5
+
6
+ def parse
7
+ parse_to_json(@object)
8
+ end
9
+
10
+ def active_record?(object)
11
+ object.class.ancestors.any? do |ancestor|
12
+ ancestor.name == "ActiveRecord::Base"
13
+ end
14
+ end
15
+
16
+ def parse_to_json(object)
17
+ if object.is_a?(Hash)
18
+ result = {}
19
+
20
+ object.each do |key, value|
21
+ result[key] = parse_to_json(value)
22
+ end
23
+
24
+ return result
25
+ elsif object.is_a?(Array)
26
+ return object.map do |value|
27
+ parse_to_json(value)
28
+ end
29
+ elsif active_record?(object)
30
+ result = "#<#{object.class.name} id: #{object.id}"
31
+ result << " name: \"#{object.name}\"" if object.respond_to?(:name)
32
+ result << ">"
33
+
34
+ return result
35
+ end
36
+
37
+ object
38
+ end
39
+ end
@@ -106,7 +106,7 @@ class PeakFlowUtils::Notifier
106
106
  }
107
107
  }
108
108
 
109
- send_notify_request(data: data, uri: uri)
109
+ send_notify_request(data: PeakFlowUtils::ParseJson.new(data).parse, uri: uri)
110
110
  end
111
111
 
112
112
  def notify_message(message, **opts)
@@ -1,3 +1,3 @@
1
1
  module PeakFlowUtils
2
- VERSION = "0.1.18".freeze
2
+ VERSION = "0.1.19".freeze
3
3
  end
@@ -16,6 +16,7 @@ module PeakFlowUtils
16
16
  autoload :NotifierResponse, "#{path}/notifier_response"
17
17
  autoload :NotifierSidekiq, "#{path}/notifier_sidekiq"
18
18
  autoload :HandlerHelper, "#{path}/handler_helper"
19
+ autoload :ParseJson, "#{path}/parse_json"
19
20
 
20
21
  autoload :ApplicationRecord, "#{models_path}/application_record"
21
22
  autoload :Group, "#{models_path}/group"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peak_flow_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaspernj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-21 00:00:00.000000000 Z
11
+ date: 2024-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -138,7 +138,7 @@ dependencies:
138
138
  version: '0'
139
139
  description: Utilities to be used with PeakFlow.
140
140
  email:
141
- - kaspernj@gmail.com
141
+ - k@spernj.org
142
142
  executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
@@ -170,6 +170,7 @@ files:
170
170
  - app/services/peak_flow_utils/group_service.rb
171
171
  - app/services/peak_flow_utils/handlers_finder_service.rb
172
172
  - app/services/peak_flow_utils/model_inspector.rb
173
+ - app/services/peak_flow_utils/parse_json.rb
173
174
  - app/services/peak_flow_utils/sidekiq_parameters_logging.rb
174
175
  - app/services/peak_flow_utils/translation_service.rb
175
176
  - app/services/peak_flow_utils/translations_parser_service.rb
@@ -219,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
220
  - !ruby/object:Gem::Version
220
221
  version: '0'
221
222
  requirements: []
222
- rubygems_version: 3.2.32
223
+ rubygems_version: 3.5.3
223
224
  signing_key:
224
225
  specification_version: 4
225
226
  summary: Utilities to be used with PeakFlow.